#!/usr/bin/env python3 # type: ignore import os import serial from selfdrive.locationd.test import ublox import time import datetime import struct import sys from cereal import log from common import realtime import cereal.messaging as messaging from selfdrive.locationd.test.ephemeris import EphemerisData, GET_FIELD_U panda = os.getenv("PANDA") is not None # panda directly connected grey = not (os.getenv("EVAL") is not None) # panda through boardd debug = os.getenv("DEBUG") is not None # debug prints print_dB = os.getenv("PRINT_DB") is not None # print antenna dB timeout = 1 dyn_model = 4 # auto model baudrate = 460800 ports = ["/dev/ttyACM0","/dev/ttyACM1"] rate = 100 # send new data every 100ms # which SV IDs we have seen and when we got iono svid_seen = {} svid_ephemeris = {} iono_seen = 0 def configure_ublox(dev): # configure ports and solution parameters and rate # TODO: configure constellations and channels to allow for 10Hz and high precision dev.configure_port(port=ublox.PORT_USB, inMask=1, outMask=1) # enable only UBX on USB dev.configure_port(port=0, inMask=0, outMask=0) # disable DDC if panda: payload = struct.pack('