test_models: check consitency between panda and openpilot for velocity (#30750)

* sanity check on velocity

* import from there

* use raw

* just check last

* ignore body

* reduce tolerance and bump panda

* its not average anymore

* slightly higher tolerance
old-commit-hash: 1ca1cf3922
chrysler-long2
Justin Newberry 1 year ago committed by GitHub
parent b6bd062d44
commit ffae1ce377
  1. 2
      panda
  2. 6
      selfdrive/car/tests/test_models.py

@ -1 +1 @@
Subproject commit bb75afc84e4d33af1554ada81851547db648e33e
Subproject commit 7e2b312fa86e6cdfeba496f261407cb47cb005d1

@ -23,6 +23,7 @@ from openpilot.tools.lib.logreader import LogReader
from openpilot.tools.lib.route import Route, SegmentName, RouteName
from panda.tests.libpanda import libpanda_py
from panda.tests.safety.common import VEHICLE_SPEED_FACTOR
EventName = car.CarEvent.EventName
PandaType = log.PandaState.PandaType
@ -345,6 +346,11 @@ class TestCarModelBase(unittest.TestCase):
checks['brakePressed'] += brake_pressed != self.safety.get_brake_pressed_prev()
checks['regenBraking'] += CS.regenBraking != self.safety.get_regen_braking_prev()
# Verify that panda has the correct velocity for cars that use it (angle based cars)
if self.CP.steerControlType in [car.CarParams.SteerControlType.angle] and not self.CP.notCar:
panda_velocity = self.safety.get_vehicle_speed_last() / VEHICLE_SPEED_FACTOR
checks['vEgo'] += abs(panda_velocity - CS.vEgoRaw) > 0.2
if self.CP.pcmCruise:
# On most pcmCruise cars, openpilot's state is always tied to the PCM's cruise state.
# On Honda Nidec, we always engage on the rising edge of the PCM cruise state, but

Loading…
Cancel
Save