Inferensys

Glossary

ROS 2 Control (ros2_control)

ROS 2 Control is a framework for managing and abstracting robot hardware interfaces (e.g., joints, sensors) and controllers (e.g., position, velocity) to provide a unified real-time control layer.
Governance lead reviewing model governance framework on laptop, policy documents visible, executive office setup.
EMBODIED INTELLIGENCE SYSTEMS

What is ROS 2 Control (ros2_control)?

ROS 2 Control is the standardized framework within the Robot Operating System 2 (ROS 2) for managing and abstracting robot hardware interfaces and controllers, providing a unified real-time control layer.

ROS 2 Control (ros2_control) is a middleware framework that provides a deterministic, real-time abstraction layer between a robot's software controllers and its physical hardware. It defines a standard architecture with three core components: hardware interfaces for direct communication with motors and sensors, controllers (e.g., for position or velocity) that implement control algorithms, and a controller manager that dynamically loads and switches between controllers. This separation allows robotics software engineers to write hardware-agnostic control logic and system integrators to support diverse actuators and sensors through a consistent API.

The framework is essential for embodied intelligence systems as it enables reliable, low-latency execution of control loops critical for physical actuation. By managing resource contention and enforcing real-time constraints, ros2_control ensures that commands from high-level planners or Reinforcement Learning agents are executed predictably on the hardware. It integrates seamlessly with the broader ROS 2 ecosystem, using ROS 2 Topics and Services for configuration, while its hardware abstraction simplifies Sim-to-Real Transfer and system integration across different robotic platforms.

ARCHITECTURAL PRIMITIVES

Core Components of ROS 2 Control

ROS 2 Control is a framework for managing and abstracting robot hardware interfaces (e.g., joints, sensors) and controllers (e.g., position, velocity) to provide a unified real-time control layer. Its architecture is built from several key, interoperable components.

04

Resource Manager

The Resource Manager is the central authority that owns and arbitrates access to all Hardware Components and their State & Command Interfaces. It enforces strict rules to prevent multiple controllers from writing to the same command interface.

  • Core Responsibility: Maintains a global map of all available control interfaces (e.g., /joint1/position, /wheel_left/velocity).
  • Lifecycle: Initializes all hardware components, prepares them for communication, and handles their cleanup.
  • Interaction: The Controller Manager requests interface access from the Resource Manager when activating a controller.
05

Control Interface

A Control Interface is a named, typed channel for data exchange between a Controller and a Hardware Interface. They are the fundamental "wires" over which control signals flow.

  • Command Interface: A write-only channel from a controller to hardware (e.g., to set a joint's target position).
  • State Interface: A read-only channel from hardware to the system (e.g., to read a joint's actual position or motor current).
  • Standard Types: position, velocity, acceleration, effort (force/torque).
  • Naming Convention: Follows the pattern /<component_name>/<interface_type> (e.g., /arm_joint_3/position).
06

Hardware Component

A Hardware Component is a concrete implementation of a Hardware Interface that represents a specific piece of physical hardware. It is the leaf node in the abstraction tree, containing the actual driver logic.

  • Examples:
    • A GenericSystem component for simulating simple joints.
    • A MockSensor component for testing.
    • A custom EtherCATDrive component for a specific motor controller.
  • Declaration: Defined in a robot's URDF file using <ros2_control> tags, specifying its type, parameters, and the control interfaces it provides.
  • Lifecycle: Configured and activated by the Resource Manager on startup.
MECHANISM

How ROS 2 Control Works: The Control Loop

The ROS 2 Control framework executes a deterministic, real-time loop that abstracts hardware to provide a unified interface for high-level controllers.

The ROS 2 Control loop is a real-time software pipeline that periodically reads sensor data from hardware interfaces, updates the state of active controllers, and writes computed commands back to actuators. This cycle, managed by the controller manager, runs at a fixed frequency defined by the control period, ensuring deterministic timing for stable robotic operation. The loop's primary function is to decouple the hardware-specific I/O from the algorithmic control logic.

Within each cycle, the resource manager provides synchronized access to joint states and handles. Controllers, such as a joint trajectory controller, compute desired forces or positions based on their internal logic and the current state. These commands are passed through the hardware abstraction layer to the actual motors or sensors. This architecture allows swapping controllers or simulating hardware without altering the core control pipeline.

ROS 2 CONTROL FRAMEWORK

Primary Use Cases and Applications

ROS 2 Control provides the critical software abstraction layer between high-level robot commands and low-level hardware drivers. Its primary applications center on standardizing and simplifying the development of real-time control systems for diverse robotic platforms.

01

Unified Hardware Abstraction

ROS 2 Control's core function is to provide a hardware abstraction layer (HAL). It defines a standard interface (hardware_interface) for communicating with diverse physical hardware—motors, sensors, grippers—through a common API. This decouples high-level controllers from the specifics of motor drivers or communication buses (e.g., CAN, EtherCAT).

  • System Components: A RobotHW class (or System/Sensor/Actuator in ros2_control) manages the low-level read/write cycle.
  • Real-World Example: A robot arm with Dynamixel servos and a force-torque sensor uses a single System to read joint positions and the sensor state, then write new position commands, all through the standardized interface.
02

Controller Management & Lifecycle

The framework manages the lifecycle and execution of various controllers—software modules that compute commands (e.g., torque, velocity) for the hardware. The controller_manager is the central orchestrator.

  • Controller Types: It can load, start, stop, and switch between controllers like joint_trajectory_controller for following planned paths, diff_drive_controller for mobile bases, or force_controllers for compliant manipulation.

  • Dynamic Reconfiguration: Controllers can be hot-swapped at runtime. For example, switching from a position controller for precise movement to an impedance controller for safe human interaction.

  • Real-Time Execution: The manager ensures controllers are updated at a deterministic, high-frequency rate (e.g., 1 kHz) critical for stable control.

03

Simulation Integration (Gazebo/Ignition)

ROS 2 Control is essential for hardware-in-the-loop (HIL) and pure simulation workflows. The ros2_control Gazebo plugin creates a simulated hardware interface, allowing the same controllers and control stack to run identically in simulation and on real hardware.

  • Sim-to-Real Consistency: Developers can design and test complex controller behaviors in a safe, simulated environment using Gazebo or Ignition before deploying to physical robots.

  • Workflow: The plugin bridges the simulation physics engine (providing simulated joint states) and the ROS 2 Control framework, which runs the actual controller_manager and controllers. This validates the entire software pipeline.

04

Real-Time Control System Architecture

It enables the design of deterministic, real-time control systems. By separating the non-real-time ROS 2 communication layer from the real-time control loop, it ensures low-latency, jitter-free execution.

  • Dual-Loop Architecture: High-level planning nodes (non-real-time) send goals via actions/topics. The controller_manager and its loaded controllers (often in a real-time thread or process) execute the tight control loop.

  • Use Case: A mobile manipulator uses this architecture. A non-real-time navigation planner sends a base trajectory, while a real-time controller manages wheel velocities and arm joint torques simultaneously, ensuring stable and responsive physical behavior.

05

Standardized Robot Description & Transmission

ROS 2 Control extends the URDF robot model with control-specific tags (<ros2_control>) to declaratively define hardware interfaces and transmissions.

  • Transmission Modeling: It mathematically maps actuator space (e.g., motor rotation) to joint space (e.g., linear motion of a prismatic joint) using gear ratios and mechanical linkages. A <transmission> tag in the URDF defines this relationship.

  • Declarative Configuration: This allows the system to auto-configure itself from the robot description, reducing boilerplate code. For instance, defining a four-bar linkage or a differential drive transmission here automatically handles the command conversions for the controllers.

06

Multi-Robot & Modular System Support

The framework supports complex, modular robotic systems, from single arms to heterogeneous fleets.

  • Component-Based Design: Each logical hardware component (e.g., a mobile base, a manipulator arm, a sensor pan-tilt unit) can be modeled as its own System within ros2_control, managed by a single or distributed controller_manager.

  • Fleet Orchestration: In a warehouse, multiple Autonomous Mobile Robots (AMRs) each run their own ROS 2 Control stack. A fleet management system sends high-level goals, while each robot's local control stack handles precise motor control and safety. This separation of concerns is enabled by the abstraction ros2_control provides.

CONTROLLER COMPARISON

Common Controller Types in ros2_control

A feature and use-case comparison of standard controller implementations provided by the ros2_control framework for managing robot hardware interfaces.

Controller TypePrimary Use CaseControl ModeReal-Time SafeDefault Implementation

Joint State Controller

Broadcast joint states (position, velocity, effort) for other nodes.

Read-only (State Feedback)

joint_state_controller/JointStateController

Joint Trajectory Controller

Execute pre-planned trajectories (position, velocity, acceleration).

Forward Command (Position/Velocity)

joint_trajectory_controller/JointTrajectoryController

Forward Command Controller

Direct, low-level command forwarding (e.g., velocity, effort).

Forward Command (Velocity/Effort)

forward_command_controller/ForwardCommandController

Position Controllers

Closed-loop control to achieve a target joint position.

Feedback Control (Position)

position_controllers/JointGroupPositionController

Velocity Controllers

Closed-loop control to achieve a target joint velocity.

Feedback Control (Velocity)

velocity_controllers/JointGroupVelocityController

Effort Controllers

Closed-loop control to achieve a target joint torque/effort.

Feedback Control (Effort)

effort_controllers/JointGroupEffortController

Diff Drive Controller

Convert twist commands to wheel velocities for differential drive robots.

Forward Command (Velocity)

diff_drive_controller/DiffDriveController

IMU Sensor Controller

Broadcast data from an Inertial Measurement Unit (IMU).

Read-only (State Feedback)

imu_sensor_broadcaster/IMUSensorBroadcaster

ROS 2 CONTROL (ROS2_CONTROL)

Frequently Asked Questions

Essential questions and answers about the ROS 2 Control framework, which provides the critical real-time layer for abstracting robot hardware and managing controllers.

ROS 2 Control is a framework that provides a standardized, real-time capable interface for managing robot hardware resources (joints, sensors) and the software controllers that command them. It works by introducing a clear separation of concerns: a Hardware Abstraction Layer (HAL) provides a uniform API to read from and write to physical hardware (motors, encoders), while a Controller Manager dynamically loads and executes control algorithms (like PID for position control) that compute commands based on sensor feedback and desired setpoints. This architecture allows high-level planning nodes to send trajectory goals without needing direct, non-real-time access to hardware drivers.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.