Toyota: resolve controls mismatch due to interceptor thresholds (#23710)

* remove gas interceptor exception

* panda

* bump submodules

* bump panda

* forgot carstate change

* revert

* add test route

* bump

* update refs for CS.gas

* bump submodules to master
old-commit-hash: 17cb65c4b7
taco
Shane Smiskol 3 years ago committed by GitHub
parent b872fe92ab
commit d82173e685
  1. 2
      opendbc
  2. 2
      panda
  3. 1
      selfdrive/car/tests/routes.py
  4. 9
      selfdrive/car/tests/test_models.py
  5. 4
      selfdrive/car/toyota/carstate.py
  6. 2
      selfdrive/test/process_replay/ref_commit

@ -1 +1 @@
Subproject commit 9f3902657df4ff2d359d6c1686d7c008d27b7c7a
Subproject commit e19ba095c3ee288d629284e24ec7e0deaf645f3f

@ -1 +1 @@
Subproject commit c925407461e46adf3282494af6daa00b2626ebb8
Subproject commit a1d97f9a0b33c4574b0e94a3c78c5a886cc95faa

@ -209,6 +209,7 @@ routes = [
# Segments that test specific issues
# Controls mismatch due to interceptor threshold
TestRoute("cfb32f0fb91b173b|2022-04-06--14-54-45", HONDA.CIVIC, segment=21),
TestRoute("5a8762b91fc70467|2022-04-14--21-26-20", TOYOTA.RAV4, segment=2),
# Controls mismatch due to standstill threshold
TestRoute("bec2dcfde6a64235|2022-04-08--14-21-32", HONDA.CRV_HYBRID, segment=22),
]

@ -209,13 +209,7 @@ class TestCarModel(unittest.TestCase):
# TODO: check rest of panda's carstate (steering, ACC main on, etc.)
# TODO: make the interceptor thresholds in openpilot and panda match, then remove this exception
gas_pressed = CS.gasPressed
if self.CP.enableGasInterceptor and gas_pressed and not self.safety.get_gas_pressed_prev():
# panda intentionally has a higher threshold
if self.CP.carName == "toyota" and 15 < CS.gas < 15*1.5:
gas_pressed = False
checks['gasPressed'] += gas_pressed != self.safety.get_gas_pressed_prev()
checks['gasPressed'] += CS.gasPressed != self.safety.get_gas_pressed_prev()
# TODO: remove this exception once this mismatch is resolved
brake_pressed = CS.brakePressed
@ -257,5 +251,6 @@ class TestCarModel(unittest.TestCase):
failed_checks = {k: v for k, v in checks.items() if v > 0}
self.assertFalse(len(failed_checks), f"panda safety doesn't agree with openpilot: {failed_checks}")
if __name__ == "__main__":
unittest.main()

@ -36,8 +36,8 @@ class CarState(CarStateBase):
ret.brakePressed = cp.vl["BRAKE_MODULE"]["BRAKE_PRESSED"] != 0
ret.brakeHoldActive = cp.vl["ESP_CONTROL"]["BRAKE_HOLD_ACTIVE"] == 1
if self.CP.enableGasInterceptor:
ret.gas = (cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS"] + cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS2"]) / 2.
ret.gasPressed = ret.gas > 15
ret.gas = (cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS"] + cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS2"]) // 2
ret.gasPressed = ret.gas > 805
else:
# TODO: find a new, common signal
msg = "GAS_PEDAL_HYBRID" if (self.CP.flags & ToyotaFlags.HYBRID) else "GAS_PEDAL"

@ -1 +1 @@
a959650f3dac9aaa4d9438f3126f5c34d35b3c62
84bf66d9917e102f581279892d32a04c35fb4d87
Loading…
Cancel
Save