urROS2Node
Connection to simulated cobot or physical cobot from Universal Robots over ROS 2
Since R2024a
Description
The
urROS2Node
object represents a connection from the ROS 2 enabled host computer to MATLAB.
The ROS 2 enabled host computer is further connected to a simulated collaborative robot
(cobot) from Universal Robots (either in the URSim offline simulator from Universal Robots)
or to a physical cobot. To interact with the simulated cobot to read robot state data, send
joint and cartesian control commands, and follow set of joint-space or task-space
waypoints, use this object with the functions listed in Object Functions.
Creation
Description
creates a
connection, ur
= urROS2Nodeur
, and tries to connect to the ROS 2 node, which is
further connected to a simulated cobot or physical cobot from Universal
Robots.
sets the JointStateTopic, FollowJointTrajectoryAction, and RigidBodyTree properties using one or more optional name-value
arguments.ur
= urROS2Node(Name=Value
)
Input Arguments
Properties
Object Functions
getJointConfiguration | Get current joint configuration from the robot |
getCartesianPose | Get current end-effector pose from the robot |
getEndEffectorVelocity | Get current end-effector velocities from the robot |
getJointVelocity | Get current joint velocities from the robot |
getMotionStatus | Get current motion status of the robot |
followTrajectory | Command robot to move along the desired joint space waypoints |
followWaypoints | Command robot to move along the desired task space waypoints |
sendCartesianPose | Command robot to move to desired Cartesian pose |
sendCartesianPoseAndWait | Command robot to move to desired Cartesian pose and wait for the motion to complete |
sendJointConfiguration | Command robot to move to desired joint configuration |
sendJointConfigurationAndWait | Command robot to move to joint configuration and wait for the motion to complete |
recordRobotState | Log the key robot state parameters during motion of robot |
executePrimaryURScriptCommand | Execute primary URScript command to control cobot over ROS interface |
executeSecondaryURScriptCommand | Execute secondary URScript command over ROS interface |
handBackControl | Get the control back from the External Control program node in the UR program tree |
Examples
Connect to a Cobot Using Auto-detection
Connect to the physical or simulated cobot (either in the URSim offline simulator from Universal Robots or in the Gazebo simulator), in the same host computer, over ROS2.
ur = urROS2Node;
Connect to a Cobot by Specifying Other Optional Arguments
Connect to the physical or simulated cobot (either in the URSim offline simulator from Universal Robots or in the Gazebo simulator), in the host computer, over ROS 2.
ur = urROS2Node;
Connect to the physical or simulated cobot (either in the URSim offline simulator from Universal Robots or in the Gazebo simulator), in the host computer by mentioning the rigid body tree object.
ur5e = loadrobot('universalUR5e')
ur = urROS2Node(RigidBodyTree=ur5e);
ur = urROS2Node with properties: RigidBodyTree: [1×1 rigidBodyTree] JointStateTopic: '/joint_states' FollowJointTrajectoryAction: '/scaled_pos_joint_traj_controller/follow_joint_trajectory' NumberOfJoints: 6 EndEffectorName: 'tool0'
Extended Capabilities
Version History
Introduced in R2024a