class DroneActions: def __init__(self): self.tello = Tello() self.tello.connect() sleep(2) def takeoff(self): self.tello.takeoff() while self.tello.get_h() < 30: sleep(0.5) def land(self): self.tello.land() def execute(self, command): self.send_control_command(*command) def set_velocity(self, values): self.tello.send_rc_control(*values) def find_pink(self): self.set_velocity([0, 0, 0, 100]) sleep(2) self.set_velocity([0, 0, 0, 0]) def choreo(self): self.takeoff() self.find_pink() self.land()
frame_read = tello.get_frame_read() while True: start = time.time() # print(tello.get_current_state_all()) # print(tello.get_pitch()) # print(tello.get_roll()) # print(tello.get_yaw()) #### print("Velocity in x is {}".format(tello.get_vgx())) print("Velocity in y is {}".format(tello.get_vgy())) print("Accelaration in x is {}".format(tello.get_agx())) print("Accelaration in y is {}".format(tello.get_agy())) print("Acceleration in z is {}".format(tello.get_agz())) print(tello.get_h()) print(tello.get_bat()) cv2.imshow("Input Image", frame_read.frame) key = cv2.waitKey(5) & 0xFF if key == ord("w"): rcOut[1] = 50 elif key == ord("a"): rcOut[0] = -50 elif key == ord("s"): rcOut[1] = -50 elif key == ord("d"): rcOut[0] = 50 elif key == ord("u"): rcOut[2] = 50