import pygame import cv2 from controle_drone import controleDrone from djitellopy import Tello controle = controleDrone() tello = Tello() activateCamera = True if activateCamera: tello.streamon() cap = cv2.VideoCapture(tello.get_udp_video_address()) def get_joystick_axes(): joystick_count = pygame.joystick.get_count() for i in range(joystick_count): joystick = pygame.joystick.Joystick(i) joystick.init() numButton = get_joystick_button(joystick=joystick) buttonControll(numButton) axes = [] for i in range(0, 4): axes.append(round(pygame.joystick.Joystick(0).get_axis(i), 2)) return axes def get_joystick_button(joystick): buttons = joystick.get_numbuttons() for i in range(buttons): button = joystick.get_button(i)
from djitellopy import Tello import cv2 import time tello = Tello() tello.connect() tello.get_battery() tello.get_udp_video_address() print(tello.get_udp_video_address()) """ tello.takeoff() time.sleep(5) tello.move_left(100) time.sleep(5) tello.rotate_counter_clockwise(45) time.sleep(5) tello.land() time.sleep(5) """ tello.end()