How ros-controls/ros_control works
Main Components
• Hardware Abstraction and Interfaces:
• hardware_interface: Contains the base classes and interfaces for actuators, sensors, and robot hardware. It defines key interfaces (such as joint_command_interface, joint_state_interface) used by controllers.
• joint_limits_interface: Provides constraints that help enforce joint limits and safety rules.
• transmission_interface: Manages the transmission mechanisms from abstract commands to the physical actuators (includes loaders for differential, four bar transmissions, etc.).
• combined_robot_hw: Wraps these low-level hardware interfaces into a unified hardware layer.
• Controller Management:
• controller_interface: Provides generic base classes for controllers.
• controller_manager: Handles lifecycle, loading, unloading, and switching between various controllers.
• controller_manager_msgs: Defines ROS messages and service types to enable communication with the Controller Manager.
• controller_manager_tests: Contains tests and example controllers that validate the Controller Manager functionalities.
• User Interface and Tools:
• rqt_controller_manager: Offers a graphical user interface (GUI) for interacting with controllers (starting, stopping, debugging, etc.).
• Supporting and Auxiliary Elements:
• ROS configuration files (package.xml, CMakeLists.txt, rosdoc.yaml) are spread throughout the packages indicating how these modules integrate into the larger ROS ecosystem.
• Test directories in multiple packages ensure that each functional block is properly validated through unit tests and integration tests.
Depicting the Relationships and Interactions
◦ Hardware Interfaces (hardware_interface, joint_limits_interface, transmission_interface, combined_robot_hw)
◦ Controller Management (controller_interface, controller_manager, controller_manager_msgs, controller_manager_tests)
◦ User Interface (rqt_controller_manager)
• Controller Manager communicates with the hardware interface layer. It loads controllers (from controller_interface) which, in turn, send commands to and read data from the hardware interfaces.
• ROS messages and services (from controller_manager_msgs) serve as the “communication glue” between the controller manager and external nodes.
• The rqt_controller_manager (GUI) interacts with the controller manager, invoking scripts and services (as seen in its scripts and source directories).
• That tests modules exist alongside these components and are used to verify interactions.
Highlighting Architectural Patterns and Design Principles
• Modular nature: Each package is responsible for a specific concern and follows ROS best practices.
• Clear component boundaries where abstraction layers hide the low-level hardware details (hardware_interface) from the high-level controller logic (controller_manager).
• Use of standardized message passing, service calls, and plugins (such as test controllers and controller loaders) for extensibility.
• Dependency inversion where abstract classes (in hardware_interface or controller_interface) allow for flexible implementation and testing.
Including Specific Technologies and Frameworks
• ROS: The framework is built entirely around the ROS ecosystem, relying on message passing, service definitions, and ROS package management.
• CMake: All packages use CMake for building, as indicated by the CMakeLists.txt in most directories.
• Python: Some components in controller_manager (e.g., __init__.py and controller_manager_interface.py) are developed in Python, which indicates mixed-language components.
• Testing Frameworks: C++ tests and Python-based tests are used to validate the functionality.
Specific Elements
• Controller Manager → Hardware Interface (commands, sensor feedback).
• rqt_Controller_Manager → Controller Manager (service calls, monitoring).
• Optionally, include auxiliary elements like configuration/build elements if needed (this may be a secondary layer showing integration with ROS build and deployment systems).
Happy diagramming!