reference_position.distanceXY(rx3_pos), reference_position.distanceXY(rx2_pos))) errlog.flush() def handle_device3(msg): global rx3_pos '''handle message from uncorrected rover GPS''' if msg.name() == "NAV_POSECEF": msg.unpack() pos = util.PosVector(msg.ecefX*0.01, msg.ecefY*0.01, msg.ecefZ*0.01) rx3_pos = pos def send_rtcm(msg): dev2.write(msg) RTCMv3_decode.run_RTCM_converter(opts.ntrip_server, opts.ntrip_user, opts.ntrip_password, opts.ntrip_mount, rtcm_callback=send_rtcm) while True: # get a message from the reference GPS msg = dev2.receive_message_noerror() if msg is not None: handle_device2(msg) last_msg2_time = time.time() if dev3 is not None: msg = dev3.receive_message_noerror() if msg is not None: handle_device3(msg) last_msg3_time = time.time() if opts.reopen and time.time() > last_msg2_time + 5:
# get a message from the reference GPS msg = dev.receive_message_noerror() if msg is not None: handle_device(msg, num) last_msg_time = time.time() sys.stdout.flush() except: pass def run_receiver_thread(dev, num): import threading t = threading.Thread(target=receiver_thread, args=(dev, num)) t.start() dev1 = setup_port(opts.port1, opts.log1) #RTCMv3_decode.run_RTCM_converter(opts.ntrip_server, opts.ntrip_port, opts.ntrip_user, opts.ntrip_password, opts.ntrip_mount, rtcm_callback=send_rtcm) RTCMv3_decode.run_RTCM_converter('rtk2go.com', 2101, '', '', 'TSUKUBA-RTCM3', rtcm_callback=send_rtcm) #RTCMv3_decode.run_RTCM_converter('160.16.134.72', 2101, 'guest', 'guest', 'CQ-RTCM3', rtcm_callback=send_rtcm) run_receiver_thread(dev1, 1) #run_receiver_thread(dev2, 2)
parser.add_option("--udp-port", type='int', default=13320) parser.add_option("--udp-addr", default="127.0.0.1") (opts, args) = parser.parse_args() packet_count = 0 def send_rtcm(msg): global packet_count packet_count += 1 msg = msg[:-2] # Trim off \r\n that the RTCM encoder puts there port.sendto(msg, (opts.udp_addr, opts.udp_port)) print(len(msg), msg) RTCMv3_decode.run_RTCM_converter(opts.ntrip_server, opts.ntrip_port, opts.ntrip_user, opts.ntrip_password, opts.ntrip_mount, rtcm_callback=send_rtcm) port = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # port.setsockopt... while True: print(packet_count) time.sleep(10)
nonVisible def receiver_thread(dev, num=1): while True: # get a message from the reference GPS msg = dev.receive_message_noerror() #print("hello world") if msg is not None: handle_device(msg, num) last_msg_time = time.time() sys.stdout.flush() def run_receiver_thread(dev, num): import threading t = threading.Thread(target=receiver_thread, args=(dev, num)) t.start() dev1, dev2 = setup_port(opts.port1, opts.port2, opts.log1, opts.log2) #RTCMv3_decode.run_RTCM_converter(opts.ntrip_server, opts.ntrip_port, opts.ntrip_user, opts.ntrip_password, opts.ntrip_mount, rtcm_callback=send_rtcm) RTCMv3_decode.run_RTCM_converter('RTK2go.com', 2101, '', '', 'yumo', rtcm_callback=send_rtcm) run_receiver_thread(dev1, 1) run_receiver_thread(dev2, 2)