forked from al3Co/BebopDrone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3_MoveBy2.py
More file actions
45 lines (39 loc) · 905 Bytes
/
Copy path3_MoveBy2.py
File metadata and controls
45 lines (39 loc) · 905 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
38
39
40
41
42
43
44
45
#!/usr/bin/python
"""
Starting for usage at the computer
Do not delete the except Typer error. GPS data error, added when include GPS
"""
import time
import math
import sys
import signal
import inspect
from core.bebop import *
drone=Bebop()
dX = 2 # 2 mts Forward
dY = 0
dZ = 0
dPsi = (math.pi/2) #90 degrees rotation
def main():
signal.signal(signal.SIGINT, signal_handler)
try:
drone.takeoff()
time.sleep(2)
drone.moveBy( dX, dY, dZ, dPsi)
time.sleep(3)
drone.hover()
drone.land()
sys.exit(0)
except (TypeError):
pass
def signal_handler(signal, frame):
drone.hover()
print('You pressed Ctrl+C!')
print('Landing')
drone.hover()
if drone.flyingState is None or drone.flyingState == 1: # taking off
drone.emergency()
drone.land()
sys.exit(0)
if __name__ == "__main__":
main()