def _start_fired(self): """ Handle start udp broadcast button. Registers callbacks on self.link for each of the self.msgs If self.msgs is None, it registers one generic callback for all messages """ self.running = True try: self.func = UdpLogger(self.ip_ad, self.port) self.link.add_callback(self.func, self.msgs) except: import traceback print traceback.format_exc()
def main(): args = get_args() address = args.address[0] udp_port = args.udp_port[0] with PySerialDriver(args.serial_port[0], args.baud[0]) as driver: with Handler(driver.read, driver.write) as handler: with UdpLogger(address, udp_port) as udp: handler.add_callback(udp) try: while True: time.sleep(0.1) except KeyboardInterrupt: pass
def main(): """Simple command line interface for running the udp bridge to forward observation messages """ args = get_args() port = int(args.udp_port[0]) address = args.address[0] with PySerialDriver(args.serial_port[0], args.baud[0]) as driver: with Handler(Framer(driver.read, driver.write)) as handler: with UdpLogger(address, port) as udp: handler.add_callback(udp, OBS_MSGS) # Note, we may want to send the ephemeris message in the future # but the message is too big for MAVProxy right now try: while True: time.sleep(0.1) except KeyboardInterrupt: pass
def test_udp_logger(): msg = SBP(1, 2, 3, 'abc', 4) handler = udp_handler(msg.pack()) ip, port = udp_server(handler) with UdpLogger(ip, port) as udp: udp(msg)
NTRIP_HOST = rospy.get_param('/ntrip_host', "rtk2go.com") NTRIP_PORT = rospy.get_param('/ntrip_port', 2101) NTRIP_MOUNT_POINT = rospy.get_param('/ntrip_mount_point', "ER_Valldoreix_1") #RADIO RADIO_PORT = rospy.get_param('/sbp_arbitrator/radio_port', "/dev/freewaveGXMT14") RADIO_BAUDRATE = rospy.get_param('/sbp_arbitrator/radio_baudrate', 115200) # UDP LOGGER UDP_ADDRESS = rospy.get_param('/sbp_arbitrator/udp_address', "192.168.8.222") UDP_PORT = rospy.get_param('/sbp_arbitrator/udp_port', 55558) freq = rospy.get_param('/sbp_arbitrator/frequency', 5) debug = rospy.get_param('/sbp_arbitrator/debug', False) # create instance of UdpLogger object udp = UdpLogger(UDP_ADDRESS, UDP_PORT) # txt files for msg logging if debug: HOME = os.getenv('HOME') now = datetime.datetime.utcnow() txt_time = now.strftime("%Y%m%d%H%M%S") ntrip_file_path = HOME + "/sbp_arb_logs/" + txt_time + "_ntrip.txt" radio_file_path = HOME + "/sbp_arb_logs/" + txt_time + "_radio.txt" arb_file_path = HOME + "/sbp_arb_logs/" + txt_time + "_arbitrator.txt" ntrip_txt_file = open(ntrip_file_path, "a") radio_txt_file = open(radio_file_path, "a") arb_txt_file = open(arb_file_path, "a") # get current year:month:day:hour