From 94bba46d6d25478fc32b4b6c4e187264b0d49e4a Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Mon, 27 Apr 2020 15:28:34 -0700 Subject: [PATCH] Hyundai: use same gas pressed bit as in panda (#1428) * use same bit as in panda * remove lines * update ref * switch gas pedal signal --- selfdrive/car/hyundai/carstate.py | 15 +++++---------- selfdrive/test/process_replay/ref_commit | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index dcb5844c2c..12efefb4c5 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -54,13 +54,8 @@ class CarState(CarStateBase): ret.brakeLights = bool(cp.vl["TCS13"]['BrakeLight'] or ret.brakePressed) #TODO: find pedal signal for EV/HYBRID Cars - if (cp.vl["TCS13"]["DriverOverride"] == 0 and cp.vl["TCS13"]['ACC_REQ'] == 1): - pedal_gas = 0 - else: - pedal_gas = cp.vl["EMS12"]['TPS'] - - ret.gasPressed = pedal_gas > 1e-3 - ret.gas = pedal_gas + ret.gas = cp.vl["EMS12"]['PV_AV_CAN'] / 100 + ret.gasPressed = bool(cp.vl["EMS16"]["CF_Ems_AclAct"]) # TODO: refactor gear parsing in function # Gear Selection via Cluster - For those Kia/Hyundai which are not fully discovered, we can use the Cluster Indicator for Gear Selection, as this seems to be standard over all cars, but is not the preferred method. @@ -163,10 +158,8 @@ class CarState(CarStateBase): ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), - ("ACC_REQ", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), - ("DriverOverride", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), @@ -187,7 +180,8 @@ class CarState(CarStateBase): ("ACC_ObjDist", "SCC11", 0), ("ACCMode", "SCC12", 1), - ("TPS", "EMS12", 0), + ("PV_AV_CAN", "EMS12", 0), + ("CF_Ems_AclAct", "EMS16", 0), ] checks = [ @@ -204,6 +198,7 @@ class CarState(CarStateBase): ("SCC11", 50), ("SCC12", 50), ("EMS12", 100), + ("EMS16", 100), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index d5b9592f0c..f342be5330 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -6ac6d827e466d5c8cfc7c0bafb2cd62acea00645 \ No newline at end of file +783699128dfaeae66ecfd6ecd57ee19fe6d6e116 \ No newline at end of file