forked from sudojslee/bebop2_controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demoBebopIndoors.py
45 lines (32 loc) · 1.15 KB
/
demoBebopIndoors.py
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
"""
Demo the Bebop indoors (sets small speeds and then flies just a small amount)
Note, the bebop will hurt your furniture if it hits it. Even though this is a very small
amount of flying, be sure you are doing this in an open area and are prepared to catch!
Author: Amy McGovern
"""
from pyparrot.Bebop import Bebop
bebop = Bebop(drone_type="Bebop2")
print("connecting")
success = bebop.connect(10)
print(success)
if (success):
print("turning on the video")
bebop.start_video_stream()
print("sleeping")
bebop.smart_sleep(2)
bebop.ask_for_state_update()
bebop.safe_takeoff(10)
# set safe indoor parameters
bebop.set_max_tilt(5)
bebop.set_max_vertical_speed(1)
# trying out the new hull protector parameters - set to 1 for a hull protection and 0 without protection
#bebop.set_hull_protection(1)
print("Flying direct: Slow move for indoors")
bebop.fly_direct(roll=0, pitch=20, yaw=0, vertical_movement=0, duration=2)
bebop.smart_sleep(5)
bebop.safe_land(10)
print("DONE - disconnecting")
bebop.stop_video_stream()
bebop.smart_sleep(5)
print(bebop.sensors.battery)
bebop.disconnect()