-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-control.py
More file actions
48 lines (42 loc) · 1.4 KB
/
simple-control.py
File metadata and controls
48 lines (42 loc) · 1.4 KB
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
38
39
40
41
42
43
44
45
46
47
48
from djitellopy import Tello
import time
from PIL import Image
######################################################################
patrol_width = 120 # WIDTH OF THE Patrol (normally set to 120 cm for 4 feet (121.92)
patrol_height = 180 # HEIGHT OF THE Patrol (normally set to 180 cm for 4 feet (182.88)
drone_width = 15 # Normally set to 15 cm (7 inches)
drone_pauses = 5 # number of seconds at each corner
######################################################################
# CONNECT
me = Tello()
time.sleep(drone_pauses)
me.connect()
time.sleep(drone_pauses)
me.takeoff()
time.sleep(drone_pauses)
print(me.get_battery())
me.move_forward(patrol_height-drone_width)
time.sleep(drone_pauses)
me.move_left(patrol_width-drone_width)
time.sleep(drone_pauses)
me.move_back(patrol_height-drone_width)
time.sleep(drone_pauses)
me.move_right(patrol_width-drone_width)
time.sleep(drone_pauses)
me.move_forward(patrol_height-drone_width)
time.sleep(drone_pauses)
me.move_left(patrol_width-drone_width)
time.sleep(drone_pauses)
me.move_back(patrol_height-drone_width)
time.sleep(drone_pauses)
me.move_right(patrol_width-drone_width)
time.sleep(drone_pauses)
me.move_forward(patrol_height-drone_width)
time.sleep(drone_pauses)
me.move_left(patrol_width-drone_width)
time.sleep(drone_pauses)
me.move_back(patrol_height-drone_width)
time.sleep(drone_pauses)
me.move_right(patrol_width-drone_width)
time.sleep(drone_pauses)
me.land()