def joy_stick_control_2(car, a, b, x1, y1, z1, start=0, threshold=20, change_mode=1): #Xbox connect with Raspberry car = tcn.acc_or_not(car, a, b) # determine the incresement or decresement of step if abs(x1) < threshold: x1 = 0 if abs(y1) < threshold: y1 = 0 if abs(z1) < threshold: z1 = 0 xyz = [ abs(x1 * car[6] / 100), abs(y1 * car[6] / 100), abs(z1 * car[6] / 100) ] car[0] = int(car[0] + x1 * car[6] / 100) car[1] = int(car[1] + y1 * car[6] / 100) car[2] = int(car[2] + z1 * car[6] / 100) car = tcn.move_to_coordinate(car) tcn.record_position(car) time.sleep(0.006) return car
def joy_stick_control_v(car, a, b, x1, y1, z1, threshold=20): #Xbox connect with Raspberry car = tcn.acc_or_not(car, a, b, 130) if abs(x1) < threshold: x1 = 0 if abs(y1) < threshold: y1 = 0 if abs(z1) < threshold: z1 = 0 car[0] = int(x1 * car[6] / 100) car[1] = int(y1 * car[6] / 100) car[2] = int(z1 * car[6] / 100) #print(" {} {} {}".format(car[0],car[1],car[2])) car = tcn.move_to_coordinate(car) time.sleep(0.006) return car