action='store_true', default=False, help="ignore EOF") parser.add_option("--size", type='int', default=20, help="plot size in meters") parser.add_option("--skip", type='int', default=1, help="show every N positions") parser.add_option("--reference", help="reference position (lat,lon,alt)", default=None) (opts, args) = parser.parse_args() if opts.reference: reference_position = util.ParseLLH(opts.reference) else: reference_position = None # create a figure f = pyplot.figure(1) f.clf() pyplot.axis([-opts.size, opts.size, -opts.size, opts.size]) pyplot.ion() colours = ['ro', 'bo', 'go', 'yo'] devs = [] for d in args: devs.append(ublox.UBlox(d))
sv].timereceived + 1800 < tnow: continue dev1.configure_poll(ublox.CLASS_AID, ublox.MSG_AID_EPH, struct.pack('<B', sv)) svid_seen[sv] = tnow last_msg1_time = time.time() last_msg2_time = time.time() last_msg3_time = time.time() messages = {} satinfo = satelliteData.SatelliteData() if opts.reference is not None: satinfo.reference_position = util.ParseLLH(opts.reference).ToECEF() elif opts.ecef_reference is not None: satinfo.reference_position = util.PosVector( *opts.ecef_reference.split(',')) else: satinfo.reference_position = None satinfo.min_elevation = opts.minelevation satinfo.min_quality = opts.minquality def handle_device1(msg): '''handle message from reference GPS''' global messages, satinfo if msg.name() in [
parser.add_option("--reference", help="reference position (lat,lon,alt)", default=None) (opts, args) = parser.parse_args() if len(args) != 1: print("usage: position_estimate.py <file>") sys.exit(1) filename = args[0] dev = ublox.UBlox(filename) rtcmfile = open('rtcm2.dat', mode='wb') if opts.plot: reference = util.ParseLLH(opts.reference).ToECEF() plotter = dataPlotter.dataPlotter(reference) def position_estimate(messages, satinfo): '''process raw messages to calculate position ''' # get get position the receiver calculated. We use this to check the calculations pos = positionEstimate.positionEstimate(satinfo) if pos is None: # not enough information for a fix return if opts.plot: plotter.plotPosition(pos, 0)