Update kuukar_motion.py

This commit is contained in:
Siwat Sirichai 2022-12-10 16:11:14 +07:00
parent edad44b715
commit c49f940ca0
1 changed files with 10 additions and 10 deletions

View File

@ -93,17 +93,17 @@ class motion:
turn *=100
leftSpeed = speed - turn
rightSpeed = speed + turn
if leftSpeed>990: leftSpeed=990
elif leftSpeed<-990: leftSpeed= -990
if rightSpeed>990: rightSpeed=990
elif rightSpeed<-990: rightSpeed= -990
if speed>990: speed=990
elif speed<-990: speed= -990
if leftSpeed>99: leftSpeed=99
elif leftSpeed<-99: leftSpeed= -99
if rightSpeed>99: rightSpeed=99
elif rightSpeed<-99: rightSpeed= -99
if speed>99: speed=99
elif speed<-99: speed= -99
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, abs(leftSpeed/10))
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed/10))
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed/10)
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed/10)
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, abs(leftSpeed))
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)