Robot software overview: from firmware to ROS2, SLAM and Nav2
Atlasbot · 12/7/2026 · 11 min read
Article AMR Architecture in the AMR/AGV Overview section introduced a 5-layer model: Hardware, Driver, ROS2, Navigation+Localization, Application. This article opens the section AMR Software Architecture — where each of those layers is separated into a separate article, going much deeper than the initial overview.
Key concepts
A complete AMR must simultaneously solve two types of problems of opposing nature:
- Real time, simple — rotate motor at correct speed, read encoder without missing pulses — need low, deterministic latency
- Complicated, does not need absolute real time — understand the map, calculate optimal route, avoid dynamic obstacles — need large computing power, accept latency of a few tens–hundreds of milliseconds
No hardware platform is good at both at the same time — this is precisely why it is imperative to divide into separate layers, each running on appropriate hardware and communicating with the adjacent layer only through an explicit interface.
How it works
Data flows in opposite directions across the entire stack — not a one-way pipe: sensor data flows from the bottom up (hardware → firmware → ROS2 → SLAM/Nav2), while control commands flow from the top (Nav2 → ROS2 → communication → firmware → motor driver). The Sense-Think-Act loop across the entire system is a loop of data going up and then control commands going down continuously through all these layers - exactly the cumulative delay formula calculated in the AMR Architecture article.
The next articles in this category delve into each layer in the correct order from bottom to top: Hardware Layer, Driver Layer (available separately), ROS2 Layer, Localization, Navigation, and Application.
Technical details
Formulas
The latency budget allows each layer how much processing time to accumulate depending on the overall response frequency requirement — directly extended from the total latency formula learned in the AMR Architecture lesson:
If the system needs to react in a maximum of 100ms (safety requirement),
and known Δt_Hardware ≈ 20ms (physical motor response, not much variable)
Remaining budget for software = 100 − 20 = 80ms,
divided into the remaining 4 software layers (Driver, ROS2, Navigation, Application)
→ each layer should not exceed ~20ms of processing on average
This is reverse thinking — instead of designing each layer independently and then adding up the total, determine in advance the total latency budget that needs to be achieved, then allocate it backwards for each layer.
Parameters
| Floor | Prioritize design | Common problems if violated |
|---|---|---|
| Hardware/Driver (MCU) | Low, deterministic latency | Safety ring reacts slowly |
| ROS2/Navigation (MPU) | Computational power, accuracy | Waste of resources if run incorrectly on MCU |
| Application | User experience, business logic | Does not affect safety if properly separated |
Practical applications
A common mistake newbies make is to jump straight into learning ROS2/SLAM and skip the layers below. Actual consequences: when the robot runs incorrectly, we don't know if the error is in the SLAM algorithm or in the misaligned encoder causing the odometry data to be wrong from the beginning (exactly the problem learned in the Odometry lesson for AMR) - debugging takes much more time because we don't know which layer to check first. Understanding each layer in the correct order — hardware, driver, then ROS2/Navigation — helps debug the right layer from the beginning, instead of guessing from the highest layer down.
Practical example
Symptom: Nav2 robot reports "path planning successful" but robot
clearly deviate from the calculated trajectory
Debug in the correct order from the bottom up (don't guess from Nav2 down):
1. Check Hardware: is the wheel worn unevenly, is the effective diameter correct?
2. Check the Driver: is the encoder read correctly, is the constant_distance_per_tick correct?
3. Check ROS2: /odom publish at the correct frequency and frame?
4. Check Navigation: Does the AMCL converge to the correct physical location?
→ In most real cases, the cause lies in steps 1-2 (hardware error/
cumulative driver), not in the Nav2 algorithm — but newbies often
suspect Nav2 first because that's where the deviant behavior is most clearly "seen".
Common mistakes
- Start learning/debugging from the top layer (Application, Navigation) instead of from the bottom up — like the example above, most errors actually originate from hardware/drivers, even though the symptoms are most obvious at the high layer.
- Not allocating a clear delay budget to each floor when designing — design each floor independently and then detect the total delay exceeding the safety requirement, instead of calculating backwards from the total budget as in the Formula section.
- Putting heavy computational processing on the MCU for "convenience" — violates the principle of layering according to appropriate hardware, causing the real-time control loop to be slowed down by non-real-time tasks.
- Ignore learning/testing each sub-layer below before going to ROS2/SLAM — leading to misunderstanding the cause of the error, wasting time correcting the wrong place when the problem actually lies in another layer.
Conclusion
Layering is not an arbitrary design choice — it is a required solution for a system that must be both real-time responsive and have enough computing power for complex algorithms. Learning and debugging in the correct order from the bottom up, along with clearly allocating latency budgets to each layer, is an engineering discipline that avoids the majority of wasted debugging time. The next article in this category delves into the Hardware Layer — the lowest layer, where all data begins.
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.