A practitioner’s guide toros2_control

bence.magyar@five.ai

Bence Magyar●Principal Software Engineer at FiveAI / Bosch UK●●

ros_control and ros2_control maintainer
PhD in Robotics from Heriot-Watt University, UKHistory

pr2_controller_manager

ros_control

ros2_control(pr2_mechanism)2012/20172017/20222009

https://control.ros.org/master/doc/supported_robots/supported_robots.html

ros2_control

●
●
●
●
●
●

Reuse hardware drivers
Free controllers!
Free simulator integration
MoveIt2, rviz, Nav2
Manage your hardware access like a pro
Cheat: things you’ve never thought aboutno ros2_control

●
●
●
●

I have controllers on anembedded board already“I know control better than X” andhave controllers already written“I have just this one robot, whybother with this complexity?”“Hah! I already have ros_control”

●
●
●
●
●
●
●
●
●
●

General, robot-agnostic framework
Collection of official controllers, defining de-facto
standard ROS interfaces to 3rd party
Off-the-shelf Gazebo integration
Stability
Supported joint interfaces: position, velocity, effort
Code complexity high, templating and inheritanceController lifecycle inspired by Orocos, custom
Unclear semantics: everything is the RobotHW orcontroller
Opt-in Hardware Composition
RobotHW and boilerplate code

2

●
●

✅
✅

●
●
●
●
●
●

✅
New features!
Supported joint interfaces: no limitations
Code leaner, more modern C++
Controller lifecycle via ROS2 LifecycleNode[System|Actuator|Sensor]Component, Controller
and Broadcaster
Hardware Composition is first class citizen
Default ros2_control_node
Hardware lifecycle
Synchronous but variable rate for controllers
Chaining controllers
Asynchronous controllers* & hardware*
Hardware failure handling
Emergency stop handling*●
●
●
●
●
●
●
●

Hardwarecomponents

●
●
●
●

sit

lelifecyc

r_rollecont geramanpojoint_trajectory_controller
diff_drive_controller
forwarding controllers
gripper_controllers

ginin scha troller
conionSystemComponent
SensorComponent
ActuatorComponent

com

●
●
●

Controllers

Broadcasters●●●

joint_state_broadcaster
imu_broadcaster
force_torque_broadcasterros2_control CLI - Integrated with ROS2 CLI$ ros2 control list_hardware_interfacescommand interfaces
flange_gpios/digital_out_1 [available] [unclaimed]flange_gpios/digital_out_2 [available] [unclaimed]
joint1/position [available] [claimed]
joint1/velocity [available] [unclaimed]
joint2/position [available] [claimed]
joint2/velocity [available] [unclaimed]state interfaces
flange_gpios/digital_in_1
flange_gpios/digital_in_2
flange_gpios/digital_out_1
flange_gpios/digital_out_2
joint1/effort
joint1/position
joint1/velocity
joint2/effort
joint2/position
joint2/velocity

ros2_control CLI - Integrated with ROS2 CLI$ ros2 control list_controllers
joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active
forward_position_controller[forward_command_controller/ForwardCommandController] active
joint_trajectory_controller[joint_trajectory_controller/JointTrajectoryController] inactive

ros2_control CLI - Integrated with ROS2 CLI$ ros2 control list_controllers -v…
forward_position_controller[forward_command_controller/ForwardCommandController] active
claimed interfaces:
joint1/position
joint2/position
required command interfaces:
joint1/position
joint2/position
required state interfaces:
chained to interfaces:
exported reference interfaces:…

URDF extension with<ros2_control>-tag

URDF extension with<ros2_control>-tagConfiguring standard controllers

This can end-up in convoluted and complex controllers…

Using controller-chaining…

Using controller-chaining…

CLI extra$ ros2 control view_controller_chains

What config files and where?

HW error handlingHW error handlingHW error handlingHW error handlingEmergency stops*

Emergency stops*

Emergency stops*

Emergency stops*

Let’s check an example

Real hardware

Gazebosimulation

Real hardware

Mock

Contributing

https://github.com/ros-controlsReferences● https://control.ros.org●●●ros_control paper in the Journal of Open Source Softwareros2_control presentations○ https://control.ros.org/master/doc/resources/resources.html
ros2_control resources○ https://ros-controls.github.io/control.ros.org/○ https://github.com/ros-controls/ros2_control○ https://github.com/ros-controls/ros2_controllers○ https://github.com/ros-controls/ros2_control_demos○ https://github.com/ros-controls/roadmap/blob/master/documentation_resources.md

Thank you!
Denis Štogl, Karsten Knese,
Victor Lopez, Jordan Palacios,Tyler Weaver, Márk Szitanics,
Paul Gesel, Tony Najjar, AndyZelenak, Olivier Stasse, Sachin
Kumar, Noel Jiménez García,
Jaron Lundwall, Alejandro
Hernández Cordero, Colin
MacKenzie, Tim Clephas,Lovro Ivanov, Jafar Abdi,
Michael Wiznitzer, Patrick
Roncagliolo, Bence Magyar
and many more!