Skip to content

Commit

Permalink
python: GPS: rename modules
Browse files Browse the repository at this point in the history
All modules for this example now in Common folder
Delete useless import util
  • Loading branch information
Igor Anokhin committed Jan 10, 2018
1 parent b241095 commit ccf53b5
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions Python/GPS.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,48 @@
import navio.util
import navio.ublox

import navio.Common.ublox

if __name__ == "__main__":

ubl = navio.ublox.UBlox("spi:0.0", baudrate=5000000, timeout=2)
ubl = navio.Common.ublox.UBlox("spi:0.0", baudrate=5000000, timeout=2)

ubl.configure_poll_port()
ubl.configure_poll(navio.ublox.CLASS_CFG, navio.ublox.MSG_CFG_USB)
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.ublox.PORT_SERIAL1, inMask=1, outMask=0)
ubl.configure_port(port=navio.ublox.PORT_USB, inMask=1, outMask=1)
ubl.configure_port(port=navio.ublox.PORT_SERIAL2, inMask=1, outMask=0)
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.ublox.PORT_SERIAL1)
ubl.configure_poll_port(navio.ublox.PORT_SERIAL2)
ubl.configure_poll_port(navio.ublox.PORT_USB)
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.ublox.CLASS_NAV, navio.ublox.MSG_NAV_POSLLH, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_PVT, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_STATUS, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_SOL, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_VELNED, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_SVINFO, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_VELECEF, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_POSECEF, 1)
ubl.configure_message_rate(navio.ublox.CLASS_RXM, navio.ublox.MSG_RXM_RAW, 1)
ubl.configure_message_rate(navio.ublox.CLASS_RXM, navio.ublox.MSG_RXM_SFRB, 1)
ubl.configure_message_rate(navio.ublox.CLASS_RXM, navio.ublox.MSG_RXM_SVSI, 1)
ubl.configure_message_rate(navio.ublox.CLASS_RXM, navio.ublox.MSG_RXM_ALM, 1)
ubl.configure_message_rate(navio.ublox.CLASS_RXM, navio.ublox.MSG_RXM_EPH, 1)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_TIMEGPS, 5)
ubl.configure_message_rate(navio.ublox.CLASS_NAV, navio.ublox.MSG_NAV_CLOCK, 5)
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.ublox.UBlox("spi:0.0", baudrate=5000000, timeout=2)
ubl = navio.Common.ublox.UBlox("spi:0.0", baudrate=5000000, timeout=2)
continue
print(empty)
break
Expand Down

0 comments on commit ccf53b5

Please sign in to comment.