ROS 2 for Machine Learning Engineers
ROS 2 as the production boundary around a learned policy.
ROS 2 is the second generation of the Robot Operating System, a modular framework of freely available robot software, rebuilt because ROS 1 lacked production-grade featuresSource 7. Lyrical Luth, the current long-term-support release, shipped on 22 May 2026 and is supported until May 2031Source 1 Source 8.

Self-check
Read the reasoning
- Publish the request repeatedly on a topicTopics fit continuous streams. This task needs acceptance, feedback, completion and cancellation semantics.
- Block on a service call until it finishesServices are intended for short request-response operations. A long task needs feedback and preemption without holding a synchronous request open.
- Use a ROS action: goal, feedback, result and cancellationActions model long-running, preemptible work. The client can observe progress and cancel while the server owns execution.
Topics stream, services answer short requests, and actions manage long-running goals with feedback and cancellation.
The graph: nodes and typed interfaces
A node is one participant, such as a camera driver, policy server or controller bridge. Nodes talk through topics for continuous streams, services for short request-response calls, and actions for long-running goals with feedback, cancellation and a resultSource 2. A geometry_msgs/PoseStamped carries the timestamp and frame a bare array lacks, and REP 103 puts ROS on SI unitsSource 9.
Schematic; node names are examples
How this was made
Through an action, the task manager and the fetch skill exchange 4 messages: a goal, progress updates and a result, and it can be cancelled. A topic carries 4 pictures one way, a service 2 messages and an action 4.
The messages each way of talking sends
| way of talking | messages, in order | reply |
|---|---|---|
| Topic | picture; picture; picture; picture | none |
| Service | Is the gripper closed?; Yes | one answer |
| Action | Goal: fetch the cup; Progress: 30%; Progress: 60%; Done: cup fetched | progress, then a result |
QoS is part of the model input
ROS 2 inherits Quality of Service (QoS) from DDSSource 10. The default profile keeps the last 10 messages and delivers reliably, while the sensor-data profile uses best effort and a smaller queue, because timely readings matter more than complete ones; lifespan silently drops messages older than its limit, and endpoints with incompatible policies never connectSource 3.
End-to-end latency depends strongly on the DDS implementation, and ROS 2 can add 50% over raw DDSSource 11. Since Kilted Kaiju (May 2025), Zenoh's rmw_zenoh_cpp is a Tier 1 middlewareSource 12.
Illustrative camera rate
How this was made
With a camera queue that keeps the last 10 pictures and a camera sending 30 pictures a second, the model acts on a picture 0.33 seconds old; the age equals queue depth over the camera rate.
How old the picture the model uses is
| queue keeps | age of the picture used (seconds) |
|---|---|
| Last 10 | 0.33 |
| Newest only | 0.03 |
Time and synchronization
Camera, depth, joint and force streams arrive at different rates, so inputs need acquisition and arrival timestamps. MCAP records a publish time and a log time for every messageSource 13.
Logging source, receipt and inference-completion times splits latency into sensing, transport, model execution and command delivery; ros2_tracing does it at an average overhead of 0.0033 ms per messageSource 14. With use_sim_time set, ROS time follows the latest /clock messageSource 15, so nodes that mix it with wall time see spurious timeouts. The calibration guide covers spatial and temporal alignment.
tf2: the coordinate-frame graph
tf2 keeps a time-buffered tree of coordinate frames and transforms data between any two frames at any timeSource 16. A lookup at an image timestamp can wait for the transform; the tf2 tutorial raises an exception only if it is still missing after a 50 ms timeoutSource 17.
REP 105 defines odom as a drifting short-term reference and map as a frame whose poses can jumpSource 18, and camera optical frames take an _optical suffix and a different axis conventionSource 9. A policy trained on base-frame end-effector deltas cannot be sent tool-frame deltas in the same layout; Modern Robotics covers the geometrySource 6.
URDF, robot state and MoveIt
URDF, the most common robot-description formatSource 19, lists links, joints, geometry and limits, and robot_state_publisher combines it with joint states to publish the frame tree. MoveIt 2's Planning Scene combines robot state, model and world geometry for kinematics, constraint and collision checksSource 4, so a learned policy can use it to plan or check collision-free motion.
rosbag2 is the experiment record
rosbag2 records timestamped messages for replay, in MCAP by default since Iron IrwiniSource 20, and since Kilted it can replay in publication order instead of receipt orderSource 12. Learning pipelines convert bags to episode formats such as RLDSSource 21.
A production policy layout
A learned-policy graph can separate drivers, state assembly, a policy server, a command gate, a controller bridge and a supervisor. The supervisor can drive ROS 2 managed nodes, which leave a primary state only on an external request or an errorSource 22. Inference stays outside the hard real-time loop unless its worst case fits, and ROS 2's real-time guidance keeps page faults, dynamic allocation and blocking synchronization out of that pathSource 23. Lyrical's EventsCBGExecutor cuts executor CPU overhead, but its event queue is unboundedSource 24.
Schematic: one recommended layout, not a required one
How this was made
- The task manager (the supervisor) takes the task request. Task request to the supervisor, as an action: a long-running goal with feedback, cancellation and a result. Source: ROS 2 Project 2026.
- Camera pictures and joint positions; late readings may be skipped. Camera and joint drivers to state assembly, over topics. The sensor-data QoS profile uses best effort and a smaller queue, because timely readings matter more than complete ones. Source: ROS 2 Project 2026.
- The arm positions (the tf2 frame tree) give the arm position at the moment each photo was taken. tf2 frame tree to state assembly, as a tf2 lookup. tf2 keeps a time-buffered tree of coordinate frames. A lookup at the image's timestamp can wait for the transform; the tf2 tutorial raises an exception only if it is still unavailable after a 50 ms timeout. Source: ROS 2 Project 2026; ROS 2 Project 2026.
- The newest readings, checked to be recent. State assembly to the policy server, over a topic. A reliable camera subscription with a deep queue can make a policy act on old images, so log message age at this boundary. Source: this article.
- Suggested moves, all delivered. Policy server to the command gate, over a topic. The default QoS profile is reliable and keeps the last 10 messages. Source: ROS 2 Project 2026.
- Checked moves, the only path to the motors. Command gate to the controller bridge, over a topic. The gate is the only node that publishes commands; two command publishers without arbitration is a common integration failure. Source: this article.
- Motor commands at steady, exact intervals. Controller bridge to the robot hardware, in the real-time loop. ROS 2's real-time guidance keeps page faults, dynamic allocation and indefinitely blocking synchronization out of this path, so inference stays outside it unless its worst case fits. Source: ROS 2 Project 2026.
- The task manager starts and stops these three parts: the AI that suggests moves, the safety check and the part that drives the motors. Supervisor to the policy server, command gate and controller bridge, through lifecycle transitions. ROS 2 managed nodes leave a primary state only at an external supervisor's request or on an error in the Active state. Source: Biggs et al. 2015.
Six ROS 2 nodes run top to bottom from camera and joint drivers to the controller bridge; sensor topics use best effort, proposed actions travel reliably with the last 10 messages kept, a tf2 lookup waits up to 50 ms, and only the command gate publishes commands.
Graph data
- task to supervisor
- action: task goal with feedback and cancel
- drivers to state
- topic: camera images, joint states; sensor data: best effort, small queue
- tf2 to state
- tf2 lookup; frames at the image's timestamp
- state to policy
- topic: observation; log message age here
- policy to gate
- topic: proposed actions; reliable
- gate to bridge
- topic: commands; the only command publisher
- bridge to hardware
- real-time loop
- supervisor lifecycle
- lifecycle: start, stop, deactivate
Lyrical's rosidl::Buffer lets a uint8[] field live in GPU memory without changing the .msg fileSource 25. NVIDIA deprecated its NITROS transport on 21 September 2026 in its favor, with a CUDA backendSource 26, because host round-trips add latency and use CPU and memory bandwidthSource 27.
Navigation uses the same architecture
Nav2 uses a behavior tree to orchestrate planner, controller and recovery serversSource 5. Costmap 2D accepts sensor-processing plugins for AI outputs and semantic informationSource 28, so a learned local controller can reuse a classical one's costmap, goal interface, test harness and fallback. The scene-representation module explains the map choices.

Common integration failures
Frequent failures include a policy deployed in a different frame from its training data, a queue that hides latency, two unarbitrated command publishers, bags without transforms, wall-time assumptions under /clock, and one node holding drivers, inference and hardware commands. DDS implementations interoperate only in limited circumstances, so a system should use one ROS version and one RMW implementationSource 29. Nodes are not guaranteed to communicate across distributions; Jazzy is supported until May 2029 and Humble until May 2027Source 8. ROS 1 ended when Noetic reached end of life in May 2025Source 30.
See also
- Real-Time Execution
The latency budgets that decide whether the control loop closes.
- Safety and Assurance
What ships is a verifiable safety layer around the learned policy.
- Industrial Deployment
The jam-rate arithmetic that decides whether a 99 percent cell ships.
Linked from
- Robot Learning Curriculum for ML Engineers
A dependency-ordered route from supervised learning to real robot policies.
- The Robot Learning Stack
From data capture to robot integration as one reproducible system.
- Motion Planning
Configuration space, RRT and its variants, and trajectory optimization.
- State Estimation
Kalman filters, factor graphs, and pose estimation from noisy sensors.
- Perception for Manipulation
How camera images become an object's position and orientation.
- Scene Representation and Mapping
From point clouds to Gaussian splats: what a robot remembers about space.
References
ROS 2 Project, ROS 2 Documentation, as of 2026-08-24.
https://docs.ros.org/en/lyrical/Releases/Release-Lyrical-Luth.html
ROS 2 Project, ROS 2 Documentation, as of 2026-08-24.
https://docs.ros.org/en/lyrical/ROS-Framework/Interfaces-Topics-Services-Actions.html
ROS 2 Project, ROS 2 Documentation, as of 2026-08-24.
https://docs.ros.org/en/lyrical/ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings.html
MoveIt Maintainers, MoveIt 2 Documentation, as of 2026-08-24.
https://moveit.picknik.ai/main/api/html/planning_scene_overview.html
Kevin M. Lynch, Frank C. Park, Cambridge University Press, 2017.
https://hades.mech.northwestern.edu/index.php/Modern_Robotics
Steven Macenski, Tully Foote, Brian Gerkey, Chris Lalancette, William Woodall, Science Robotics 7(66), 2022.
https://doi.org/10.1126/scirobotics.abm6074
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/Releases.html
Tully Foote, Mike Purvis, ROS Enhancement Proposals, 2010.
https://www.ros.org/reps/rep-0103.html
Tobias Kronauer, Joshwa Pohlmann, Maximilian Matthe, Till Smejkal, Gerhard Fettweis, 2021.
https://arxiv.org/abs/2101.02074
ROS 2 Project, ROS 2 Documentation, 2025.
https://docs.ros.org/en/lyrical/Releases/Release-Kilted-Kaiju.html
Christophe Bédard, Ingo Lütkebohle, Michel Dagenais, IEEE Robotics and Automation Letters, 2022.
https://arxiv.org/abs/2201.00393
Tully Foote, ROS 2 Design, n.d.; accessed 2026-10-04.
https://design.ros2.org/articles/clock_and_time.html
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/ROS-Framework/interfaces/About-Tf2/About-Tf2.html
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/ROS-Framework/client-libraries/Working-with-Client-Libraries/Tf2/Learning-About-Tf2-And-Time-Cpp.html
Wim Meeussen, ROS Enhancement Proposals, 2010.
https://www.ros.org/reps/rep-0105.html
Daniella Tola, Peter Corke, 2023.
https://arxiv.org/abs/2308.00514
ROS 2 Project, ROS 2 Documentation: Iron, 2023.
https://docs.ros.org/en/iron/Releases/Release-Iron-Irwini.html
Sabela Ramos, Sertan Girgin, Léonard Hussenot, Damien Vincent, Hanna Yakubovich, Daniel Toyama, and 6 more, 2021.
https://arxiv.org/abs/2111.02767
Geoffrey Biggs, Tully Foote, ROS 2 Design, 2015.
https://design.ros2.org/articles/node_lifecycle.html
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/Capabilities/Motion-planning/Real-Time-Programming.html
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/ROS-Framework/client-libraries/About-Executors/About-Executors.html
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/ROS-Framework/interfaces/Working-with-interfaces/Buffer-Backends/About-Buffer-Backends.html
NVIDIA, GitHub, as of 2026-10-04.
https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nitros
NVIDIA, Isaac ROS Documentation, as of 2026-10-04.
https://nvidia-isaac-ros.github.io/concepts/rosidl_buffer/index.html
ROS 2 Project, ROS 2 Documentation, as of 2026-10-04.
https://docs.ros.org/en/lyrical/ROS-Framework/client-libraries/About-Different-Middleware-Vendors.html
Florencia Cabral Berenfus, Ubuntu blog (Canonical), 2025.
https://ubuntu.com/blog/ros-noetic-is-eol-take-action-to-maintain-fleet-security
Further reading
Christopher E. Mower, Yuhui Wan, Hongzhan Yu, Antoine Grosnit, Jonas Gonzalez-Billandon, Matthieu Zimmer, and 17 more, 2024.
https://arxiv.org/abs/2406.19741
Steve Macenski, Matthew Booker, Joshua Wallace, Tobias Fischer, 2024.
https://arxiv.org/abs/2401.13078
Spot a factual error or missing qualification? Report a content correction.