-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManual Control
More file actions
37 lines (32 loc) · 835 Bytes
/
Manual Control
File metadata and controls
37 lines (32 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from djitellopy import Tello
import cv2
# W A S D, E Q rotate, R F for up and down, ESC to end
FPS = 30
tello = Tello()
tello.connect()
tello.streamon()
tello.takeoff()
while True:
img = tello.get_frame_read().frame
cv2.imshow("drone", img)
key = (cv2.waitKey(int((1 / FPS) * 1000)) & 0xff)
if key == 27:
tello.streamoff()
break
elif key == ord('w'):
tello.move_forward(30)
elif key == ord('s'):
tello.move_back(30)
elif key == ord('a'):
tello.move_left(30)
elif key == ord('d'):
tello.move_right(30)
elif key == ord('e'):
tello.rotate_clockwise(30)
elif key == ord('q'):
tello.rotate_counter_clockwise(30)
elif key == ord('r'):
tello.move_up(30)
elif key == ord('f'):
tello.move_down(30)
tello.land()