01

One library, almost every robot

In a career as a robotics software developer, almost every robot will use the ros2_control library in some way. It solves a fundamental problem in robotics, and it does so in a modular and flexible manner.

The library stays the same, the robot changes

Interactive
Joints2
Sensor types0
Control logics1
Number of joints
Types of sensors
Control logics

This is possible thanks to the configurability and flexibility of the library. It can be configured in many different ways to meet the requirements and the needs of each robot, no matter how different and unique it is. Every one of those ways of configuring it comes down to parameters.

02

Many parameters, and a better way to set them

In the previous section the parameters of a ROS 2 node were set one value at a time: through the command line interface, and through the launch files. With many configurable parameters, a simpler and more user friendly way is needed to set all of them, and to get an overview of the value chosen for each one. That is where YAML configuration files come in handy.

One at a time, or one file

Interactive

One at a timecommand line interface or launch files

commands used0

One YAML fileall parameters, one command

commands used0
Parameters on the node 6
The file, as the overview of every value
comprehensibleAll the configuration parameters of a node or application, in a format that can be read at a glance.
simple and quickDefined in one place, in a simple and quick format.
one goAll the parameters are set with a single command.
available at runtimeOnce set, the parameters are available to the node while it runs.

The parameter names here are placeholders, only to count commands.

03

What the YAML format can hold

With the YAML format, variables, objects, vectors and so on can be represented in a human readable way. This makes the value of each parameter easy to modify, and gives a quick and complete overview of the configuration parameters in use.

Variable, object, vector

Interactivesyntax detail is extra
How the file is read
04

The anatomy of the file

A configuration file for a node starts with the name of the node itself. Then the ros__parameters tag indicates that this node is going to be configured: the parameters it offers are about to be set. Then come the actual node parameters, each one made of a name as declared by the node, and the value to assign to it.

Build the file

Interactive
Nested, as the file is structured
Node name
Parameters: name and value
Highlight a part of the file

    Edit the file by hand

    Interactivethe checker is a demo
    What the checker finds
      Preview, coloured by role

      Parameter names and values here are placeholders. The structure is the real one.

      05

      Loading it: one command, available at runtime

      With a YAML file, all the parameters are set in one go with a single command, so that they are available to the node at runtime. This uses the file built in section 04: change it there or here.

      From the file to the running node

      Interactive
      The file
      The node
      controller_managerno parameters set
      commands used: 0
      Change a value in the file

      The stale value shown after an edit is a demo detail: the node holds what was loaded until the file is loaded again.

      06

      Label the file

      07

      Quiz