The ROS2 layer in AMRs: the topic graph of a complete robot
Atlasbot · 22/8/2026 · 11 min read
The ROS2 & software section has its own series of articles explaining what nodes, topics, and services are. This article does not repeat those fundamental concepts — it stands in its rightful place in the 5-layer model: ROS2 Layer is the communication infrastructure connecting the Driver Layer (learned in the previous lesson) with Localization and Navigation (next 2 articles).
Key concepts
A complete AMR usually has at least 3-4 main nodes communicating via topic:
- driver_node — publish
/odom(from encoder) and/imu(from IMU), subscribe to/cmd_velto send commands to firmware - lidar_node — published
/scan(LaserScan data) - robot_localization (EKF package, mentioned in IMU post in AMR) — subscribe
/odomand/imu, publish/odometry/filtered - nav2 stack — subscribe
/scanand/odometry/filtered, publish/cmd_vel
No node knows directly about another node — they only know the topic name and the type of message to publish/subscribe to. This is the core strength of the middleware architecture: lidar_node can be replaced with another LiDAR driver without needing to modify any other nodes, as long as the correct topic /scan is published with the correct message type.
How it works
DDS (the communication platform underlying ROS2) automatically matches publishers to subscribers by topic name — no need to manually configure connections between nodes. But "auto-matching" doesn't mean "all data is treated the same" — each type of data in AMR has different requirements for reliability and latency:
/cmd_vel (control command): needs to come at the right time, losing 1 message is not too serious
because the next message will arrive very soon after that
/scan, /odom (high frequency sensor data): prioritize NEWEST data over
Make sure to receive all old messages
/map (map, occasional publish): need to ensure new node joins
still receive the current map, even though it was published a long time ago
This is exactly the problem that QoS (Quality of Service) in ROS2 solves — presented in detail in article QoS in the ROS2 & software section.
Technical details
Formulas
Estimated topic bandwidth — important when many nodes are running on the same network/computer to avoid congestion:
Bandwidth_topic ≈ Size_message × Frequency_publish
For example: /scan (LiDAR 360°, 360 points, each point ~4 byte float) at 10Hz
message_size ≈ 360 × 4 = 1440 bytes
Bandwidth ≈ 1440 × 10 = 14400 bytes/s ≈ 14KB/s (very small compared to normal network bandwidth)
For example: /camera/image_raw (640×480, RGB) at 30Hz
message_size ≈ 640×480×3 = 921600 bytes ≈ 900KB
Bandwidth ≈ 900KB × 30 ≈ 27MB/s (significant, need to consider compression or reducing frequency/resolution)
Parameters
| Topic | Data type | Adequate QoS |
|---|---|---|
/cmd_vel | Control command, high frequency | Reliable, prioritize the newest messages |
/scan, /odom | High frequency sensor | Best-effort, accept losing a few messages |
/map | Publish sparsely, need new node to still receive | Transient local (retain last message) |
Practical applications
The above topic structure allows the next Localization and Navigation categories to completely ignore whether /odom comes from Differential Drive or Mecanum Drive, regardless of which LiDAR brand /scan comes from - they just subscribe to the right topic, with the right standard message type. This is why package robot_localization and the entire Nav2 stack can be reused almost intact between AMR projects with completely different hardware, as long as the Driver Layer publishes the expected ROS2 messages.
Practical example
# List all topics running on an actual AMR
ros2 topic list
# Typical output:
# /cmd_vel
# /odom
# /imu
# /scan
# /odometry/filtered
# /map
# /tf
# Check the actual publish frequency of /odom (should match the design, eg 50Hz)
ros2 topic hz /odom
# Check the current QoS of /scan
ros2 topic info /scan --verbose
Checking ros2 topic hz is the first debugging step when suspecting slow or missing data — if the actual frequency is much lower than the design (eg: 50Hz designed but measured only 15Hz), the problem is in the Driver Layer or Hardware Layer below, not in ROS2 itself.
Common mistakes
- Using default QoS for every topic without considering data characteristics — like the Parameter table, high frequency sensor data using Reliable QoS unnecessarily can cause accumulated latency when network/CPU load is high.
- The topic name does not match exactly (including the namespace) — publisher and subscriber think they are talking to each other but actually cannot connect because the topic name is off by even one character, and ROS2 does not report a clear error for this situation.
- Not checking the actual publishing frequency before suspecting the algorithm — like the example above,
ros2 topic hzshould be the first debugging step, avoiding wasting time suspecting the wrong layer. - Publish unnecessarily high resolution image/point cloud data — as calculated in the Formula section, image data takes up much more bandwidth than simple digital data, consider reducing the frequency/resolution if it is not absolutely necessary for the running algorithm.
Conclusion
The ROS2 Layer does not generate data or make decisions on its own — it is an intermediary infrastructure that allows the Driver Layer, Localization, and Navigation to "talk" to each other across topics without knowing each other's implementation details. Understanding the correct topic map and choosing the right QoS for the characteristics of each data type are much more important debugging skills than memorizing ROS2 syntax. The next article in the category goes into the Localization Layer — where the /odom, /imu, /scan data just mentioned is merged into a reliable location estimate.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.