Update kuukar_motion.py
This commit is contained in:
parent
abb2cffb19
commit
495a233594
|
@ -87,7 +87,8 @@ class motion:
|
||||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, rm_speed)
|
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, rm_speed)
|
||||||
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, lm_speed)
|
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, lm_speed)
|
||||||
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, rm_speed)
|
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, rm_speed)
|
||||||
|
|
||||||
|
'''
|
||||||
def skt_drive(self, speed: float, turn: float, t=0):
|
def skt_drive(self, speed: float, turn: float, t=0):
|
||||||
speed *=100
|
speed *=100
|
||||||
turn *=100
|
turn *=100
|
||||||
|
@ -115,6 +116,24 @@ class motion:
|
||||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
|
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_RL_F, MOTOR_RL_R, speed)
|
||||||
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
|
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
|
||||||
|
'''
|
||||||
|
|
||||||
|
def skt_drive(self, speed: float, turn: float, t=0):
|
||||||
|
speed *=100
|
||||||
|
turn *=100
|
||||||
|
leftSpeed = speed - turn
|
||||||
|
rightSpeed = speed + turn
|
||||||
|
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))
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue