followWaypoints
Syntax
Description
followWaypoints(
commands the Universal Robots cobot connected through ROS interface to follow the desired
Cartesian waypoints based on absolute time for each waypoint segment.ur
,taskwaypoints
,waypointtimes
)
followWaypoints(
specifies options using one or more name-value arguments in addition to the input arguments
in previous syntax. For example, set the ur
,taskwaypoints
,waypointtimes
,Name=Value
)InterpolationMethod
to
bsplinepolytraj
.
Examples
Command the Cobot to Desired Cartesian Waypoints
Connect to a physical or simulated cobot, using either urROSNode
or
urROS2Node
object (based on the option for connectivity – ROS or ROS 2, which you selected in the
Hardware Setup screen).
Connect to a physical or simulated cobot at IP address
192.168.2.112
on the ROS network.ur = urROSNode('192.168.2.112');
Connect to a physical or simulated cobot on the ROS 2 network.
ur = urROS2Node;
Command the cobot to by providing the desired Cartesian waypoints and by specifying the absolute time for each waypoint segment.
taskwaypoints = [-pi/2 0 -pi/2 0.5 0 0.5; -pi/4 0 -pi/2 0.5 0.3 0.6; -pi/2 0 -pi/2 0.5 0 0.8; -3*pi/4 0 -pi/2 0.5 -0.3 0.6; -pi/2 0 -pi/2 0.5 0 0.5]; waypointTimes = [0 2 4 6 8]; followWaypoints(ur,taskwaypoints,waypointTimes);
Command the Cobot by Specifying the Interpolation Method and Number of Samples
Connect to a physical or simulated cobot, using either urROSNode
or
urROS2Node
object (based on the option for connectivity – ROS or ROS 2, which you selected in the
Hardware Setup screen).
Connect to a physical or simulated cobot at IP address
192.168.2.112
on the ROS network.ur = urROSNode('192.168.2.112');
Connect to a physical or simulated cobot on the ROS 2 network.
ur = urROS2Node;
Command the cobot to by providing the desired Cartesian waypoints and by specifying
the absolute time for each waypoint segment. Additionally, specify the
InterpolationMethod
as trapveltraj
and specify
the number of samples for trajectory generation as 100.
taskwaypoints = [-pi/2 0 -pi/2 0.5 0 0.5;
-pi/4 0 -pi/2 0.5 0.3 0.6;
-pi/2 0 -pi/2 0.5 0 0.8;
-3*pi/4 0 -pi/2 0.5 -0.3 0.6;
-pi/2 0 -pi/2 0.5 0 0.5];
waypointTimes = [0 2 4 6 8];
followWaypoints(ur,taskwaypoints,waypointTimes,InterpolationMethod='trapveltraj',NumberOfSamples=100);
Input Arguments
ur
— Connection to Universal Robots cobot
object
Connection to physical or simulated cobot from Universal Robots, specified as a
urROSNode
object or a urROS2Node
object.
taskwaypoints
— Desired Cartesian pose in the form of waypoints
position vector
Desired Cartesian pose in the form of waypoints of the simulated cobot, represented as a N-by-6 numeric vector, in the form of [thetaz thetay thetax x y z]. The units are radians and seconds respectively for the three axes, for N waypoints.
Data Types: numeric
waypointtimes
— Absolute time for each waypoint segment to complete the motion
double vector
Absolute time (time from start) for each waypoint segment to complete the motion, represented as a 1-by-N numeric vector, specified in seconds.
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: followwaypoints(ur,taskwaypoints,waypointtimes,InterpolationMethod='trapveltraj')
sets the Interpolation method.
InterpolationMethod
— Interpolation method to be considered to generate the motion commands
string scalar | 'trapveltraj'
| 'bsplinepolytraj'
| 'cubicpolytraj'
| 'quinticpolytraj'
Interpolation method to be considered to generate the motion commands using waypoints specified. In this case, only time is considered as the controlling factor for the shape of desired trajectory.
'trapveltraj'
— Generate a trajectory through a given set of input waypoints that follow a trapezoidal velocity profile.'bsplinepolytraj'
— Generate a piecewise cubic B-spline trajectory that falls in the control polygon.'cubicpolytraj'
— Generate a third-order polynomial that achieves a given set of input waypoints with corresponding time points.'quinticpolytraj'
— Generate a fifth-order polynomial that achieves a given set of input waypoints with corresponding time points.
Example: followwaypoints(ur,taskwaypoints,waypointtimes,InterpolationMethod='bsplinepolytraj')
.
NumberOfSamples
— Number of samples to interpolate the trajectory
positive integer
Number of samples used as data points to interpolate the trajectory, specified as a positive integer. Increasing the number of samples ensures a smooth tracking in the task space, but takes more time for the cobot to compute the trajectory.
Example: followwaypoints(ur,taskwaypoints,waypointtimes,InterpolationMethod='bsplinepolytraj',NumberofSamples=100)
.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2022a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)