Scenario 2: Robot Fleet Dispatcher#
Domain#
A warehouse management system dispatches tasks to a fleet of mobile robots. A central dispatcher node publishes task assignments, each robot node receives its tasks and reports status updates, and a monitor node tracks fleet throughput and detects stalled robots.
System Architecture
Your system must contain the following nodes and topics.
Nodes
Node |
Description |
|---|---|
|
Publishes |
|
Subscribes to |
|
Same as |
|
Same as |
|
Subscribes to |
|
Subscribes to |
Topics
Topic |
Message Type |
QoS |
|---|---|---|
|
|
|
|
|
|
|
|
|
Specific Requirements
In addition to the common requirements in the main GP 1 page:
QoS – TRANSIENT_LOCAL: The
dispatcherpublishes on/fleet/taskswithTRANSIENT_LOCALand depth 5. If a robot node starts late, it immediately receives the last 5 task messages. Demonstrate this by startingrobot_35 seconds after the dispatcher and verifying it receives backlogged tasks.QoS – Intentional mismatch: Create a test subscriber (can be in the
monitornode or a separate debug node) that subscribes to/fleet/statususingRELIABLEreliability. The/fleet/statuspublisher usesBEST_EFFORT. ARELIABLEsubscriber cannot connect to aBEST_EFFORTpublisher – this is incompatible and will receive no data. Add comments in the code documenting the mismatch and how to diagnose it withros2 topic info /fleet/status -v.Slow robot and queue overflow:
robot_2sleeps for 2 s per task but receives tasks every 3 s (round-robin with 3 robots at 1 Hz = one task per robot every 3 s). This is manageable. To demonstrate overflow, temporarily increase the dispatch rate or decrease the queue depth and document the observation inREADME.md.Monitor callback groups: The
monitornode must use aMultiThreadedExecutor. The/fleet/statussubscription callback must be in aMutuallyExclusiveCallbackGroup(it updates shared dictionaries tracking per-robot counts and timestamps). The report-publishing timer must be in aReentrantCallbackGroup.Robot node callback groups: Each robot node has two callbacks (task subscription and status publishing timer). These must be in a
MutuallyExclusiveCallbackGroupbecause the subscription callback writes to shared state (current task) that the status publisher reads.Launch files:
system.launch.py: starts the dispatcher, all three robot nodes, and the monitor.enable_debugargument (defaultfalse): conditionally starts thedebug_loggernode.Robot nodes grouped in a
GroupAction.
Expected Behavior
Normal operation:
[INFO] [<timestamp>] [dispatcher]: Assigned task pick_shelf_A3 to robot_1
[INFO] [<timestamp>] [robot_1]: Received task pick_shelf_A3 -- executing...
[INFO] [<timestamp>] [robot_1]: Task pick_shelf_A3 complete
[INFO] [<timestamp>] [dispatcher]: Assigned task deliver_dock_2 to robot_2
[INFO] [<timestamp>] [robot_2]: Received task deliver_dock_2 -- executing...
[INFO] [<timestamp>] [monitor]: Fleet report -- robot_1: 3 tasks, robot_2: 1 tasks, robot_3: 4 tasks
Robot stalled – to test this, run robot_2 separately with
ros2 run in its own terminal instead of the launch file, then
stop it with Ctrl-C:
# Terminal 1: launch the system without robot_2
ros2 launch group<N>_gp1 system.launch.py start_robot_2:=false
# Terminal 2: start robot_2 manually
ros2 run group<N>_gp1 robot_2
# Press Ctrl-C in Terminal 2 to simulate a stalled robot
The monitor should detect the silence and log:
[WARNING] [<timestamp>] [monitor]: robot_2 has not reported in 5.0 s
Note
To support this testing workflow, add a start_robot_2 launch
argument (default true) with an IfCondition on the
robot_2 node.
Verification commands:
ros2 launch group<N>_gp1 system.launch.py
ros2 launch group<N>_gp1 system.launch.py enable_debug:=true
ros2 topic list -t
ros2 topic echo /fleet/tasks
ros2 topic echo /fleet/status
ros2 topic hz /fleet/status
ros2 topic info /fleet/tasks -v
rqt_graph
Scenario 2 Grading Rubric
This rubric details how the 50 points from the common rubric map to Scenario 2 deliverables.
Component |
Pts |
Criteria |
|---|---|---|
Node Implementation (16 pts) |
||
|
3 |
Publishes |
|
2 |
Subscribes to |
|
2 |
Same as |
|
2 |
Same as |
|
3 |
Subscribes to |
|
1 |
Subscribes to |
Spinning and lifecycle |
3 |
Proper |
QoS (10 pts) |
||
Topic QoS profiles |
3 |
|
TRANSIENT_LOCAL demo |
3 |
|
Intentional mismatch |
2 |
|
Queue overflow observation |
2 |
|
Launch Files (10 pts) |
||
|
4 |
Starts dispatcher, all three robots, and monitor. All nodes
use |
|
2 |
|
|
2 |
|
Robot |
2 |
All three robot nodes grouped in a |
Executors and Callback Groups (8 pts) |
||
Monitor executor |
2 |
Uses |
Monitor status subscription |
2 |
|
Monitor report timer |
2 |
Report timer in a |
Robot node callback groups |
2 |
Task subscription and status timer in a
|
Documentation and Quality (6 pts) |
||
README.md |
3 |
Group members, scenario summary, node graph, design decisions, build/run instructions, queue overflow observation. |
Code quality |
3 |
Type hints, docstrings, ROS 2 logger with correct severity levels, consistent naming, no linting errors. |
TOTAL |
50 |