From 67aec50b88cf1a65ae44940a4594d893a384bbc6 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 1 Oct 2020 13:16:51 -0700 Subject: [PATCH] Increase HKG torque limit (#2249) * increase hkg torque limit * update refs * bump panda --- panda | 2 +- selfdrive/car/hyundai/carcontroller.py | 6 ++++-- selfdrive/car/hyundai/values.py | 16 ++++++++++------ selfdrive/test/process_replay/ref_commit | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/panda b/panda index 09997428f3..9fb584b20c 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 09997428f3417c6eb137dffe1b7639455401efaa +Subproject commit 9fb584b20cbbee80aa3e4c98416da726dcd4c1f2 diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 5e309e4d2c..c47545ef22 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -43,11 +43,13 @@ class CarController(): self.steer_rate_limited = False self.last_resume_frame = 0 + self.p = SteerLimitParams(CP) + def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, visual_alert, left_lane, right_lane, left_lane_depart, right_lane_depart): # Steering Torque - new_steer = actuators.steer * SteerLimitParams.STEER_MAX - apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, SteerLimitParams) + new_steer = actuators.steer * self.p.STEER_MAX + apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.p) self.steer_rate_limited = new_steer != apply_steer # disable if steer angle reach 90 deg, otherwise mdps fault in some models diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 9a39cb8f31..c36ecbd96e 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -6,12 +6,16 @@ Ecu = car.CarParams.Ecu # Steer torque limits class SteerLimitParams: - STEER_MAX = 255 # 409 is the max, 255 is stock - STEER_DELTA_UP = 3 - STEER_DELTA_DOWN = 7 - STEER_DRIVER_ALLOWANCE = 50 - STEER_DRIVER_MULTIPLIER = 2 - STEER_DRIVER_FACTOR = 1 + def __init__(self, CP): + if CP.carFingerprint in [CAR.SONATA, CAR.PALISADE]: + self.STEER_MAX = 384 + else: + self.STEER_MAX = 255 + self.STEER_DELTA_UP = 3 + self.STEER_DELTA_DOWN = 7 + self.STEER_DRIVER_ALLOWANCE = 50 + self.STEER_DRIVER_MULTIPLIER = 2 + self.STEER_DRIVER_FACTOR = 1 class CAR: diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 8bf71acfd2..5ad9a65ade 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -45b676ebf79e402b5482b5fbadcc8147fdb8a1f8 \ No newline at end of file +eaa9ac421abee09dfc2bac3b85423d3980f6e67b \ No newline at end of file