The application layer in AMRs: a state machine for task dispatch
Atlasbot · 22/8/2026 · 11 min read
The previous four layers — Hardware, Driver, ROS2, Localization, Navigation — all take care of "how the robot moves properly and safely". Application Layer answers a different question: where should the robot go next, and what to do when it gets there. This is the highest floor in the 5-storey model learned in lesson AMR Architecture.
Key concepts
The Application Layer in a real AMR usually consists of 2 parts:
- Task state machine — tracks which step of a specific task the robot is in (going to pickup point, picking up, going to delivery point, delivering)
- Task queue — list of pending tasks, deciding on priority order when there are many requests at the same time
With a multi-robot system (fleet), the Application Layer also has an additional role of coordination — avoiding 2 robots competing for a narrow intersection, allocating tasks to the most suitable robot (closest to the pickup point, with the most battery left).
How it works
A typical delivery task goes through successive states:
Idle (waiting for missions)
→ receive new mission → Navigating (call Nav2's NavigateToPose action)
→ arrive at destination → Picking/Dropping (waiting for pick up/drop off operation, can wait for confirmation)
→ complete → return to Idle (or get the next quest in the queue)
Error branch: any state can change to Failed
(timeout does not reach destination, Nav2 reports unable to find route, sensor reports error)
Important point about the boundary: Application Layer only coordinates state and calls Nav2 — it does not calculate its own path, nor does it avoid obstacles on its own. It sends a goal (NavigateToPose) to the Navigation Layer and then tracks the returned results, following the principle "each layer only communicates with the adjacent layer" learned in the AMR Architecture lesson.
Technical details
Formulas
Estimate the time to complete a sequence of tasks — useful for scheduling and estimating SLA (time commitment) in real operations:
Total_time = Σ (Distance_i / Average_velocity + Operation_time_i)
For example: the mission includes 3 stops, distances of 15m, 8m, 12m respectively.
Average speed 0.6 m/s (including actual deceleration/acceleration time,
lower than nominal maximum speed), each stop takes 20 seconds of operation
Travel_time = (15+8+12)/0.6 = 58.3 seconds
Operation_time = 3 × 20 = 60 seconds
Total_time ≈ 118.3 seconds ≈ 2 minutes
Parameters
| Scale | Request coordination | Complexity |
|---|---|---|
| 1 robot, 1 queue | Sequential processing, no need for inter-robot coordination | Low |
| Many robots, common areas | Conflicts over intersections/narrow areas should be avoided | Medium-high (fleet management) |
Practical applications
In a warehouse that operates multiple AMRs at the same time, the Application Layer of the central system (fleet manager) often uses the zone reservation (zone reservation) strategy — before a robot passes through a narrow corridor or intersection, it "reserves" that area with the fleet manager; Other robots that receive the task of passing through the same area will have to wait or take another route. This is the coordination mechanism at the Application layer, completely separate from the individual robots avoiding dynamic obstacles at the Navigation layer — the two mechanisms work together but solve two different problems (planned conflict avoidance vs. immediate response to unexpected obstacles).
Practical example
from enum import Enum
class TaskState(Enum):
IDLE = "idle"
NAVIGATING = "navigating"
PICKING = "picking"
FAILED = "failed"
class TaskManager:
def __init__(self):
self.state = TaskState.IDLE
self.queue = []
def them_nhiem_vu(self, diem_den):
self.queue.append(diem_den)
def cap_nhat(self, nav2_ket_qua=None):
if self.state == TaskState.IDLE and self.queue:
self.diem_den_hien_tai = self.queue.pop(0)
self.state = TaskState.NAVIGATING
print(f"Bat dau di toi {self.diem_den_hien_tai}")
elif self.state == TaskState.NAVIGATING:
if nav2_ket_qua == "thanh_cong":
self.state = TaskState.PICKING
print("Da toi noi, bat dau lay/tra hang")
elif nav2_ket_qua == "that_bai":
self.state = TaskState.FAILED
print("Nav2 bao loi - chuyen sang trang thai Failed")
elif self.state == TaskState.PICKING:
self.state = TaskState.IDLE
print("Hoan tat nhiem vu, quay lai Idle")
tm = TaskManager()
tm.them_nhiem_vu("Ke A3")
tm.cap_nhat()
tm.cap_nhat(nav2_ket_qua="thanh_cong")
tm.cap_nhat()
Output:
Bat dau di toi Ke A3
Da toi noi, bat dau lay/tra hang
Hoan tat nhiem vu, quay lai Idle
This simple state machine is the nucleus of any more complex AMR coordination system — the fleet manager actually just extends more parallel instances (one for each robot) plus common coordination logic between them.
Common mistakes
- Inserting real-time logic into the Application Layer — violates the layering principle learned in the AMR Architecture lesson; The Application Layer runs at low frequencies (seconds, not milliseconds), which is not suitable for any logic that needs to react quickly.
- No explicit state/timeout handling — if Nav2 "hangs" never returning success or failure results, the robot could be permanently stuck in the Navigating state with no self-escape mechanism.
- Skip multi-robot coordination when expanding from 1 robot to multiple robots — logic that works well with 1 robot can cause congestion or collisions when running multiple robots at the same time in the same area without a reservation/coordination mechanism.
- Not clearly separating the Failed state from the Idle state — treating "failed task" as "waiting for a new task" makes it difficult for the monitoring system to detect that the robot is having problems that require intervention.
Conclusion
The Application Layer is where the "business intent" (delivery, cleaning, patrol) is converted into a specific sequence of commands sent to the Navigation Layer — which itself only coordinates the state, does not calculate paths or avoid obstacles. A simple state machine is a sufficient foundation for a single robot, but a multi-robot system requires additional coordination mechanisms such as area reservations. This is the last article of the AMR Software Architecture column — all 5 layers from Hardware to Application are now fully presented. The next Practical AMR Design section puts all this knowledge into a concrete design process, from component selection to load calculations.
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.