It's rough, can use it to use
import djitellopy
import pygame
tello = djitellopy.Tello()
tello.connect()
pygame.init()
joystick = pygame.joystick.Joystick(0)
joystick.init()
done = False
while not done:
res = [0, 0, 0, 0]
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == pygame.JOYBUTTONDOWN:
if joystick.get_button (0): # A key to take off
tello.takeoff()
if joystick.get_button (1): # B key landing
tello.land()
done = True
break
if event.type == pygame.JOYAXISMOTION:
# axes = joystick.get_numaxes()
for I in Range (4): # Left and right joystick
axis = joystick.get_axis(i)
if abs(axis) > 0.5:
Res [i] = axis * 50 # direction and speed
break
tello.send_rc_control(res[0], -res[1], -res[3], res[2])
pygame.time.wait(100)
pygame.quit()
Related Documents Address:https://docs.microsoft.com/en-us/windows/win32/xinput/getting-started-with-xinput Required header file: Xinput.h lib file: Xinput.lib Supports up to four handsets, and other ...
Problem background Solution to sum up Note before reading: Suggested reading time for this article: 3min Problem background After downloading the steam on the Mac, the result is that after opening the...
Processing handle monitor event (Xbox) Handle monitor Handle listening code Need to import package Game Control Plus API Link Handle monitor Use the keyboard space button and the S key. Please switch ...
It has been a year since the DJI tello drone came out, and the function of viewing videos with PCs was only opened this year. After 2 days of exploration, it was finally realized in a simple way. I da...
Zero cost to repair XBox handle rocker drift A few days ago to play the game, I found my Xbox One handle left stick is always out of control, mainly, I do not push rocker, but I'm on the computer disp...
In the Unity, using the Xbox handle for input control management, first of all, you need to configure the keys in the Project Settings / Input Manager. The following figure is the unity's default Inpu...
Control characters method one Method Two Method Three...
Foreword: When using Python to make an automated script such as an office software or game, it is often necessary to find the handle of the software and the information of the control to realize the a...
Ruijiang, a subsidiary of DJI, has released a new drone edu for education and toys. Compared with the previous generation, the new product has increased the formation flight and challenge card functio...
Use Python programming from zero DJI TELLO Computers from a Python environment -> Programming drones with Python, in fact, it is not complicated. The steps are the following: Install the basic oper...