From 47a55f3a14e3268f67adef4ef38f9191b4f5f277 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 18 Oct 2022 11:24:13 -0700 Subject: [PATCH] GM: match panda & ECM standstill checks (#26095) * gm: match panda standstill check * fix * needs to be <= 10 to avoid a fault, fix for safety tests * fix * fix * bump panda to master old-commit-hash: 826d8a8ae34bfd909535f5edff2229b8b2daf1a6 --- panda | 2 +- selfdrive/car/gm/carstate.py | 4 +++- selfdrive/car/tests/test_models.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/panda b/panda index 9ed3f75f67..b95a65df58 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 9ed3f75f67c3e5f00f910c8d7497ebed63851b5a +Subproject commit b95a65df58fea89b42b7c6b4fc85289b93a0bdb2 diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index b67b97093a..f531914877 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -8,6 +8,7 @@ from selfdrive.car.gm.values import DBC, AccState, CanBus, STEER_THRESHOLD TransmissionType = car.CarParams.TransmissionType NetworkLocation = car.CarParams.NetworkLocation +STANDSTILL_THRESHOLD = 10 * 0.0311 * CV.KPH_TO_MS class CarState(CarStateBase): @@ -39,7 +40,8 @@ class CarState(CarStateBase): ) ret.vEgoRaw = mean([ret.wheelSpeeds.fl, ret.wheelSpeeds.fr, ret.wheelSpeeds.rl, ret.wheelSpeeds.rr]) ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) - ret.standstill = ret.vEgoRaw < 0.01 + # sample rear wheel speeds, standstill=True if ECM allows engagement with brake + ret.standstill = ret.wheelSpeeds.rl <= STANDSTILL_THRESHOLD and ret.wheelSpeeds.rr <= STANDSTILL_THRESHOLD if pt_cp.vl["ECMPRDNL2"]["ManualMode"] == 1: ret.gearShifter = self.parse_gear_shifter("T") diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index bab9f859e6..e4e141153f 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -234,7 +234,7 @@ class TestCarModelBase(unittest.TestCase): checks['gasPressed'] += CS.gasPressed != self.safety.get_gas_pressed_prev() checks['cruiseState'] += CS.cruiseState.enabled and not CS.cruiseState.available - if self.CP.carName not in ("hyundai", "volkswagen", "gm", "body"): + if self.CP.carName not in ("hyundai", "volkswagen", "body"): # TODO: fix standstill mismatches for other makes checks['standstill'] += CS.standstill == self.safety.get_vehicle_moving()