From 18e200db5f461653897c5bd29f578a20d8b0de3a Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 13 Nov 2024 18:04:03 -0500 Subject: [PATCH] Ensure no warnings when nothing has been reported --- rb_ws/src/buggy/scripts/watchdog/watchdog.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rb_ws/src/buggy/scripts/watchdog/watchdog.py b/rb_ws/src/buggy/scripts/watchdog/watchdog.py index ca9468c..eff5522 100755 --- a/rb_ws/src/buggy/scripts/watchdog/watchdog.py +++ b/rb_ws/src/buggy/scripts/watchdog/watchdog.py @@ -57,13 +57,15 @@ def check_stepper_steering(self, msg): if self.alarm < 2: self.alarm = 0 - # Finds the minimum difference between the stepper's reported angle and the last 10 steering instructions - steer_instruct_diff_min = min( - map( - lambda steer: abs(stepper_steer - steer), - self.steering_instructions + steer_instruct_diff_min = 0 + if len(self.steering_instructions) > 0: + # Finds the minimum difference between the stepper's reported angle and the last 10 steering instructions + steer_instruct_diff_min = min( + map( + lambda steer: abs(stepper_steer - steer), + self.steering_instructions + ) ) - ) if steer_instruct_diff_min > Watchdog.STEERING_DEVIANCE: if self.inAutonSteer: