From e1d6df41fc5dd84c84d00bb05ce916e074c0049e Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Thu, 10 Nov 2022 22:50:31 +0700 Subject: [PATCH] update sticky light behavior --- kuukar/kuukar_motion.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kuukar/kuukar_motion.py b/kuukar/kuukar_motion.py index 3b987f1..8513a6b 100644 --- a/kuukar/kuukar_motion.py +++ b/kuukar/kuukar_motion.py @@ -40,9 +40,11 @@ class motion: def turn(self, speed: int, duration: float): if speed > 0: + self.leds.set_left_signal_led(False) self.leds.set_right_signal_led(True) elif speed < 0: self.leds.set_left_signal_led(True) + self.leds.set_right_signal_led(False) self.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed) self.motor_write(MOTOR_FR_F, MOTOR_FR_R, -speed) self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed) @@ -53,7 +55,9 @@ class motion: def turn_cont(self, speed: int): if speed > 0: self.leds.set_right_signal_led(True) + self.leds.set_left_signal_led(False) elif speed < 0: + self.leds.set_right_signal_led(False) self.leds.set_left_signal_led(True) self.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed) self.motor_write(MOTOR_FR_F, MOTOR_FR_R, -speed) @@ -63,9 +67,12 @@ class motion: def drive_skew(self, speed: float, dir: float): if dir > 0: self.leds.set_right_signal_led(True) + self.leds.set_left_signal_led(False) elif dir < 0: + self.leds.set_right_signal_led(False) self.leds.set_left_signal_led(True) + lm_speed = (100+dir/2)*speed/100 if lm_speed>99: lm_speed = 99