# A and Hat direction to flip if joystick.get_button(0) == 1 and hat_y == 1: print("Executing Front Flip") drone.frontFlip() if joystick.get_button(0) == 1 and hat_y == -1: print("Executing Back Flip") drone.backFlip() if joystick.get_button(0) == 1 and hat_x == 1: print("Executing Right Flip") drone.rightFlip() if joystick.get_button(0) == 1 and hat_x == -1: print("Executing Left Flip") drone.leftFlip() if joystick.get_button(1) == 1: print("Battery: " + str(drone.battery)) # --- Flying --- # Power values roll = scale(joystick.get_axis(0), MAX_SPEED) pitch = -scale(joystick.get_axis(1), MAX_SPEED) yaw = scale(joystick.get_axis(3), MAX_SPEED) gaz = -scale(joystick.get_axis(4), MAX_SPEED) drone.update(cmd=movePCMDCmd(True, roll, pitch, yaw, gaz)) # --- Move camera ---