-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
40 lines (30 loc) · 1.14 KB
/
example.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
from marvelmind import MarvelmindHedge
from time import sleep
import sys
def main():
hedge = MarvelmindHedge(tty = "/dev/ttyACM0", adr=None, debug=False) # create MarvelmindHedge thread
if (len(sys.argv)>1):
hedge.tty= sys.argv[1]
hedge.start() # start thread
while True:
try:
hedge.dataEvent.wait(1)
hedge.dataEvent.clear()
if (hedge.positionUpdated):
hedge.print_position()
if (hedge.distancesUpdated):
hedge.print_distances()
if (hedge.rawImuUpdated):
hedge.print_raw_imu()
if (hedge.fusionImuUpdated):
hedge.print_imu_fusion()
if (hedge.telemetryUpdated):
hedge.print_telemetry()
if (hedge.qualityUpdated):
hedge.print_quality()
if (hedge.waypointsUpdated):
hedge.print_waypoint()
except KeyboardInterrupt:
hedge.stop() # stop and close serial port
sys.exit()
main()