def diff_control(gas, steering): # if car is not moving if -0.03 <= gas <= 0.03: steering_power = steering * 100 moveLeft(-steering_power) moveRight(steering_power) # if car is moving else: if abs(steering) <= 0.2: moveLeft(gas * 100) moveRight(gas * 100) elif steering > 0: moveLeft((1 - steering) * gas * 100) moveRight(gas * 100) else: moveLeft(gas * 100) moveRight(gas * (1 + steering) * 100)
def leftMotor(msg): moveLeft(msg.axes[1]*100)
from control_motor import moveLeft from control_motor import moveRight i=0 while (i != 100): left,right=raw_input("command: ").split() left, right = [int(left), int(right)] moveLeft(left) moveRight(right) i=i+1
def leftMotor(msg): moveLeft(msg.axes[3]*100)
def leftMotor(msg): moveLeft(msg.velocity[0]*100)