From 405826976296c46c34e0a377536e3416c6844e34 Mon Sep 17 00:00:00 2001 From: Brian Hanson Date: Sun, 26 Apr 2026 12:29:06 -0500 Subject: [PATCH] hyundai canfd: bump steer max 270->324 (~+20%), rate_up 2->3, rate_down 3->5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tucson (and other Hyundai CAN-FD HDA2 cars) get pinned to comma's conservative steer ceiling of 270 in the CAN-FD branch of selfdrive/car/hyundai/values.py and the matching panda safety limit HYUNDAI_CANFD_STEERING_LIMITS. Comma's non-CAN-FD HKG default is 384; PR commaai/openpilot#25723 merged 384 for HDA1 EV6/Ioniq 5 with operator quote "max steer needed to be 384 to make basic turns." Bumping to 324 (~+20%) keeps a safe margin under the proven 384 ceiling while giving enough headroom for moderate clover-style on-ramps without the controller hitting the limit. Rate limits also nudged up (2->3 up, 3->5 down) to match the slightly higher ceiling and reduce ramp time / release lag; chose 5 instead of comma's 7 for delta_down to keep release smoother. max_rt_delta scaled proportionally (112->134) so the 250ms real-time check tracks the new ceiling. Both files MUST stay in lockstep — panda safety enforces independently and would reject larger commands if only one side was bumped. Panda firmware re-flashes automatically on next pandad start because the safety code hash changed. References: https://github.com/commaai/openpilot/pull/25723 (HDA1 270->384) https://github.com/commaai/openpilot/issues/24122 (HKG torque blacklist) Co-Authored-By: Claude Opus 4.7 (1M context) --- panda/board/safety/safety_hyundai_canfd.h | 13 +++++++++---- selfdrive/car/hyundai/values.py | 8 +++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/panda/board/safety/safety_hyundai_canfd.h b/panda/board/safety/safety_hyundai_canfd.h index 1a1acdc..e82dc60 100755 --- a/panda/board/safety/safety_hyundai_canfd.h +++ b/panda/board/safety/safety_hyundai_canfd.h @@ -1,11 +1,16 @@ #include "safety_hyundai_common.h" const SteeringLimits HYUNDAI_CANFD_STEERING_LIMITS = { - .max_steer = 270, - .max_rt_delta = 112, + // CLEARPILOT: bumped from comma defaults (270/2/3/112) by ~20% so this Tucson HDA2 + // can hold modest curvature in place. Mirrors the rate-limit shape comma uses for + // its non-CAN-FD high-torque HKG default (384/3/7). Must stay in lockstep with + // STEER_MAX in selfdrive/car/hyundai/values.py — panda enforces independently and + // will reject larger commands if openpilot's value exceeds this. + .max_steer = 324, + .max_rt_delta = 134, .max_rt_interval = 250000, - .max_rate_up = 2, - .max_rate_down = 3, + .max_rate_up = 3, + .max_rate_down = 5, .driver_torque_allowance = 250, .driver_torque_factor = 2, .type = TorqueDriverLimited, diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 915a581..53f1850 100755 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -27,12 +27,14 @@ class CarControllerParams: self.STEER_STEP = 1 # 100 Hz if CP.carFingerprint in CANFD_CAR: - self.STEER_MAX = 270 + # CLEARPILOT: bumped from comma defaults (270/2/3) by ~20% — must stay in + # lockstep with HYUNDAI_CANFD_STEERING_LIMITS in panda/board/safety/safety_hyundai_canfd.h. + self.STEER_MAX = 324 self.STEER_DRIVER_ALLOWANCE = 250 self.STEER_DRIVER_MULTIPLIER = 2 self.STEER_THRESHOLD = 250 - self.STEER_DELTA_UP = 2 - self.STEER_DELTA_DOWN = 3 + self.STEER_DELTA_UP = 3 + self.STEER_DELTA_DOWN = 5 # To determine the limit for your car, find the maximum value that the stock LKAS will request. # If the max stock LKAS request is <384, add your car to this list.