How ros-controls/ros2_control works
ros2_control is a ROS 2 framework for connecting controllers to robot hardware. Its principal runtime workflow loads hardware descriptions and exposes hardware interfaces; the controller manager then reads hardware, updates controllers, and writes commands, while managing controller and hardware lifecycle services. Controllers claim interfaces through the controller API, and joint-limit enforcement and chained controllers extend control behavior. The CLI and rqt plugin provide operator-facing management. Relationships are based on the supplied excerpts, source index references, and documented control-loop behavior; unsampled subsystem links are omitted where not established.
Main entry points: resource_manager.cpp Resource manager · controller_manager.cpp Controller manager · controller_interface_base.hpp Controller API · hardware_component_interface.hpp Hardware components
Components 18
Runtime management
- Control node
controller_manager/src/ros2_control_node.cpp - Controller manager
controller_manager/src/controller_manager.cpp - Manager services
controller_manager/controller_manager/controller_manager_services.py - Spawner tools
controller_manager/controller_manager/spawner.py
Hardware interfaces
- Description parser
hardware_interface/src/component_parser.cpp - Resource manager
hardware_interface/src/resource_manager.cpp - Hardware components
hardware_interface/include/hardware_interface/hardware_component_interface.hpp - State and command handles
hardware_interface/include/hardware_interface/handle.hpp - Semantic components
controller_interface/include/semantic_components - Transmission models
transmission_interface/include/transmission_interface/transmission.hpp
Controllers and limits
- Controller API
controller_interface/include/controller_interface/controller_interface_base.hpp - Chainable controllers
controller_interface/include/controller_interface/chainable_controller_interface.hpp - Joint limiters
joint_limits/src/joint_saturation_limiter.cpp
Operator tools
- Control CLI
ros2controlcli/ros2controlcli/verb - Manager GUI
rqt_controller_manager/rqt_controller_manager/controller_manager.py
Other components
- Operator
- Robot description
- Hardware plugins
Connections 22
- Operator → Control CLI: runs commands
ros2controlcli/ros2controlcli/verb/list_controllers.py - Operator → Manager GUI: manages runtime
rqt_controller_manager/rqt_controller_manager/controller_manager.py - Control node → Controller manager: starts
- Robot description → Resource manager: describes hardware
- Controller manager → Resource manager: reads and writes
controller_manager/src/controller_manager.cpp - Controller manager → Controller API: updates controllers
controller_manager/src/controller_manager.cpp - Controller manager → Manager services: serves management
- Control CLI → Manager services: calls services
- Manager GUI → Manager services: calls services
rqt_controller_manager/rqt_controller_manager/controller_manager.py - Spawner tools → Manager services: manages controllers
- Resource manager → Description parser: parses descriptions
hardware_interface/src/resource_manager.cpp - Description parser → Hardware components: configures components
hardware_interface/src/component_parser.cpp - Resource manager → Hardware components: initializes and accesses
hardware_interface/src/resource_manager.cpp - Hardware components → State and command handles: exports interfaces
- Resource manager → State and command handles: claims interfaces
- Controller API → State and command handles: uses claimed interfaces
controller_interface/include/controller_interface/controller_interface_base.hpp - Controller API → Joint limiters: configures limits
controller_interface/include/controller_interface/controller_interface_base.hpp - Resource manager → Joint limiters: enforces limits
hardware_interface/src/resource_manager.cpp - Chainable controllers → Controller API: extends
controller_interface/include/controller_interface/chainable_controller_interface.hpp - Semantic components → State and command handles: wraps interfaces
- Hardware plugins → Resource manager: loaded as components
- Transmission models → Hardware components: maps actuator motion