Orchestration And Coordination
orchestration_and_coordination.py
Order queue + state gateway for a fleet of sushi-waiter robots
This node owns a persistent FIFO of customer orders (YAML on disk) and serves as the single gateway where each robot asks:
> “Given my current controller state, what do I do next?”
It exposes two services per robot namespace:
/{robot}/robot_state_decision
– FSM step (state → action)./{robot}/robot_state_decision_add
– append a freshly verified order.
Interfaces (strongly-typed, stateful)
Kind |
Name |
ROS type |
Notes |
---|---|---|---|
Service |
|
|
Request → |
Service |
|
|
Push order ( |
Orchestration System Integration KPIs
Metric |
Target |
---|---|
Task assignment latency (call to /robot_state_decision → response) |
≤ 100 ms |
Throughput (orders assigned per second) |
≥ 20 orders/s |
Conflict rate (duplicate table assignments) |
< 1 % |
Persistent storage
tiago_data.yaml (beside this script) keeps the queue:
orders:
- id_client: 7
food_list: [sushi, pasta]
- id_client: 9
food_list: [ramen]
File is re-loaded and re-saved on every service call → multiple nodes or manual edits always stay in sync.
Decision rules
Queue empty →
state_output="Wait"
,success=False
Queue non-empty and robot in Free or Wait → pop order, return it with
state_output="Busy"
,success=True
Otherwise echo incoming state with
success=False
- class orchestration_and_coordination.BusyState[source]
Bases:
State
Robot reports it has finished → flip back to Free.
- class orchestration_and_coordination.FreeState[source]
Bases:
State
Idle → try to grab the next order, else go to Wait.
- class orchestration_and_coordination.State[source]
Bases:
object
Abstract FSM state; subclasses must implement
handle()
.
- class orchestration_and_coordination.WaitState[source]
Bases:
State
Waiting for an order; become Busy if one appears.
- class orchestration_and_coordination.orchestration_and_coordination[source]
Bases:
object
Persistent order queue + multi-robot FSM helper.
- handle_request(req: tiago1.srv.robotstatedecisionRequest)[source]
Dispatch to the current FSM state.
- handle_request_new_order(req: tiago1.srv.send_order.Request) tiago1.srv.send_orderResponse [source]
Append new order from verifier into YAML queue.
- save_data()[source]
Flush :pyattr:`data` back to YAML.