Main Content

followTrajectory

Command robot to move along the desired joint space waypoints

Since R2022a

Description

example

followTrajectory(ur,q,qd,qdd,trajtimes) commands the Universal Robots cobot connected through ROS interface to follow the desired set of joints for the trajectory, based on position, velocity, acceleration, and time samples.

Examples

collapse all

Connect to a cobot at IP address 192.168.2.112 on the ROS network.

ur = universalrobot('192.168.2.112');

Command the cobot to by providing the desired joint waypoints and by specifying the position, velocity, and acceleration for each waypoint segment, and the time samples for the trajectory.

jointwayPoints = [-20 -85 110 150 -70 0;
                  -10 -70  80 200 -70 0;
                    0 -40  90 270 -70 0;
                  -10 -70  80 200 -70 0;
                  -20 -85 110 150 -70 0;]*pi/180;

trajTimes = linspace(0,wayPointTimes(end),20);
[q,qd,qdd] = bsplinepolytraj(jointwayPoints',[0 wayPointTimes(end)],trajTimes);

followTrajectory(ur,q,qd,qdd,trajTimes);

Input Arguments

collapse all

Connection to physical or simulated cobot from Universal Robots, specified as a universalrobot object.

Desired position of joints in the trajectory at a given time sample, represented as a 6-by-N matrix, where N is the dimension of the trajectory.

Data Types: array

Desired velocity of joints in the trajectory at a given time sample, represented as a 6-by-N numeric vector, where N is the dimension of the trajectory.

Data Types: array

Desired acceleration of joints in the trajectory at a given time sample, represented as a 6-by-N numeric vector, where N is the dimension of the trajectory.

Data Types: array

Time sample of the trajectory at each joint, specified as a 1-by-N numeric vector, specified in seconds.

Data Types: array

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2022a