update sticky light behavior
This commit is contained in:
parent
5adb74082a
commit
e1d6df41fc
|
@ -40,9 +40,11 @@ class motion:
|
||||||
|
|
||||||
def turn(self, speed: int, duration: float):
|
def turn(self, speed: int, duration: float):
|
||||||
if speed > 0:
|
if speed > 0:
|
||||||
|
self.leds.set_left_signal_led(False)
|
||||||
self.leds.set_right_signal_led(True)
|
self.leds.set_right_signal_led(True)
|
||||||
elif speed < 0:
|
elif speed < 0:
|
||||||
self.leds.set_left_signal_led(True)
|
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_FL_F, MOTOR_FL_R, speed)
|
||||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, -speed)
|
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, -speed)
|
||||||
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
||||||
|
@ -53,7 +55,9 @@ class motion:
|
||||||
def turn_cont(self, speed: int):
|
def turn_cont(self, speed: int):
|
||||||
if speed > 0:
|
if speed > 0:
|
||||||
self.leds.set_right_signal_led(True)
|
self.leds.set_right_signal_led(True)
|
||||||
|
self.leds.set_left_signal_led(False)
|
||||||
elif speed < 0:
|
elif speed < 0:
|
||||||
|
self.leds.set_right_signal_led(False)
|
||||||
self.leds.set_left_signal_led(True)
|
self.leds.set_left_signal_led(True)
|
||||||
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed)
|
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed)
|
||||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_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):
|
def drive_skew(self, speed: float, dir: float):
|
||||||
if dir > 0:
|
if dir > 0:
|
||||||
self.leds.set_right_signal_led(True)
|
self.leds.set_right_signal_led(True)
|
||||||
|
self.leds.set_left_signal_led(False)
|
||||||
elif dir < 0:
|
elif dir < 0:
|
||||||
|
self.leds.set_right_signal_led(False)
|
||||||
self.leds.set_left_signal_led(True)
|
self.leds.set_left_signal_led(True)
|
||||||
|
|
||||||
|
|
||||||
lm_speed = (100+dir/2)*speed/100
|
lm_speed = (100+dir/2)*speed/100
|
||||||
if lm_speed>99:
|
if lm_speed>99:
|
||||||
lm_speed = 99
|
lm_speed = 99
|
||||||
|
|
Loading…
Reference in New Issue