Skip to content

Commit 48b9eae

Browse files
Michał Fąferekmfaferek93
authored andcommitted
fix: address PR review comments
- Add Apache 2.0 license header to fault_storm.py - Handle wait_for_service() timeout with error instead of silent continue - Document nvidia container name variant in docstring - Use correct container name based on profile in run-demo-debounce.sh
1 parent 0ea7792 commit 48b9eae

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

demos/turtlebot3_integration/run-demo-debounce.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,16 @@ else
9595
fi
9696

9797
if [[ "$DETACH_MODE" == "true" ]]; then
98+
if [[ "$PROFILE" == "nvidia" ]]; then
99+
CONTAINER="turtlebot3_medkit_demo_nvidia"
100+
else
101+
CONTAINER="turtlebot3_medkit_demo"
102+
fi
98103
echo ""
99104
echo "✅ Demo started in DEBOUNCE mode!"
100105
echo ""
101106
echo "Fire fault storm to see debounce in action:"
102-
echo " docker exec turtlebot3_medkit_demo bash -c \\"
107+
echo " docker exec $CONTAINER bash -c \\"
103108
echo " 'source /opt/ros/jazzy/setup.bash && source /root/demo_ws/install/setup.bash && python3 /root/demo_ws/src/turtlebot3_medkit_demo/scripts/fault_storm.py'"
104109
echo ""
105110
echo "🛑 To stop: ./stop-demo.sh"

demos/turtlebot3_integration/scripts/fault_storm.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/usr/bin/env python3
2+
# Copyright 2026 selfpatch
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
"""Fault storm injector for ros2_medkit debounce demo.
317
418
Fires 9 noise faults (1 report each) + 1 real problem (5 sustained reports),
@@ -13,10 +27,13 @@
1327
python3 fault_storm.py
1428
1529
Usage (Docker demo):
30+
# CPU profile (default):
1631
docker exec turtlebot3_medkit_demo bash -c \
1732
"source /opt/ros/jazzy/setup.bash && \
1833
source /root/demo_ws/install/setup.bash && \
1934
python3 /root/demo_ws/src/turtlebot3_medkit_demo/scripts/fault_storm.py"
35+
# NVIDIA profile:
36+
docker exec turtlebot3_medkit_demo_nvidia bash -c ...
2037
"""
2138

2239
import rclpy
@@ -103,7 +120,11 @@ def __init__(self):
103120
ReportFault, "/fault_manager/report_fault"
104121
)
105122
self.get_logger().info("Waiting for fault_manager...")
106-
self.client.wait_for_service(timeout_sec=5.0)
123+
if not self.client.wait_for_service(timeout_sec=5.0):
124+
self.get_logger().error(
125+
"fault_manager service not available after 5s; aborting."
126+
)
127+
raise RuntimeError("fault_manager service not available")
107128
self.get_logger().info("Connected")
108129

109130
def fire(self, fault_code, severity, description, source_id):

0 commit comments

Comments
 (0)