1 of 32

ros2_control:

Fun with Controllers

wget https://raw.githubusercontent.com/ros-controls/roscon2024_control_workshop/refs/heads/master/docker-compose.yml

docker pull bmagyar/roscon2024_workshop:latest

docker compose run roscon2024

Attach from another terminal:

docker compose exec roscon2024 /bin/bash

2 of 32

$whoarewe (no command found)

Bence Magyar – [Dr. Bent’seh]

  • PhD in Robotics
  • Principal Software Engineer at Locus Robotics
  • ros_control and ros2_control maintainer

Denis Štogl – [Dr. Denis]

  • PhD, Control Engineer and Roboticist
  • Robotics Consultant at Stogl Robotics Consulting
  • ros2_control maintainer

3 of 32

References

  • https://control.ros.org/

  • ros_control paper in

the Journal of Open Source Software

  • ros2_control presentations

  • Github repositories at https://github.com/ros-controls

4 of 32

Thank you

for being

here!!

Bence Magyar, Denis Štogl, Christoph Froehlich, Sai Kishor Kothakota, Felix Exner, Manuel Muth, Alejandro Hernandez Cordero, Reza Kermani, Lennart Nachtigall, Takashi Sato, Henry Moore, Abrar Rahman Protyasha, Jakub Delicat, Wiktor Bajor, Silvio Traversaro, Noel Jimenez Garcia, Tony Baltovski, Vladimir Ivan, Mateus Menezes, Abishalini Sivaraman, Alex Moriarty, Marq Rasmussen, Paul Gesel, Olivier Stasse, Márk Szitanics,......... and many more!

5 of 32

6 of 32

7 of 32

Overview of Standard Controllers

Generics:

  • PID
  • Forwarding Controller
    • Forward Command – multiple joints, one interface
    • Multi Interfaces Fwd. Cmd. – one joint, multiple interfaces
    • Position Controllers – same as Fwd Controller but only for position interface
    • Velocity Controllers – same as Fwd Controller but only for velocity interface
    • Effort Controllers – same as Fwd Controller but only for effort interface

Mobile Robots

  • Steering Controllers
    • Bicycle – 1 drive joints, 1 steering joint
    • Tricycle – 2 drive joints, 1 steering joint (Tricycle Controller is an older version)
    • Ackerman – 2 drive joints, 2 steering joints
  • Differential Drive (Diff drive)

https://control.ros.org/rolling/doc/ros2_controllers/doc/controllers_index.html

8 of 32

Overview of Standard Controllers

Industrial Robotics (Arms)

  • Joint Trajectory Controller (JTC)
    • The most used one – interface for MoveIt2 and similar frameworks
  • Admittance Controller – force-position control in Cartesian space (using IK library from KDL)

Grippers:

  • Gripper Controller – 1 DoF grippers with position or effort interface
  • Parallel Gripper Controller – 1 DoF gripper with position and optionally max vel and max effort interfaces

Not Controllers → Broadcasters

  • Joint State Broadcaster – nothing works without it!!!
  • Force Torque Sensor Broadcaster
    • Has funky stuff in it, like filtering – cool for using in chain ahead of Admittance Controller
  • IMU Sensor Broadcaster
  • Range Sensor Broadcaster

https://control.ros.org/rolling/doc/ros2_controllers/doc/controllers_index.html

9 of 32

Configuring standard controllers

10 of 32

Complex controllers ⇾ break them and chain them

11 of 32

12 of 32

13 of 32

14 of 32

15 of 32

16 of 32

CLI extra

$ ros2 control view_controller_chains

17 of 32

Task1: Controller chaining task

18 of 32

Task1: Controller chaining

Build & source

  • cb && s

Things to launch/try

  • ros2 launch workshop_bringup tiago_chaining.launch.xml
  • ros2 control list_hardware_interfaces
  • ros2 control list_controllers
  • ros2 topic list
  • ros2 topic echo /range…

What’s missing? Check:

  • workshop_bringup/launch/tiago_chaining.launch.xml
  • workshop_bringup/config/chaining_controllers.yaml
  • workshop_controllers/src/chained_filter.cpp
  • workshop_controllers/include/…/chained_filter.hpp

19 of 32

Task 2: Fallback Controller

20 of 32

Task 2: Fallback Controller

21 of 32

Task 2: Fallback Controller

Usage:

Task:

ros2 launch workshop_bringup tiago_fallback.launch.xml

ros2 control list_controllers

ros2 service call /faulty_arm_controller/set_fault example_interfaces/srv/SetBool "data: true"

ros2 control list_controllers

22 of 32

Task 2: Fallback Controller

Task:

  • Configure a fallback controller for a failing controller

  • Test how it failing and check the result

Task - commands:

ros2 launch workshop_bringup tiago_fallback.launch.xml

ros2 control list_controllers

ros2 service call /faulty_arm_controller/set_fault example_interfaces/srv/SetBool "data: true"

ros2 control list_controllers

23 of 32

Task 3: Async Controller

24 of 32

Task 3: Async Controller

ros2 launch workshop_bringup task3_async.launch.xml

ros2 control list_controllers

ros2 topic hz /joint_states

ros2 service call /sleepy_controller/set_slow_control_mode example_interfaces/srv/SetBool "data: true"

25 of 32

Task 3: Async Controller

ros2 launch workshop_bringup task3_async.launch.xml

ros2 control list_controllers

ros2 topic hz /joint_states

ros2 service call /sleepy_controller/set_slow_control_mode example_interfaces/srv/SetBool "data: true"

Task:

  1. Analyse the controllers’ performance
  2. Make sleepy controller asynchronous
  3. Analyse the controllers’ performance

Hint: https://control.ros.org

26 of 32

Task 4: Multi-robot scalability

  • Let’s apply the same set of TIAGo chainable controllers on multiple robots or multiple controller manager and see how it works��ros2 launch workshop_bringup tiago_chaining.launch.xml namespace:=tiago1

27 of 32

Task 4: Multi-robot scalability

  • Namespaced parameters are important when handling multiple controller controllers. Let’s load a different configuration file with namespaced parameters��ros2 launch workshop_bringup tiago_chaining.launch.xml namespace:=tiago1 config_file:=chaining_controllers_tiago1

28 of 32

Task 4: Multi-robot scalability

  • Defining separate YAML files that explicitly define namespaces and node names is not efficient. Wildcard characters (/**) is the solution for scalability��ros2 launch workshop_bringup tiago_chaining.launch.xml namespace:=tiago1 config_file:=chaining_controllers_generic

�ros2 launch workshop_bringup tiago_chaining.launch.xml namespace:=tiago2 config_file:=chaining_controllers_generic

29 of 32

Recap & Extras

  • You can separate controllers into chainable parts
  • Or build them from off-the-shelf chainable parts
  • It is ok to return ERROR in controller’s `update()` → fallback
  • Slower controllers / state estimators are fine to have → async ← shouldn’t be the norm though
  • Multi-robot, multi-controller-manager setups can be done with elegant namespacing and wildcard namespaces in configs

Tooling one can use for debugging

  • All the different CLI, all CLI really list verbose controllers too
  • controller_state topic + plotjuggler/foxglove
  • ros2 control list_controllers -v
  • Set logging level through services

Q&A

  • PAL Statistics
  • Data Tamer
  • Any other tooling? Ask away!

30 of 32

Thank you! And Discussion and Questions…

Bence Magyar, Denis Štogl, Christoph Froehlich, Sai Kishor Kothakota, Felix Exner, Manuel Muth, Alejandro Hernandez Cordero, Reza Kermani, Lennart Nachtigall, Takashi Sato, Henry Moore, Abrar Rahman Protyasha, Jakub Delicat, Wiktor Bajor, Silvio Traversaro, Noel Jimenez Garcia, Tony Baltovski, Vladimir Ivan, Mateus Menezes, Abishalini Sivaraman, Alex Moriarty, Marq Rasmussen, Paul Gesel, Olivier Stasse, Márk Szitanics,......... and many more!

31 of 32

32 of 32

Outline 2023 REMOVE IT EVENTUALLY

  • Introduction [15 minutes]
  • Task1 - chaining [15 pres. + 60 minutes]
  • Task2 - fallback [15 pres. + 30 minutes]
  • BREAK [ 15 minutes ] — 2++ hours mark
  • Task3 - async [15 pres. + 15 minutes]
  • Task4 - scaling [30 minutes]
  • Free For All [ 30 minutes ]