From 6de434f2ecee89e86c011bece57cb205c4c047e3 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 19 Apr 2022 23:18:01 -0700 Subject: [PATCH] Honda: do same standstill check as panda (#24262) * check standstill against panda * use XMISSION_SPEED for all, and compare to 0 * fix * only check for Honda for now * update comment * update refs * update refs and update check * phantom commit --- selfdrive/car/honda/carstate.py | 12 ++++-------- selfdrive/car/tests/test_models.py | 2 ++ selfdrive/test/process_replay/ref_commit | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 31a641e90d..5314fe375e 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -181,18 +181,14 @@ class CarState(CarStateBase): self.prev_cruise_setting = self.cruise_setting # ******************* parse out can ******************* - # TODO: find wheels moving bit in dbc + # STANDSTILL->WHEELS_MOVING bit can be noisy around zero, so use XMISSION_SPEED + # panda checks if the signal is non-zero + ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5 if self.CP.carFingerprint in (CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E): - ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 0.1 ret.doorOpen = bool(cp.vl["SCM_FEEDBACK"]["DRIVERS_DOOR_OPEN"]) - elif self.CP.carFingerprint == CAR.ODYSSEY_CHN: - ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 0.1 - ret.doorOpen = bool(cp.vl["SCM_BUTTONS"]["DRIVERS_DOOR_OPEN"]) - elif self.CP.carFingerprint in (CAR.FREED, CAR.HRV): - ret.standstill = not cp.vl["STANDSTILL"]["WHEELS_MOVING"] + elif self.CP.carFingerprint in (CAR.ODYSSEY_CHN, CAR.FREED, CAR.HRV): ret.doorOpen = bool(cp.vl["SCM_BUTTONS"]["DRIVERS_DOOR_OPEN"]) else: - ret.standstill = not cp.vl["STANDSTILL"]["WHEELS_MOVING"] ret.doorOpen = any([cp.vl["DOORS_STATUS"]["DOOR_OPEN_FL"], cp.vl["DOORS_STATUS"]["DOOR_OPEN_FR"], cp.vl["DOORS_STATUS"]["DOOR_OPEN_RL"], cp.vl["DOORS_STATUS"]["DOOR_OPEN_RR"]]) ret.seatbeltUnlatched = bool(cp.vl["SEATBELT_STATUS"]["SEATBELT_DRIVER_LAMP"] or not cp.vl["SEATBELT_STATUS"]["SEATBELT_DRIVER_LATCHED"]) diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index b9c36db07a..962778097d 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -245,6 +245,8 @@ class TestCarModel(unittest.TestCase): if self.CP.carName == "honda": checks['mainOn'] += CS.cruiseState.available != self.safety.get_acc_main_on() + # TODO: fix standstill mismatches for other makes + checks['standstill'] += CS.standstill == self.safety.get_vehicle_moving() CS_prev = CS diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index de9e404bdc..bd6c3befc0 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -185f5f9c8d878ad4b98664afc7147400476208cc \ No newline at end of file +ea48ff4478914b6aff56a979a647fe13b4993711 \ No newline at end of file