Scenario 1: Multi-Sensor Monitoring System#
Domain#
A facility monitoring station collects data from multiple environmental sensors deployed across a building. Each sensor publishes readings at a different rate. A central aggregator node collects all sensor data and publishes a consolidated summary. A watchdog node monitors sensor health by detecting missing data.
System Architecture
Your system must contain the following nodes and topics.
Nodes
Node |
Description |
|---|---|
|
Publishes |
|
Publishes |
|
Publishes |
|
Subscribes to all three sensor topics. Maintains the latest
value from each sensor. Publishes a |
|
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
battery_sensormust useTRANSIENT_LOCALdurability so that theaggregatorreceives the last battery reading even if it starts after the battery sensor. Demonstrate this by launching the aggregator 5 seconds after the sensors and verifying the first summary already contains a battery value.QoS – Intentional mismatch: Create a second subscriber in the
watchdognode that subscribes to/sensors/batterywithRELIABLEreliability butVOLATILEdurability. The battery publisher usesTRANSIENT_LOCAL. This is a compatible pairing (subscriber is less strict). Then create a third subscriber withTRANSIENT_LOCALdurability andBEST_EFFORTreliability connecting to theRELIABLEbattery publisher – this is the incompatible pairing. Add comments documenting both cases.Aggregator callback groups: The
aggregatornode must use aMultiThreadedExecutor. The three sensor subscription callbacks must be in aMutuallyExclusiveCallbackGroup(they all write to shared state: the latest sensor values). The summary publisher timer must be in a separateReentrantCallbackGroup(it only reads the latest values and can run independently).Watchdog: The watchdog node must track the timestamp of the last received message for each sensor. The 3-second timer callback checks whether
time.time() - last_received > 3.0for each sensor and logs a warning usingself.get_logger().warn()if true. Useself.get_logger().info()when all sensors are reporting normally.Launch files:
system.launch.py: starts all sensor nodes, the aggregator, and the watchdog.enable_loggerargument (defaultfalse): conditionally starts theloggernode.Sensor nodes grouped in a
GroupAction.
Expected Behavior
Normal operation:
[INFO] [<timestamp>] [aggregator]: Summary -- temp: 23.4, humidity: 55.2, battery: 97
[INFO] [<timestamp>] [aggregator]: Summary -- temp: 24.1, humidity: 54.8, battery: 96
[INFO] [<timestamp>] [watchdog]: All sensors reporting normally.
Sensor goes silent – to test this, run one sensor 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 the temperature sensor
ros2 launch group<N>_gp1 system.launch.py start_temperature:=false
# Terminal 2: start the temperature sensor manually
ros2 run group<N>_gp1 temperature_sensor
# Press Ctrl-C in Terminal 2 to simulate a sensor failure
The watchdog should detect the silence and log:
[WARNING] [<timestamp>] [watchdog]: temperature_sensor has not reported in 3.0 s
Note
To support this testing workflow, add a start_temperature
launch argument (default true) with an IfCondition on
the temperature sensor node. This lets you exclude it from the
launch file and run it manually in a separate terminal.
Verification commands:
ros2 launch group<N>_gp1 system.launch.py
ros2 launch group<N>_gp1 system.launch.py enable_logger:=true
ros2 topic list -t
ros2 topic echo /monitoring/summary
ros2 topic hz /sensors/temperature
ros2 topic info /sensors/battery -v
rqt_graph
Scenario 1 Grading Rubric
This rubric details how the 50 points from the common rubric map to Scenario 1 deliverables.
Component |
Pts |
Criteria |
|---|---|---|
Node Implementation (16 pts) |
||
|
2 |
Publishes |
|
2 |
Publishes |
|
2 |
Publishes |
|
4 |
Subscribes to all three sensor topics. Stores latest values.
Publishes |
|
3 |
Subscribes to temperature and humidity. Tracks last-received
timestamps. Logs warning ( |
|
1 |
Subscribes to |
Spinning and lifecycle |
2 |
Proper |
QoS (10 pts) |
||
Sensor topics QoS |
3 |
Temperature and humidity use |
TRANSIENT_LOCAL demo |
3 |
Aggregator started after battery sensor still receives last
battery value. Documented in |
Intentional mismatch |
4 |
Compatible pairing ( |
Launch Files (10 pts) |
||
|
4 |
Starts all sensor nodes, aggregator, and watchdog. All nodes
use |
|
2 |
|
|
2 |
|
Sensor |
2 |
All three sensor nodes grouped in a |
Executors and Callback Groups (8 pts) |
||
Aggregator executor |
2 |
Uses |
Sensor subscriptions group |
3 |
Three sensor callbacks in a |
Summary timer group |
3 |
Summary publisher timer in a |
Documentation and Quality (6 pts) |
||
README.md |
3 |
Group members, scenario summary, node graph, design decisions, build/run instructions. |
Code quality |
3 |
Type hints, docstrings, ROS 2 logger with correct severity levels, consistent naming, no linting errors. |
TOTAL |
50 |