From d82173e685b5fda752494e11fa97e836190325a7 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 20 Apr 2022 22:28:56 -0700 Subject: [PATCH] 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: 17cb65c4b75987e4fa6630a02f384e27f1472d13 --- opendbc | 2 +- panda | 2 +- selfdrive/car/tests/routes.py | 1 + selfdrive/car/tests/test_models.py | 9 ++------- selfdrive/car/toyota/carstate.py | 4 ++-- selfdrive/test/process_replay/ref_commit | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/opendbc b/opendbc index 9f3902657d..e19ba095c3 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 9f3902657df4ff2d359d6c1686d7c008d27b7c7a +Subproject commit e19ba095c3ee288d629284e24ec7e0deaf645f3f diff --git a/panda b/panda index c925407461..a1d97f9a0b 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit c925407461e46adf3282494af6daa00b2626ebb8 +Subproject commit a1d97f9a0b33c4574b0e94a3c78c5a886cc95faa diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py index b4c506424c..a26d6dcd04 100644 --- a/selfdrive/car/tests/routes.py +++ b/selfdrive/car/tests/routes.py @@ -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), ] diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index 962778097d..4368619926 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -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() diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index a951955505..dea4263d7e 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -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" diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index f5f36782f0..37276f85cc 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -a959650f3dac9aaa4d9438f3126f5c34d35b3c62 \ No newline at end of file +84bf66d9917e102f581279892d32a04c35fb4d87 \ No newline at end of file