CarParams: set no traversal limit (#32929)

* Increase traversal_limit_in_words to Fix Traversal Limit Errors

* just use log_from_bytes

* come on pycharm

* no free lunch

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 12d729a0a0
fix-exp-path
Dean Lee 10 months ago committed by GitHub
parent 7173d6f86a
commit 45c3992e43
  1. 4
      cereal/messaging/__init__.py
  2. 3
      selfdrive/controls/controlsd.py
  3. 3
      selfdrive/controls/plannerd.py
  4. 3
      selfdrive/controls/radard.py
  5. 6
      selfdrive/locationd/paramsd.py
  6. 3
      selfdrive/locationd/torqued.py
  7. 4
      selfdrive/modeld/modeld.py

@ -17,8 +17,8 @@ from cereal.services import SERVICE_LIST
NO_TRAVERSAL_LIMIT = 2**64-1 NO_TRAVERSAL_LIMIT = 2**64-1
def log_from_bytes(dat: bytes) -> capnp.lib.capnp._DynamicStructReader: def log_from_bytes(dat: bytes, struct: capnp.lib.capnp._StructModule = log.Event) -> capnp.lib.capnp._DynamicStructReader:
with log.Event.from_bytes(dat, traversal_limit_in_words=NO_TRAVERSAL_LIMIT) as msg: with struct.from_bytes(dat, traversal_limit_in_words=NO_TRAVERSAL_LIMIT) as msg:
return msg return msg

@ -64,8 +64,7 @@ class Controls:
if CI is None: if CI is None:
cloudlog.info("controlsd is waiting for CarParams") cloudlog.info("controlsd is waiting for CarParams")
with car.CarParams.from_bytes(self.params.get("CarParams", block=True)) as msg: self.CP = messaging.log_from_bytes(self.params.get("CarParams", block=True), car.CarParams)
self.CP = msg
cloudlog.info("controlsd got CarParams") cloudlog.info("controlsd got CarParams")
# Uses car interface helper functions, altering state won't be considered by card for actuation # Uses car interface helper functions, altering state won't be considered by card for actuation

@ -12,8 +12,7 @@ def plannerd_thread():
cloudlog.info("plannerd is waiting for CarParams") cloudlog.info("plannerd is waiting for CarParams")
params = Params() params = Params()
with car.CarParams.from_bytes(params.get("CarParams", block=True)) as msg: CP = messaging.log_from_bytes(params.get("CarParams", block=True), car.CarParams)
CP = msg
cloudlog.info("plannerd got CarParams: %s", CP.carName) cloudlog.info("plannerd got CarParams: %s", CP.carName)
longitudinal_planner = LongitudinalPlanner(CP) longitudinal_planner = LongitudinalPlanner(CP)

@ -288,8 +288,7 @@ def main():
# 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")
with car.CarParams.from_bytes(Params().get("CarParams", block=True)) as msg: CP = messaging.log_from_bytes(Params().get("CarParams", block=True), car.CarParams)
CP = msg
cloudlog.info("radard got CarParams") cloudlog.info("radard got CarParams")
# import the radar from the fingerprint # import the radar from the fingerprint

@ -5,8 +5,7 @@ import json
import numpy as np import numpy as np
import cereal.messaging as messaging import cereal.messaging as messaging
from cereal import car from cereal import car, log
from cereal import log
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, DT_MDL from openpilot.common.realtime import config_realtime_process, DT_MDL
from openpilot.common.numpy_fast import clip from openpilot.common.numpy_fast import clip
@ -129,8 +128,7 @@ def main():
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")
with car.CarParams.from_bytes(params_reader.get("CarParams", block=True)) as msg: CP = messaging.log_from_bytes(params_reader.get("CarParams", block=True), car.CarParams)
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

@ -223,8 +223,7 @@ def main(demo=False):
sm = messaging.SubMaster(['carControl', 'carOutput', 'carState', 'liveLocationKalman'], poll='liveLocationKalman') sm = messaging.SubMaster(['carControl', 'carOutput', 'carState', 'liveLocationKalman'], poll='liveLocationKalman')
params = Params() params = Params()
with car.CarParams.from_bytes(params.get("CarParams", block=True)) as CP: estimator = TorqueEstimator(messaging.log_from_bytes(params.get("CarParams", block=True), car.CarParams))
estimator = TorqueEstimator(CP)
while True: while True:
sm.update() sm.update()

@ -172,8 +172,8 @@ def main(demo=False):
if demo: if demo:
CP = get_demo_car_params() CP = get_demo_car_params()
else: else:
with car.CarParams.from_bytes(params.get("CarParams", block=True)) as msg: CP = messaging.log_from_bytes(params.get("CarParams", block=True), car.CarParams)
CP = msg
cloudlog.info("modeld got CarParams: %s", CP.carName) cloudlog.info("modeld got CarParams: %s", CP.carName)
# TODO this needs more thought, use .2s extra for now to estimate other delays # TODO this needs more thought, use .2s extra for now to estimate other delays

Loading…
Cancel
Save