Skip to content

Example Universal Robots

Benjamin Hug edited this page Nov 19, 2021 · 15 revisions

This package provides an interface between ROS 2 and the UR3e, UR5e, and UR10e simulation models of the Universal Robots running in Webots. It includes several simulations of these robots.

UR5e Simple Example

This simulation can be started with the following launch file:

ros2 launch webots_ros2_universal_robot robot_launch.py

This simulation contains one UR5e robot in a very simple environment.

MoveIt2 Integration

This example shows how you can control the robotic arm by moving it in RViz with the help of MoveIt2.

Run the following launch file to test it:

ros2 launch webots_ros2_universal_robot moveit_demo_launch.py

Then you will be able to move the robotic arm in RViz and press Plan & Execute to see the same movement in the Webots simulation.

Universal Robot Image

Multirobot Example

This example shows how you can make control multiple robots to collaborate in a single simulation.

Run the UR5e and IRB 4600 simulation in Webots using:

ros2 launch webots_ros2_universal_robot multirobot_launch.py

Interact with the Robot

Move the Robot

The /ur_joint_trajectory_controller/follow_joint_trajectory action server can be tested directly using the ROS2 action CLI interface to move the robot (if more than one robot is present in the simulation, the action name should be changed, e.g. /UR3e/ur_joint_trajectory_controller/follow_joint_trajectory):

ros2 action send_goal /follow_joint_trajectory control_msgs/action/FollowJointTrajectory "{
  trajectory: {
    joint_names: [shoulder_pan_joint, shoulder_lift_joint, elbow_joint, wrist_1_joint, wrist_2_joint, wrist_3_joint],
    points: [
      { positions: [3.02, -1.63, -1.88, 1.01, 1.51, 1.13], time_from_start: { sec: 5, nanosec: 500 } },
      { positions: [-1.01, 0.38, -0.63, -0.88, 0.25, -1.63], time_from_start: { sec: 6, nanosec: 500 } },
      { positions: [-1.01, 0.38, -0.63, -0.88, 0.25, 6.2], time_from_start: { sec: 50, nanosec: 500 } }
    ]
  },
  goal_tolerance: [
    { name: shoulder_pan_joint, position: 0.01 },
    { name: shoulder_lift_joint, position: 0.01 },
    { name: elbow_joint, position: 0.01 },
    { name: wrist_1_joint, position: 0.01 },
    { name: wrist_2_joint, position: 0.01 },
    { name: wrist_3_joint, position: 0.01 }
  ]
}"

Display the Joint State

The joint state (/joint_states topic) can be displayed directly using the ROS2 topic CLI interface (if more than one robot is present in the simulation, the action name should be changed, e.g. /UR3e/joint_states):

ros2 topic echo /joint_states
Clone this wiki locally