Universal Robots ROS2 Driver

repository·main·Indexed 21 days ago

https://github.com/universalrobots/universal_robots_ros2_driver

A high-performance, secure interface for controlling Universal Robots (UR) manipulators within the ROS2 ecosystem. Built on the Universal_Robots_Client_Library, it supports the entire UR robot line (3 kg to 30 kg payload) and controllers including PolyScope X, PolyScope 5, and CB3. Key features include integration with MoveIt2, automatic speed scaling, and the ur_calibration tool for improving URDF model accuracy. Supports ROS2 distributions Humble, Jazzy, Kilted, Lyrical, and Rolling.

Tokens
26.6K
Snippets
60
Records
144
Agent score
74%

What's inside universal_robots_ros2_driver

  1. Overview of Universal Robots ROS2 Driver

    main

    The Universal Robots ROS2 Driver is a manipulator driver built on top of the Universal_Robots_Client_Library. It provides low-latency, secure communication with UR robots and supports key cobot functionalities such as:

    • Pause at emergency stop
    • Safeguard stop
    • Automatic speed scaling (to avoid violating safety settings)
    • Manual speed scaling from the teach pendant

    By using the externalControl URCap, you can integrate ROS2 behaviors directly into the robot program. The driver is compatible with the entire UR robot line (3 kg to 30 kg payload) and supports robots with PolyScope X, PolyScope 5, or CB3 controllers.

  2. Review supported ROS 2 Driver features

    main

    The Universal Robots ROS 2 Driver supports a wide range of control modes and robot interactions. Key capabilities include:

    Control Modes

    • Joint-position-based control: Supported.
    • Scaled joint-position-based control: Supported.
    • Joint-velocity-based control: Supported (Note: velocity-based joint trajectory controller may require gain parameter tweaking for each model).
    • Joint-effort-based control (torque control): Supported.
    • Trajectory forwarding: Supported (executes on the robot).
    • Freedrive Mode: Supported.
    • Tool Contact mode: Supported.
    • Force Mode: Supported.

    Note: Cartesian position-based and Cartesian twist-based control are currently NOT supported.

    Robot Interaction & Status

    • TCP Wrench Reporting: Supported.
    • Program Control: Supports pausing programs and continuing trajectories after EM-Stop or protective stop resumes.
    • I/O & Status: Supports getting/setting I/O states and sending custom script commands.
    • Tool Communication: Supports using the Universal_Robots_ToolComm_Forwarder_URCap on e-series robots.
    • Headless Mode: Supported.
    • Calibration: Supports extracting calibration from the robot.
    • Connectivity: Supports reconnecting on a disconnected robot.
  3. Use ur_calibration to improve URDF model accuracy

    main

    The ur_calibration package allows you to extract factory calibration data from a Universal Robots robot. This data provides exact forward and inverse kinematics determined at the factory. By applying this calibration to ur_description, you can obtain a more accurate URDF model.

    While not strictly required for basic operation, performing this calibration is highly recommended when using the universal_robots_ros2_driver. Without it, end effector positions may deviate from the expected model by several centimeters.

  4. Requirements for real-time robot control

    main

    Controlling a Universal Robot via ROS requires strict cycle times. To ensure stability and performance, follow these hardware and software recommendations:

    • Kernel: Use a lowlatency or PREEMPT_RT-patched kernel.
    • Network: Use a direct network connection between the ROS PC and the robot controller. Avoid using a network switch if possible.
  5. Use moveit_configs_builder compatible configurations in ur_moveit_config

    main
    The ur_moveit_config package has been restructured to be compatible with moveit_configs_builder. This change simplifies the configuration process but means the package aims for simplicity rather than implementing every feature of the builder (such as multiple IK solutions). Users looking for advanced features like multiple IK solutions must implement them manually.
  6. Understand the UR Hardware Interface and ros2_control integration

    main

    The UR hardware interface is the core component of the ROS driver, responsible for communicating with the robot controller to send commands and receive status updates. It is implemented using the ros2_control framework.

    Key Concept: Hardware Interface vs. Controllers

    • The Hardware Interface provides the low-level communication and exposes interfaces (like position, velocity, or effort).
    • The Controller (e.g., JointTrajectoryController or ForceModeController) defines how the robot's motion is actually controlled using those interfaces. To move the robot, you must load and use a controller that utilizes the hardware interface.
  7. How the controller_stopper node works

    main

    The controller_stopper node ensures that ROS motion commands are only sent when the robot is actually running a program. It monitors the /io_and_status_controller/robot_program_running topic.

    When the robot program is not running, the controller_stopper automatically deactivates all motion controllers (unless they are explicitly marked as 'consistent'). This behavior provides two main benefits:

    1. Transparency: Callers attempting to send commands to an inactive controller are immediately informed that the controller cannot accept commands.
    2. Safety/State Management: Any running actions on the ROS controller are aborted when the program stops.

    Once the robot program starts running again, any previously active motion controllers are automatically reactivated.

  8. Use stop_program and play_program flags in SetMode action

    main

    The SetMode action includes two boolean flags to manage the program lifecycle during a state change:

    • stop_program: If true, the currently running program is stopped before the robot state changes. When used with the controller_stopper, this deactivates any motion controller and stops any active ROS actions on those controllers.
    • play_program: If true, the program is started after the robot state has been set.

    Warning: A protective stop (P-Stop) or emergency stop (E-Stop) only pauses the program. If the program is resumed after the fault is cleared, it will continue from where it left off. It is recommended to use stop_program: true and then restart the program when recovering from a fault to ensure a clean state.

  9. How blocking_read works

    main

    The ur_robot_driver manages two control loops: the ROS driver loop (reading state and sending commands) and the robot's internal control loop. If these loops run at different clocks, a phase shift occurs, which can cause instability.

    Setting blocking_read:=true (the default) forces the ROS driver to wait for new robot state data before proceeding with the next control cycle. This synchronizes the ROS control loop to the pace of the robot's control loop, which is the recommended configuration for most single-robot setups.