From b2196a160fc75318619604e4dbd0263b9c413cfb Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 27 May 2022 18:12:18 -0700 Subject: [PATCH] Hyundai longitudinal: display lead on HUD (#24667) * use leadVisible * add comment old-commit-hash: 5c5bb0be1197408ade793b49d731571ba831283a --- selfdrive/car/hyundai/carcontroller.py | 5 ++--- selfdrive/car/hyundai/hyundaican.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 170624737d..fb3579464a 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -114,11 +114,10 @@ class CarController: accel = clip(accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX) - lead_visible = False stopping = actuators.longControlState == LongCtrlState.stopping set_speed_in_units = hud_control.setSpeed * (CV.MS_TO_MPH if CS.clu11["CF_Clu_SPEED_UNIT"] == 1 else CV.MS_TO_KPH) - can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled, accel, jerk, int(self.frame / 2), lead_visible, - set_speed_in_units, stopping, CS.out.gasPressed)) + can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled, accel, jerk, int(self.frame / 2), + hud_control.leadVisible, set_speed_in_units, stopping, CS.out.gasPressed)) self.accel = accel # 20 Hz LFA MFA message diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index d03eb135fc..53499053e0 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -86,8 +86,8 @@ def create_acc_commands(packer, enabled, accel, jerk, idx, lead_visible, set_spe "TauGapSet": 4, "VSetDis": set_speed if enabled else 0, "AliveCounterACC": idx % 0x10, - "ObjValid": 1 if lead_visible else 0, - "ACC_ObjStatus": 1 if lead_visible else 0, + "ObjValid": 0, # TODO: these two bits may allow for better longitudinal control + "ACC_ObjStatus": 0, "ACC_ObjLatPos": 0, "ACC_ObjRelSpd": 0, "ACC_ObjDist": 0,