def add_AID_EPH(self, msg): """add some AID_EPH ephemeris data""" eph = ephemeris.EphemerisData(msg) if eph.valid: if eph.svid in self.ephemeris: old_eph = self.ephemeris[eph.svid] else: old_eph = None self.ephemeris[eph.svid] = eph if old_eph is None or old_eph != eph: self.smooth.reset(eph.svid) util.saveObject('ephemeris.dat', self.ephemeris)
def handle_device1(msg): """handle message from reference GPS""" global messages, satinfo, itow, week, rx1_pos, svid_seen if msg.name() in ['NAV_SVINFO', 'NAV_SOL', 'AID_EPH']: try: msg.unpack() except ublox.UBloxError as e: print(e) if msg.name() == 'NAV_SVINFO': svinfo_to_rtcm(msg) elif msg.name() == 'NAV_SOL': itow = msg.iTOW * 0.001 week = msg.week rx1_pos = util.PosVector(msg.ecefX / 100., msg.ecefY / 100., msg.ecefZ / 100.) elif msg.name() == 'AID_EPH': eph = ephemeris.EphemerisData(msg) if eph.valid: svid_iode[eph.svid] = eph.iode
svid_seen[sv] = tnow while True: msg = dev.receive_message() if msg is None: if opts.reopen: dev.close() dev = ublox.UBlox(opts.port, baudrate=opts.baudrate, timeout=2) dev.set_logfile(opts.log, append=True) continue break if opts.show: try: print(str(msg)) sys.stdout.flush() except ublox.UBloxError as e: print(e) elif opts.dots: sys.stdout.write('.') sys.stdout.flush() if msg.name() == 'RXM_RAW': msg.unpack() handle_rxm_raw(msg) if msg.name() == 'AID_EPH': try: msg.unpack() svid_ephemeris[msg.svid] = ephemeris.EphemerisData(msg) except ublox.UBloxError as e: print(e)
def add_RXM_SFRBX(self, msg): svid = msg._fields['svid'] if svid not in self.ephemeris.keys(): self.ephemeris[svid] = ephemeris.EphemerisData() self.ephemeris[svid].fill_ephemeris(msg)