* agnos 8

* update to python 3.11.4 (#27452)

* rebase

* optional

* lower cython

* TEMP don't pull cl to use python3.11

* Revert "lower cython"

This reverts commit c5132f8a27.

* fix cython

* remove tensorrt

* carla + opencv

* macos

* update timm and smp

* pynvc

* https

* downgrade numpy

* pin scipy

---------

Co-authored-by: Maxime Desroches <desroches.maxime@gmail.com>
Co-authored-by: Yassine <yassine.y10@gmail.com>

* revert that

* fix linter

---------

Co-authored-by: Maxime Desroches <desroches.maxime@gmail.com>
Co-authored-by: Yassine <yassine.y10@gmail.com>
pull/29077/head
Adeeb Shihadeh 2 years ago committed by GitHub
parent 0b8d35b132
commit 1945c356c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .python-version
  2. 2
      Dockerfile.openpilot_base
  3. 1
      SConstruct
  4. 2
      cereal
  5. 2
      launch_env.sh
  6. 2
      mypy.ini
  7. 2
      opendbc
  8. 6264
      poetry.lock
  9. 37
      pyproject.toml
  10. 4
      selfdrive/athena/athenad.py
  11. 2
      selfdrive/boardd/pandad.py
  12. 6
      selfdrive/car/car_helpers.py
  13. 2
      selfdrive/car/docs_definitions.py
  14. 4
      selfdrive/controls/controlsd.py
  15. 3
      selfdrive/controls/plannerd.py
  16. 5
      selfdrive/controls/radard.py
  17. 3
      selfdrive/debug/dump.py
  18. 3
      selfdrive/debug/internal/measure_torque_time_to_max.py
  19. 2
      selfdrive/debug/run_process_on_route.py
  20. 10
      selfdrive/locationd/calibrationd.py
  21. 6
      selfdrive/locationd/laikad.py
  22. 3
      selfdrive/locationd/paramsd.py
  23. 3
      selfdrive/locationd/test/_test_locationd_lib.py
  24. 9
      selfdrive/locationd/torqued.py
  25. 2
      selfdrive/test/process_replay/helpers.py
  26. 44
      system/hardware/tici/agnos.json
  27. 2
      system/sensord/rawgps/compare.py

@ -1 +1 @@
3.8.10 3.11.4

@ -13,7 +13,7 @@ ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8 ENV LC_ALL en_US.UTF-8
ENV POETRY_VIRTUALENVS_CREATE=false ENV POETRY_VIRTUALENVS_CREATE=false
ENV PYENV_VERSION=3.8.10 ENV PYENV_VERSION=3.11.4
ENV PYENV_ROOT="/root/.pyenv" ENV PYENV_ROOT="/root/.pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH" ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"

@ -263,6 +263,7 @@ py_include = sysconfig.get_paths()['include']
envCython = env.Clone() envCython = env.Clone()
envCython["CPPPATH"] += [py_include, np.get_include()] envCython["CPPPATH"] += [py_include, np.get_include()]
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"] envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
envCython["CCFLAGS"].remove("-Werror")
envCython["LIBS"] = [] envCython["LIBS"] = []
if arch == "Darwin": if arch == "Darwin":

@ -1 +1 @@
Subproject commit 6f7102581f57eb5074b816cc2cfd984218916773 Subproject commit aed9fd278a704816aba11f4473aafefc281ed2bc

@ -7,7 +7,7 @@ export OPENBLAS_NUM_THREADS=1
export VECLIB_MAXIMUM_THREADS=1 export VECLIB_MAXIMUM_THREADS=1
if [ -z "$AGNOS_VERSION" ]; then if [ -z "$AGNOS_VERSION" ]; then
export AGNOS_VERSION="7.1" export AGNOS_VERSION="8.2"
fi fi
if [ -z "$PASSIVE" ]; then if [ -z "$PASSIVE" ]; then

@ -1,5 +1,5 @@
[mypy] [mypy]
python_version = 3.8 python_version = 3.11
plugins = numpy.typing.mypy_plugin plugins = numpy.typing.mypy_plugin
files = body, common, docs, scripts, selfdrive, site_scons, system, tools files = body, common, docs, scripts, selfdrive, site_scons, system, tools
exclude = ^(cereal/)|(opendbc/)|(panda/)|(laika/)|(laika_repo/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(xx/) exclude = ^(cereal/)|(opendbc/)|(panda/)|(laika/)|(laika_repo/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(xx/)

@ -1 +1 @@
Subproject commit 3ef35ed2298a3a9d199f9145409547710065884c Subproject commit 4231b0f12d8cf10d0554c4eb513ac984defc1f90

6264
poetry.lock generated

File diff suppressed because it is too large Load Diff

@ -10,13 +10,13 @@ documentation = "https://docs.comma.ai"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "~3.8" python = "~3.11"
atomicwrites = "^1.4.0" atomicwrites = "^1.4.0"
casadi = "==3.6.3" casadi = "==3.6.3"
cffi = "^1.15.1" cffi = "^1.15.1"
crcmod = "^1.7" crcmod = "^1.7"
cryptography = "^37.0.4" cryptography = "^37.0.4"
Cython = "^0.29.30" Cython = "^3.0.0"
flake8 = "^4.0.1" flake8 = "^4.0.1"
Flask = "^2.1.2" Flask = "^2.1.2"
future-fstrings = "^1.2.0" # for acados future-fstrings = "^1.2.0" # for acados
@ -27,14 +27,14 @@ Jinja2 = "^3.1.2"
json-rpc = "^1.13.0" json-rpc = "^1.13.0"
libusb1 = "^3.0.0" libusb1 = "^3.0.0"
nose = "^1.3.7" nose = "^1.3.7"
numpy = "^1.23.0" numpy = "==1.23.0" # locked pending deprecation fixes in xx
onnx = "^1.14.0" onnx = "^1.14.0"
onnxruntime-gpu = { version = "^1.15.1", platform = "linux", markers = "platform_machine == 'x86_64'" } onnxruntime-gpu = { version = "^1.15.1", platform = "linux", markers = "platform_machine == 'x86_64'" }
pillow = "^9.2.0" pillow = "^9.2.0"
poetry = "==1.2.2" poetry = "==1.2.2"
protobuf = "==3.20.3" protobuf = "==3.20.3"
psutil = "^5.9.1" psutil = "^5.9.1"
pycapnp = "==1.1.0" pycapnp = "^1.3.0"
pycryptodome = "^3.15.0" pycryptodome = "^3.15.0"
PyJWT = "^2.5.0" PyJWT = "^2.5.0"
pyopencl = "^2022.2.4" pyopencl = "^2022.2.4"
@ -43,7 +43,7 @@ python-dateutil = "^2.8.2"
PyYAML = "^6.0" PyYAML = "^6.0"
pyzmq = "^23.2.0" pyzmq = "^23.2.0"
requests = "^2.28.1" requests = "^2.28.1"
scons = "^4.3.0" scons = "^4.5.2"
sentry-sdk = "^1.6.0" sentry-sdk = "^1.6.0"
setproctitle = "^1.2.3" setproctitle = "^1.2.3"
six = "^1.16.0" six = "^1.16.0"
@ -51,8 +51,8 @@ smbus2 = "^0.4.2"
sounddevice = "^0.4.5" sounddevice = "^0.4.5"
spidev = { version = "^3.6", platform = "linux" } spidev = { version = "^3.6", platform = "linux" }
spidev2 = { version = "^0.9.0", platform = "linux" } spidev2 = { version = "^0.9.0", platform = "linux" }
sympy = "^1.10.1" sympy = "^1.11.1"
timezonefinder = "^6.0.1" timezonefinder = "^6.2.0"
tqdm = "^4.64.0" tqdm = "^4.64.0"
urllib3 = "^1.26.10" urllib3 = "^1.26.10"
utm = "^0.7.0" utm = "^0.7.0"
@ -62,10 +62,10 @@ sconscontrib = {git = "https://github.com/SCons/scons-contrib.git"}
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
av = "^9.2.0" av = "^10.0.0"
azure-storage-blob = "~2.1" azure-storage-blob = "~2.1"
breathe = "^4.34.0" breathe = "^4.34.0"
carla = { version = "==0.9.13", platform = "linux", markers = "platform_machine == 'x86_64'" } carla = { url = "https://github.com/commaai/carla/releases/download/3.11.4/carla-0.9.14-cp311-cp311-linux_x86_64.whl", platform = "linux", markers = "platform_machine == 'x86_64'" }
control = "^0.9.2" control = "^0.9.2"
coverage = "^6.4.1" coverage = "^6.4.1"
dictdiffer = "^0.9.0" dictdiffer = "^0.9.0"
@ -79,24 +79,23 @@ lxml = "^4.9.1"
markdown-it-py = "^2.1.0" markdown-it-py = "^2.1.0"
matplotlib = "^3.5.2" matplotlib = "^3.5.2"
mpld3 = "^0.5.8" mpld3 = "^0.5.8"
mypy = "^0.961" mypy = "^1.4.0"
myst-parser = "^0.18.0" myst-parser = "^0.18.0"
natsort = "^8.1.0" natsort = "^8.1.0"
numpy = "^1.23.0" opencv-python-headless = { url = "https://github.com/commaai/opencv-python-builder/releases/download/4.5.5.64%2Bcu118-cp311/opencv_python_headless-4.5.5.64-cp311-cp311-manylinux_2_31_x86_64.whl", platform = "linux" }
opencv-python-headless = { url = "https://github.com/commaai/opencv-python-builder/releases/download/4.5.5.64%2Bcu118/opencv_python_headless-4.5.5.64-cp38-cp38-manylinux_2_31_x86_64.whl", platform = "linux" }
pandas = "^1.4.3" pandas = "^1.4.3"
parameterized = "^0.8.1" parameterized = "^0.8.1"
paramiko = "^2.11.0" paramiko = "^2.11.0"
pprofile = "^2.1.0" pprofile = "^2.1.0"
pre-commit = "^2.19.0" pre-commit = "^2.19.0"
pycurl = "^7.45.1" pycurl = "^7.45.1"
pygame = "^2.1.2" pygame = "^2.4.0"
pylint = "^2.17.4" pylint = "^2.17.4"
pyprof2calltree = "^1.4.5" pyprof2calltree = "^1.4.5"
pytest = "^7.1.2" pytest = "^7.1.2"
pytest-xdist = "^2.5.0" pytest-xdist = "^2.5.0"
reverse_geocoder = "^1.5.1" reverse_geocoder = "^1.5.1"
scipy = "^1.8.1" scipy = "==1.9.3" # pinned until xx refs changes can be checked
sphinx = "^5.0.2" sphinx = "^5.0.2"
sphinx-rtd-theme = "^1.0.0" sphinx-rtd-theme = "^1.0.0"
sphinx-sitemap = "^2.2.0" sphinx-sitemap = "^2.2.0"
@ -118,7 +117,6 @@ optional = true
aenum = "^3.1.11" aenum = "^3.1.11"
aiohttp = "^3.8.1" aiohttp = "^3.8.1"
albumentations = "^1.2.1" albumentations = "^1.2.1"
apex = { url = "https://github.com/commaai/apex/releases/download/pytorch2.0.0%2Bcu11.8/apex-0.1-cp38-cp38-linux_x86_64.whl" }
azure-cli-core = "^2.38.0" azure-cli-core = "^2.38.0"
azure-common = "^1.1.28" azure-common = "^1.1.28"
azure-core = "^1.24.2" azure-core = "^1.24.2"
@ -164,20 +162,21 @@ redis = "^4.3.4"
s2sphere = "^0.2.5" s2sphere = "^0.2.5"
scikit-image = "^0.19.3" scikit-image = "^0.19.3"
scikit-learn = "^1.1.1" scikit-learn = "^1.1.1"
segmentation-models-pytorch = "==0.3.2" segmentation-models-pytorch = "==0.3.3"
simplejson = "^3.17.6" simplejson = "^3.17.6"
SQLAlchemy = "^1.4.39" SQLAlchemy = "^1.4.39"
torch = { url = "https://download.pytorch.org/whl/cu118/torch-2.0.0%2Bcu118-cp38-cp38-linux_x86_64.whl" } torch = { url = "https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp311-cp311-linux_x86_64.whl" }
torchsummary = "^1.5.1" torchsummary = "^1.5.1"
torchvision = { url = "https://download.pytorch.org/whl/cu118/torchvision-0.15.1%2Bcu118-cp38-cp38-linux_x86_64.whl" } torchvision = { url = "https://download.pytorch.org/whl/cu118/torchvision-0.15.2%2Bcu118-cp311-cp311-linux_x86_64.whl" }
triton = "^2.0.0" triton = "^2.0.0"
Werkzeug = "^2.1.2" Werkzeug = "^2.1.2"
zerorpc = { git = "https://github.com/commaai/zerorpc-python.git", branch = "master" } zerorpc = { git = "https://github.com/commaai/zerorpc-python.git", branch = "master" }
omegaconf = "^2.3.0" omegaconf = "^2.3.0"
osmnx = "==1.2.2" osmnx = "==1.2.2"
tritonclient = {version = "2.28.0", extras = ["http"]} tritonclient = {version = "2.28.0", extras = ["http"]}
tensorrt = "^8.6.0"
transformers = "^4.29.2" transformers = "^4.29.2"
timm = "==0.9.2"
PyNvCodec = { git = "https://github.com/NVIDIA/VideoProcessingFramework.git", rev = "3347e55" }
[build-system] [build-system]

@ -798,7 +798,9 @@ def main(exit_event: Optional[threading.Event] = None):
except (ConnectionError, TimeoutError, WebSocketException): except (ConnectionError, TimeoutError, WebSocketException):
conn_retries += 1 conn_retries += 1
params.remove("LastAthenaPingTime") params.remove("LastAthenaPingTime")
except socket.timeout: # TODO: socket.timeout and TimeoutError are now the same exception since python3.10
# Remove the socket.timeout case once we have fully moved to python3.11
except socket.timeout: # pylint: disable=duplicate-except
params.remove("LastAthenaPingTime") params.remove("LastAthenaPingTime")
except Exception: except Exception:
cloudlog.exception("athenad.main.exception") cloudlog.exception("athenad.main.exception")

@ -169,7 +169,7 @@ def main() -> NoReturn:
# sort pandas to have deterministic order # sort pandas to have deterministic order
pandas.sort(key=cmp_to_key(panda_sort_cmp)) pandas.sort(key=cmp_to_key(panda_sort_cmp))
panda_serials = list(map(lambda p: p.get_usb_serial(), pandas)) # type: ignore panda_serials = list(map(lambda p: p.get_usb_serial(), pandas))
# log panda fw versions # log panda fw versions
params.put("PandaSignatures", b','.join(p.get_signature() for p in pandas)) params.put("PandaSignatures", b','.join(p.get_signature() for p in pandas))

@ -89,9 +89,9 @@ def fingerprint(logcan, sendcan, num_pandas):
cached_params = params.get("CarParamsCache") cached_params = params.get("CarParamsCache")
if cached_params is not None: if cached_params is not None:
cached_params = car.CarParams.from_bytes(cached_params) with car.CarParams.from_bytes(cached_params) as cached_params:
if cached_params.carName == "mock": if cached_params.carName == "mock":
cached_params = None cached_params = None
if cached_params is not None and len(cached_params.carFw) > 0 and \ if cached_params is not None and len(cached_params.carFw) > 0 and \
cached_params.carVin is not VIN_UNKNOWN and not disable_fw_cache: cached_params.carVin is not VIN_UNKNOWN and not disable_fw_cache:

@ -149,7 +149,7 @@ class CarParts:
return copy.deepcopy(self) return copy.deepcopy(self)
@classmethod @classmethod
def common(cls, add: List[EnumBase] = None, remove: List[EnumBase] = None): def common(cls, add: Optional[List[EnumBase]] = None, remove: Optional[List[EnumBase]] = None):
p = [part for part in (add or []) + DEFAULT_CAR_PARTS if part not in (remove or [])] p = [part for part in (add or []) + DEFAULT_CAR_PARTS if part not in (remove or [])]
return cls(p) return cls(p)

@ -206,8 +206,8 @@ class Controls:
if REPLAY: if REPLAY:
controls_state = Params().get("ReplayControlsState") controls_state = Params().get("ReplayControlsState")
if controls_state is not None: if controls_state is not None:
controls_state = log.ControlsState.from_bytes(controls_state) with log.ControlsState.from_bytes(controls_state) as controls_state:
self.v_cruise_helper.v_cruise_kph = controls_state.vCruise self.v_cruise_helper.v_cruise_kph = controls_state.vCruise
if any(ps.controlsAllowed for ps in self.sm['pandaStates']): if any(ps.controlsAllowed for ps in self.sm['pandaStates']):
self.state = State.enabled self.state = State.enabled

@ -32,7 +32,8 @@ def plannerd_thread(sm=None, pm=None):
cloudlog.info("plannerd is waiting for CarParams") cloudlog.info("plannerd is waiting for CarParams")
params = Params() params = Params()
CP = car.CarParams.from_bytes(params.get("CarParams", block=True)) with car.CarParams.from_bytes(params.get("CarParams", block=True)) as msg:
CP = msg
cloudlog.info("plannerd got CarParams: %s", CP.carName) cloudlog.info("plannerd got CarParams: %s", CP.carName)
debug_mode = bool(int(os.getenv("DEBUG", "0"))) debug_mode = bool(int(os.getenv("DEBUG", "0")))

@ -282,7 +282,8 @@ def radard_thread(sm: Optional[messaging.SubMaster] = None, pm: Optional[messagi
# wait for stats about the car to come in from controls # wait for stats about the car to come in from controls
cloudlog.info("radard is waiting for CarParams") cloudlog.info("radard is waiting for CarParams")
CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) with car.CarParams.from_bytes(Params().get("CarParams", block=True)) as msg:
CP = msg
cloudlog.info("radard got CarParams") cloudlog.info("radard got CarParams")
# import the radar from the fingerprint # import the radar from the fingerprint
@ -317,7 +318,7 @@ def radard_thread(sm: Optional[messaging.SubMaster] = None, pm: Optional[messagi
rk.monitor_time() rk.monitor_time()
def main(sm: messaging.SubMaster = None, pm: messaging.PubMaster = None, can_sock: messaging.SubSocket = None): def main(sm: Optional[messaging.SubMaster] = None, pm: Optional[messaging.PubMaster] = None, can_sock: messaging.SubSocket = None):
radard_thread(sm, pm, can_sock) radard_thread(sm, pm, can_sock)

@ -41,7 +41,8 @@ if __name__ == "__main__":
polld = poller.poll(100) polld = poller.poll(100)
for sock in polld: for sock in polld:
msg = sock.receive() msg = sock.receive()
evt = log.Event.from_bytes(msg) with log.Event.from_bytes(msg) as log_evt:
evt = log_evt
if not args.no_print: if not args.no_print:
if args.pipe: if args.pipe:

@ -34,7 +34,8 @@ if __name__ == "__main__":
polld = poller.poll(1000) polld = poller.poll(1000)
for sock in polld: for sock in polld:
msg = sock.receive() msg = sock.receive()
evt = log.Event.from_bytes(msg) with log.Event.from_bytes(msg) as log_evt:
evt = log_evt
for item in evt.can: for item in evt.can:
if item.address == 0xe4 and item.src == 128: if item.address == 0xe4 and item.src == 128:

@ -25,7 +25,7 @@ if __name__ == "__main__":
# Remove message generated by the process under test and merge in the new messages # Remove message generated by the process under test and merge in the new messages
produces = {o.which() for o in outputs} produces = {o.which() for o in outputs}
inputs = [i for i in inputs if i.which() not in produces] inputs = [i for i in inputs if i.which() not in produces]
outputs = sorted(inputs + outputs, key=lambda x: x.logMonoTime) # type: ignore outputs = sorted(inputs + outputs, key=lambda x: x.logMonoTime)
fn = f"{args.route}_{args.process}.bz2" fn = f"{args.route}_{args.process}.bz2"
save_log(fn, outputs) save_log(fn, outputs)

@ -73,11 +73,11 @@ class Calibrator:
if param_put and calibration_params: if param_put and calibration_params:
try: try:
msg = log.Event.from_bytes(calibration_params) with log.Event.from_bytes(calibration_params) as msg:
rpy_init = np.array(msg.liveCalibration.rpyCalib) rpy_init = np.array(msg.liveCalibration.rpyCalib)
valid_blocks = msg.liveCalibration.validBlocks valid_blocks = msg.liveCalibration.validBlocks
wide_from_device_euler = np.array(msg.liveCalibration.wideFromDeviceEuler) wide_from_device_euler = np.array(msg.liveCalibration.wideFromDeviceEuler)
height = np.array(msg.liveCalibration.height) height = np.array(msg.liveCalibration.height)
except Exception: except Exception:
cloudlog.exception("Error reading cached CalibrationParams") cloudlog.exception("Error reading cached CalibrationParams")

@ -116,9 +116,9 @@ class Laikad:
nav_dict = {} nav_dict = {}
try: try:
ephem_cache = ephemeris_structs.EphemerisCache.from_bytes(cache_bytes) with ephemeris_structs.EphemerisCache.from_bytes(cache_bytes) as ephem_cache:
glonass_navs = [GLONASSEphemeris(data_struct, file_name=EPHEMERIS_CACHE) for data_struct in ephem_cache.glonassEphemerides] glonass_navs = [GLONASSEphemeris(data_struct, file_name=EPHEMERIS_CACHE) for data_struct in ephem_cache.glonassEphemerides]
gps_navs = [GPSEphemeris(data_struct, file_name=EPHEMERIS_CACHE) for data_struct in ephem_cache.gpsEphemerides] gps_navs = [GPSEphemeris(data_struct, file_name=EPHEMERIS_CACHE) for data_struct in ephem_cache.gpsEphemerides]
for e in sum([glonass_navs, gps_navs], []): for e in sum([glonass_navs, gps_navs], []):
if e.prn not in nav_dict: if e.prn not in nav_dict:
nav_dict[e.prn] = [] nav_dict[e.prn] = []

@ -129,7 +129,8 @@ def main(sm=None, pm=None):
params_reader = Params() params_reader = Params()
# wait for stats about the car to come in from controls # wait for stats about the car to come in from controls
cloudlog.info("paramsd is waiting for CarParams") cloudlog.info("paramsd is waiting for CarParams")
CP = car.CarParams.from_bytes(params_reader.get("CarParams", block=True)) with car.CarParams.from_bytes(params_reader.get("CarParams", block=True)) as msg:
CP = msg
cloudlog.info("paramsd got CarParams") cloudlog.info("paramsd got CarParams")
min_sr, max_sr = 0.5 * CP.steerRatio, 2.0 * CP.steerRatio min_sr, max_sr = 0.5 * CP.steerRatio, 2.0 * CP.steerRatio

@ -40,7 +40,8 @@ void localizer_handle_msg_bytes(Localizer_t localizer, const char *data, size_t
def localizer_get_msg(self, t=0, inputsOK=True, sensorsOK=True, gpsOK=True, msgValid=True): def localizer_get_msg(self, t=0, inputsOK=True, sensorsOK=True, gpsOK=True, msgValid=True):
self.lib.localizer_get_message_bytes(self.localizer, inputsOK, sensorsOK, gpsOK, msgValid, self.ffi.addressof(self.msg_buff, 0), self.buff_size) self.lib.localizer_get_message_bytes(self.localizer, inputsOK, sensorsOK, gpsOK, msgValid, self.ffi.addressof(self.msg_buff, 0), self.buff_size)
return log.Event.from_bytes(self.ffi.buffer(self.msg_buff), nesting_limit=self.buff_size // 8) with log.Event.from_bytes(self.ffi.buffer(self.msg_buff), nesting_limit=self.buff_size // 8) as log_evt:
return log_evt
def test_liblocalizer(self): def test_liblocalizer(self):
msg = messaging.new_message('liveCalibration') msg = messaging.new_message('liveCalibration')

@ -139,8 +139,10 @@ class TorqueEstimator:
torque_cache = params.get("LiveTorqueParameters") torque_cache = params.get("LiveTorqueParameters")
if params_cache is not None and torque_cache is not None: if params_cache is not None and torque_cache is not None:
try: try:
cache_ltp = log.Event.from_bytes(torque_cache).liveTorqueParameters with log.Event.from_bytes(torque_cache).liveTorqueParameters as log_evt:
cache_CP = car.CarParams.from_bytes(params_cache) cache_ltp = log_evt
with car.CarParams.from_bytes(params_cache) as msg:
cache_CP = msg
if self.get_restore_key(cache_CP, cache_ltp.version) == self.get_restore_key(CP, VERSION): if self.get_restore_key(cache_CP, cache_ltp.version) == self.get_restore_key(CP, VERSION):
if cache_ltp.liveValid: if cache_ltp.liveValid:
initial_params = { initial_params = {
@ -262,7 +264,8 @@ def main(sm=None, pm=None):
pm = messaging.PubMaster(['liveTorqueParameters']) pm = messaging.PubMaster(['liveTorqueParameters'])
params = Params() params = Params()
CP = car.CarParams.from_bytes(params.get("CarParams", block=True)) with car.CarParams.from_bytes(params.get("CarParams", block=True)) as CP:
estimator = TorqueEstimator(CP)
estimator = TorqueEstimator(CP) estimator = TorqueEstimator(CP)
def cache_params(sig, frame): def cache_params(sig, frame):

@ -7,7 +7,7 @@ from typing import List, Optional
from common.params import Params from common.params import Params
class OpenpilotPrefix(object): class OpenpilotPrefix(object):
def __init__(self, prefix: str = None, clean_dirs_on_exit: bool = True): def __init__(self, prefix: Optional[str] = None, clean_dirs_on_exit: bool = True):
self.prefix = prefix if prefix else str(uuid.uuid4()) self.prefix = prefix if prefix else str(uuid.uuid4())
self.msgq_path = os.path.join('/dev/shm', self.prefix) self.msgq_path = os.path.join('/dev/shm', self.prefix)
self.clean_dirs_on_exit = clean_dirs_on_exit self.clean_dirs_on_exit = clean_dirs_on_exit

@ -1,19 +1,19 @@
[ [
{ {
"name": "boot", "name": "boot",
"url": "https://commadist.azureedge.net/agnosupdate/boot-7d953f5e1bc606984e4d49c6f957421a4172f72b4ebd359baa689ef43b7e911c.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/boot-8d8d8620de8b2687f3a8fffdb81b2abd1fe2ead5bc831361a1a212e5589ac279.img.xz",
"hash": "7d953f5e1bc606984e4d49c6f957421a4172f72b4ebd359baa689ef43b7e911c", "hash": "8d8d8620de8b2687f3a8fffdb81b2abd1fe2ead5bc831361a1a212e5589ac279",
"hash_raw": "7d953f5e1bc606984e4d49c6f957421a4172f72b4ebd359baa689ef43b7e911c", "hash_raw": "8d8d8620de8b2687f3a8fffdb81b2abd1fe2ead5bc831361a1a212e5589ac279",
"size": 15153152, "size": 15636480,
"sparse": false, "sparse": false,
"full_check": true, "full_check": true,
"has_ab": true "has_ab": true
}, },
{ {
"name": "abl", "name": "abl",
"url": "https://commadist.azureedge.net/agnosupdate/abl-50329ac734ff7a6c20c3f552dce9b13f84b3eb2e73faa64b9810049d9b406602.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/abl-0084fcf79fea067632a1c2d9519b6445ad484aa8b09f49f22e6b45b4dccacd2d.img.xz",
"hash": "50329ac734ff7a6c20c3f552dce9b13f84b3eb2e73faa64b9810049d9b406602", "hash": "0084fcf79fea067632a1c2d9519b6445ad484aa8b09f49f22e6b45b4dccacd2d",
"hash_raw": "50329ac734ff7a6c20c3f552dce9b13f84b3eb2e73faa64b9810049d9b406602", "hash_raw": "0084fcf79fea067632a1c2d9519b6445ad484aa8b09f49f22e6b45b4dccacd2d",
"size": 274432, "size": 274432,
"sparse": false, "sparse": false,
"full_check": true, "full_check": true,
@ -21,9 +21,9 @@
}, },
{ {
"name": "xbl", "name": "xbl",
"url": "https://commadist.azureedge.net/agnosupdate/xbl-dc297986b38f50c47584bd8549b188b37b1d6a0c77b3255859dd675c177b5c15.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/xbl-942b9b2914d89c2a70fdf27380b59e04b549ac2fd53ecb29d6549d1a9c8daeaa.img.xz",
"hash": "dc297986b38f50c47584bd8549b188b37b1d6a0c77b3255859dd675c177b5c15", "hash": "942b9b2914d89c2a70fdf27380b59e04b549ac2fd53ecb29d6549d1a9c8daeaa",
"hash_raw": "dc297986b38f50c47584bd8549b188b37b1d6a0c77b3255859dd675c177b5c15", "hash_raw": "942b9b2914d89c2a70fdf27380b59e04b549ac2fd53ecb29d6549d1a9c8daeaa",
"size": 3282672, "size": 3282672,
"sparse": false, "sparse": false,
"full_check": true, "full_check": true,
@ -31,9 +31,9 @@
}, },
{ {
"name": "xbl_config", "name": "xbl_config",
"url": "https://commadist.azureedge.net/agnosupdate/xbl_config-b73fbbb42934aabc6d4f16ce84ac6c8c0205bc70e0a85412a771f3cc1d62cc40.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/xbl_config-6881d94599f65d94c13bcc0bd860184dfba2dfe96ec776d08fb35ac5b5f85bbf.img.xz",
"hash": "b73fbbb42934aabc6d4f16ce84ac6c8c0205bc70e0a85412a771f3cc1d62cc40", "hash": "6881d94599f65d94c13bcc0bd860184dfba2dfe96ec776d08fb35ac5b5f85bbf",
"hash_raw": "b73fbbb42934aabc6d4f16ce84ac6c8c0205bc70e0a85412a771f3cc1d62cc40", "hash_raw": "6881d94599f65d94c13bcc0bd860184dfba2dfe96ec776d08fb35ac5b5f85bbf",
"size": 98124, "size": 98124,
"sparse": false, "sparse": false,
"full_check": true, "full_check": true,
@ -41,9 +41,9 @@
}, },
{ {
"name": "devcfg", "name": "devcfg",
"url": "https://commadist.azureedge.net/agnosupdate/devcfg-2d3063d106813006ac9ceeaf8818a31d4b33996873e81178ac5129f5e1b82bca.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/devcfg-9bbf168baff6101f4890c5c95c118e30813c2610cfb35b8e19e363f04a32a262.img.xz",
"hash": "2d3063d106813006ac9ceeaf8818a31d4b33996873e81178ac5129f5e1b82bca", "hash": "9bbf168baff6101f4890c5c95c118e30813c2610cfb35b8e19e363f04a32a262",
"hash_raw": "2d3063d106813006ac9ceeaf8818a31d4b33996873e81178ac5129f5e1b82bca", "hash_raw": "9bbf168baff6101f4890c5c95c118e30813c2610cfb35b8e19e363f04a32a262",
"size": 40336, "size": 40336,
"sparse": false, "sparse": false,
"full_check": true, "full_check": true,
@ -51,9 +51,9 @@
}, },
{ {
"name": "aop", "name": "aop",
"url": "https://commadist.azureedge.net/agnosupdate/aop-d69450d5438b3e5e2ba5b77db1ae49e1cf9cab17836f563aa57192b5b3a4ac3e.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/aop-c1d9d712980f6b2a4b12196597f4d1bf3fe4fec6c59edf29ae63ef21f11b8222.img.xz",
"hash": "d69450d5438b3e5e2ba5b77db1ae49e1cf9cab17836f563aa57192b5b3a4ac3e", "hash": "c1d9d712980f6b2a4b12196597f4d1bf3fe4fec6c59edf29ae63ef21f11b8222",
"hash_raw": "d69450d5438b3e5e2ba5b77db1ae49e1cf9cab17836f563aa57192b5b3a4ac3e", "hash_raw": "c1d9d712980f6b2a4b12196597f4d1bf3fe4fec6c59edf29ae63ef21f11b8222",
"size": 184364, "size": 184364,
"sparse": false, "sparse": false,
"full_check": true, "full_check": true,
@ -61,9 +61,9 @@
}, },
{ {
"name": "system", "name": "system",
"url": "https://commadist.azureedge.net/agnosupdate/system-4a8311dd591006e0c2a6f60060d6ef579ceec9b3d688e8438a9aef4e230ae028.img.xz", "url": "https://commadist.azureedge.net/agnosupdate/system-e1fa3018bce9bad01c6967e5e21f1141cf5c8f02d2edfaed51c738f74a32a432.img.xz",
"hash": "23c9f111f81fc3ee83f85016cb320e03a46aad6721a85e1b4a3f04b6a764e934", "hash": "611011f3e3f147bc24f371105a9dd3760ec11ba424c56d4a442a66b098c784c0",
"hash_raw": "4a8311dd591006e0c2a6f60060d6ef579ceec9b3d688e8438a9aef4e230ae028", "hash_raw": "e1fa3018bce9bad01c6967e5e21f1141cf5c8f02d2edfaed51c738f74a32a432",
"size": 10737418240, "size": 10737418240,
"sparse": true, "sparse": true,
"full_check": false, "full_check": false,

@ -56,7 +56,7 @@ if __name__ == "__main__":
pr_err /= len(car) pr_err /= len(car)
speed_err /= len(car) speed_err /= len(car)
print("avg psuedorange err %f avg speed err %f" % (pr_err, speed_err)) print("avg psuedorange err %f avg speed err %f" % (pr_err, speed_err))
for c in sorted(car, key=lambda x: abs(x[1] - x[3] - pr_err)): # type: ignore for c in sorted(car, key=lambda x: abs(x[1] - x[3] - pr_err)):
svid, ublox_psuedorange, ublox_speed, qcom_psuedorange, qcom_speed, cno = c svid, ublox_psuedorange, ublox_speed, qcom_psuedorange, qcom_speed, cno = c
print("svid: %3d pseudorange: %10.2f m speed: %8.2f m/s meas: %12.2f speed: %10.2f meas_err: %10.3f speed_err: %8.3f cno: %d" % print("svid: %3d pseudorange: %10.2f m speed: %8.2f m/s meas: %12.2f speed: %10.2f meas_err: %10.3f speed_err: %8.3f cno: %d" %
(svid, ublox_psuedorange, ublox_speed, qcom_psuedorange, qcom_speed, (svid, ublox_psuedorange, ublox_speed, qcom_psuedorange, qcom_speed,

Loading…
Cancel
Save