-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathGPS.py
88 lines (81 loc) · 3.22 KB
/
GPS.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import navio.Common.ublox
if __name__ == "__main__":
ubl = navio.Common.ublox.UBlox("spi:0.0", baudrate=5000000, timeout=2)
ubl.configure_poll_port()
ubl.configure_poll(navio.Common.ublox.CLASS_CFG, navio.Common.ublox.MSG_CFG_USB)
# ubl.configure_poll(navio.ublox.CLASS_MON, navio.ublox.MSG_MON_HW)
ubl.configure_port(port=navio.Common.ublox.PORT_SERIAL1, inMask=1, outMask=0)
ubl.configure_port(port=navio.Common.ublox.PORT_USB, inMask=1, outMask=1)
ubl.configure_port(port=navio.Common.ublox.PORT_SERIAL2, inMask=1, outMask=0)
ubl.configure_poll_port()
ubl.configure_poll_port(navio.Common.ublox.PORT_SERIAL1)
ubl.configure_poll_port(navio.Common.ublox.PORT_SERIAL2)
ubl.configure_poll_port(navio.Common.ublox.PORT_USB)
ubl.configure_solution_rate(rate_ms=1000)
ubl.set_preferred_dynamic_model(None)
ubl.set_preferred_usePPP(None)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_POSLLH, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_PVT, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_STATUS, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_SOL, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_VELNED, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_SVINFO, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_VELECEF, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_POSECEF, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_RXM, navio.Common.ublox.MSG_RXM_RAW, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_RXM, navio.Common.ublox.MSG_RXM_SFRB, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_RXM, navio.Common.ublox.MSG_RXM_SVSI, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_RXM, navio.Common.ublox.MSG_RXM_ALM, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_RXM, navio.Common.ublox.MSG_RXM_EPH, 1
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_TIMEGPS, 5
)
ubl.configure_message_rate(
navio.Common.ublox.CLASS_NAV, navio.Common.ublox.MSG_NAV_CLOCK, 5
)
# ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_DGPS, 5)
while True:
msg = ubl.receive_message()
if msg is None:
if opts.reopen:
ubl.close()
ubl = navio.Common.ublox.UBlox("spi:0.0", baudrate=5000000, timeout=2)
continue
print(empty)
break
# print(msg.name())
if msg.name() == "NAV_POSLLH":
outstr = str(msg).split(",")[1:]
outstr = "".join(outstr)
print(outstr)
if msg.name() == "NAV_STATUS":
outstr = str(msg).split(",")[1:2]
outstr = "".join(outstr)
print(outstr)
# print(str(msg))