Skip to content

Commit 18e200d

Browse files
Ensure no warnings when nothing has been reported
1 parent a58ac13 commit 18e200d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

rb_ws/src/buggy/scripts/watchdog/watchdog.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ def check_stepper_steering(self, msg):
5757
if self.alarm < 2:
5858
self.alarm = 0
5959

60-
# Finds the minimum difference between the stepper's reported angle and the last 10 steering instructions
61-
steer_instruct_diff_min = min(
62-
map(
63-
lambda steer: abs(stepper_steer - steer),
64-
self.steering_instructions
60+
steer_instruct_diff_min = 0
61+
if len(self.steering_instructions) > 0:
62+
# Finds the minimum difference between the stepper's reported angle and the last 10 steering instructions
63+
steer_instruct_diff_min = min(
64+
map(
65+
lambda steer: abs(stepper_steer - steer),
66+
self.steering_instructions
67+
)
6568
)
66-
)
6769

6870
if steer_instruct_diff_min > Watchdog.STEERING_DEVIANCE:
6971
if self.inAutonSteer:

0 commit comments

Comments
 (0)