Skip to main content
Version: 9

ros2_control Values

ROS 2 Control Configuration

warning

If your manipulator/gripper/base hardware does not have a ros2_control high-bandwidth streaming driver, refer to the Guide to Non-ROS 2 Control Drivers.

example_robot_ws Checkpoint

If you are following this guide with example_robot_ws, your workspace should look like branch step4. We are now editing example_robot_mock config.yaml.

ros2_control

Type: object (required if using ros2_control)

Description: Configuration for ros2_control controllers and hardware interfaces.

ros2_control.config

Type: object (required)

Description: Location of the ros2_control controller configuration file.

ros2_control:
config:
package: "example_robot_mock"
path: "config/control/ros2_controllers.yaml"
Teleoperation Controllers
Required for Teleoperation

The following broadcasters and controllers must be defined in your ros2_controllers.yaml and listed in either controllers_active_at_startup or controllers_inactive_at_startup in config.yaml. Without them, teleoperation from the MoveIt Pro UI (joint jog, pose jog, and interactive marker modes) will fail with errors like "Failed to get the Joint Velocity Controller parameters".

The following broadcasters and controllers must be configured for MoveIt Pro teleoperation:

ControllerTypePurpose
joint_state_broadcasterjoint_state_broadcaster/JointStateBroadcasterPublishes joint states (active at startup)
joint_trajectory_admittance_controllerjoint_trajectory_admittance_controller/JointTrajectoryAdmittanceControllerTrajectory execution with optional admittance (active at startup)
velocity_force_controllervelocity_force_controller/VelocityForceControllerPose-based teleoperation (inactive at startup)
joint_velocity_controllerjoint_velocity_controller/JointVelocityControllerJoint-based teleoperation (inactive at startup)

All controllers should be set to command all the joints in your planning group. As a reminder, if your hardware does not have ros2_control high-bandwidth streaming drivers, refer to our Guide to Non-ROS 2 Control Drivers.

The velocity_force_controller and joint_velocity_controller should be listed in controllers_inactive_at_startup because they claim the same hardware resources as the trajectory controller. MoveIt Pro activates them on demand when the user starts a teleoperation session.

note

If the JointTrajectoryAdmittanceController for your arm is not named "joint_trajectory_admittance_controller" or you want to use a custom JTC you will need to duplicate the Teleoperate Objective and fill out the joint_trajectory_controller_name and controller_action_server ports exposed by Request Teleoperation.

Make your example_robot_mock/config/control/ros2_controllers.yaml
controller_manager:
ros__parameters:
update_rate: 500 # Hz
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
# force_torque_sensor_broadcaster:
# type: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster
joint_trajectory_admittance_controller:
type: joint_trajectory_admittance_controller/JointTrajectoryAdmittanceController
velocity_force_controller:
type: velocity_force_controller/VelocityForceController
joint_velocity_controller:
type: joint_velocity_controller/JointVelocityController
robotiq_gripper_controller:
type: position_controllers/GripperActionController
robotiq_activation_controller:
type: robotiq_controllers/RobotiqActivationController

# Need to specify these because our MuJoCo robotiq has additional actuators
joint_state_broadcaster:
ros__parameters:
use_local_topics: false
joints:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
- robotiq_85_left_knuckle_joint
interfaces:
- position
- velocity

# force_torque_sensor_broadcaster:
# ros__parameters:
# sensor_name: tcp_fts_sensor
# state_interface_names:
# - force.x
# - force.y
# - force.z
# - torque.x
# - torque.y
# - torque.z
# frame_id: tool0

joint_trajectory_admittance_controller:
ros__parameters:
# Joint group to control.
planning_group_name: manipulator
# The tip link of the kinematic chain, i.e. the frame that will be controlled.
ee_frame: grasp_link
# The frame where the force / torque sensor reading is given.
# (Needs to exist in the kinematic chain).
sensor_frame: ft_frame
# The name of the force torque sensor in the robot description which will be used in the admittance calculation.
# ft_sensor_name: tcp_fts_sensor
# Joint accelerations chosen to match MoveIt configs.
stop_accelerations:
- 30.0
- 30.0
- 30.0
- 30.0
- 30.0
- 30.0

velocity_force_controller:
ros__parameters:
# Joint group to control.
planning_group_name: manipulator
# The tip link of the kinematic chain, i.e. the frame that will be controlled.
ee_frame: grasp_link
# The frame where the force / torque sensor reading is given.
# (Needs to exist in the kinematic chain).
sensor_frame: ft_frame
# The name of the force torque sensor in the robot description which will be used in the admittance calculation.
# ft_sensor_name: tcp_fts_sensor
# Maximum joint-space velocities.
max_joint_velocity:
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
# Maximum joint-space accelerations.
max_joint_acceleration:
- 2.0
- 2.0
- 2.0
- 2.0
- 2.0
- 2.0
# Maximum Cartesian-space velocities.
max_cartesian_velocity:
- 0.25
- 0.25
- 0.25
- 1.0
- 1.0
- 1.0
# Maximum Cartesian-space accelerations.
max_cartesian_acceleration:
- 2.0
- 2.0
- 2.0
- 4.0
- 4.0
- 4.0
# Rate in Hz at which the controller will publish the state.
state_publish_rate: 10
# Damping coefficient for the Jacobian damped least-squares inverse.
jacobian_damping: 0.005
# Timeout in seconds after which the controller will stop motion if no new commands are received.
command_timeout: 0.2
# Padding (in radians) to add to joint position limits as a safety margin.
joint_limit_position_tolerance: 0.02

joint_velocity_controller:
ros__parameters:
# Joint group to control.
planning_group_name: manipulator
# Maximum joint-space velocities.
max_joint_velocity:
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
# Maximum joint-space accelerations.
max_joint_acceleration:
- 2.0
- 2.0
- 2.0
- 2.0
- 2.0
- 2.0
command_interfaces: ["position"]
# Padding (in radians) to add to joint position limits as a safety margin.
joint_limit_position_tolerance: 0.02
# Timeout in seconds after which the controller will stop motion if no new commands are received.
command_timeout: 0.2
# Rate in Hz at which the controller will publish the state.
state_publish_rate: 20

robotiq_gripper_controller:
ros__parameters:
default: true
joint: robotiq_85_left_knuckle_joint
allow_stalling: true
stall_timeout: 0.05
goal_tolerance: 0.02

robotiq_activation_controller:
ros__parameters:
default: true

ros2_control.controllers_active_at_startup

Type: array (optional, default: [])

Description: List of controllers to load and activate when MoveIt Pro starts.

ros2_control:
controllers_active_at_startup:
- "joint_state_broadcaster"
# - "force_torque_sensor_broadcaster"
- "joint_trajectory_admittance_controller"
- "robotiq_gripper_controller"
controllers_inactive_at_startup:
- "velocity_force_controller"
- "joint_velocity_controller"

We recommend listing all broadcasters here. If you have a set of non-overlapping "primary" controllers and want to ensure they claim your hardware resources on startup, also put those here.


ros2_control.controllers_inactive_at_startup

Type: array (optional, default: [])

Description: List of controllers to load but not activate at startup (can be activated later).

The teleoperation controllers (velocity_force_controller and joint_velocity_controller) must be listed here. They claim the same hardware resources as the trajectory controller, so they cannot be active simultaneously. MoveIt Pro will activate them on demand when the user starts a teleoperation session.

warning

A controller must be listed in either controllers_active_at_startup or controllers_inactive_at_startup or it will not be spawned. If a required teleoperation controller is missing from both lists, teleop will fail at runtime.


ros2_control.controllers_not_managed

Type: array (optional, default: [])

Description: List of controllers that MoveIt Pro should not spawn or manage.

ros2_control:
controllers_not_managed:
- "external_controller"

This is typically empty.


ros2_control.controller_shared_topics

Type: array (optional, default: [])

Description: Topic remapping configuration for sharing topics between controllers.

ros2_control:
controller_shared_topics:
/joint_commands:
- "/controller1/joint_commands"
- "/controller2/joint_commands"

This is typically empty.


Multi-arm, Mobile Manipulator, and Multi-tip Tool Teleoperation Considerations

Controller Switching

It is important to understand that for safety reasons, ROS 2 Control will not enable you to switch from Controller A to Controller B unless it can fully allocate the command resources Controller A held.

For example, if you want to switch from a controller that commands all joints of your mobile manipulator to a controller that commands only the manipulator joints, you must have controllers configured for:

  • mobile base + manipulator
  • manipulator only
  • mobile base only

step5 Checkpoint

Your example_robot_ws workspace should now look like branch step5.