
AI & Components
From hardware state to commands: the ros2_control Controller Manager
Plugin selection, parameter files and the robot description define the setup; interface availability also determines whether fallback controllers can activate.
The ros2_control Controller Manager connects configured controllers to hardware interfaces through a loop that reads hardware state, updates controllers and writes commands to hardware. The integer parameter update_rate sets the frequency of this documented real-time update loop.
Controller configuration identifies both the software to instantiate and its parameters. <controller_name>.type names a controller plugin exported through pluginlib: the plugin supplies the class used to create the instance named controller_name. <controller_name>.params_file supplies the absolute path to that controller’s YAML parameter file, which should use the standard ROS 2 YAML format. Together, these settings specify the controller implementation and its configuration.
The robot description supplies another part of the setup. Controller Manager subscribes to robot_description, a std_msgs::msg::String containing the robot’s URDF XML description, for example from robot_state_publisher. Every joint defined inside the <ros2_control> tag must also be present in the URDF. The documentation states that reloading the URDF is not supported, so the description cannot be treated as a reloadable configuration input.
Beyond running the loop, Controller Manager manages controller lifecycles and access to hardware interfaces, and provides ROS services as a user entry point. Its ~/activity topic reports changes in the state of managed controllers or hardware components. Each message contains the managed controllers and hardware components together with their lifecycle states. These describe component lifecycle status, separately from the hardware-state readings in the control loop. The documentation specifies “transient local” quality of service for this publisher and says subscribers should use it too.
Fallback behavior has an explicit trigger and configuration. <controller_name>.fallback_controllers lists controllers to activate when spawned controllers return return_type::ERROR during the update cycle. The documentation recommends including every controller needed by the fallback strategy, including chainable controllers whose interfaces the main fallback controllers use.
Fallback activation depends on the state and command interfaces available at the time of activation. A configured fallback list therefore does not guarantee recovery or physical safety. The documentation recommends testing the fallback strategy in simulation before deploying it on the real robot.