Hyundai longitudinal: Parse lead info for camera-based SCC platforms (#809)

* Hyundai longitudinal: Parse lead info for camera-based SCC platforms

* fix

* update

* bump

* update tests

* lol why is this here

* bump

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com>
This commit is contained in:
Jason Wen
2025-04-12 12:22:42 -04:00
committed by GitHub
parent f1d703e6e4
commit 43eefed514
2 changed files with 4 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ from openpilot.common.swaglog import cloudlog
from openpilot.common.simple_kalman import KF1D
from opendbc.car import structs
from opendbc.car.hyundai.values import HyundaiFlags
from opendbc.sunnypilot.car.hyundai.values import HyundaiFlagsSP
@@ -188,7 +189,8 @@ def get_lead(v_ego: float, ready: bool, tracks: dict[int, Track], lead_msg: capn
def get_custom_yrel(CP: structs.CarParams, CP_SP: structs.CarParamsSP, lead_dict: dict[str, Any],
lead_msg: capnp._DynamicStructReader) -> dict[str, Any]:
if CP.brand == "hyundai" and CP_SP.flags & HyundaiFlagsSP.ENHANCED_SCC:
if CP.brand == "hyundai" and (CP_SP.flags & HyundaiFlagsSP.ENHANCED_SCC or
CP.flags & (HyundaiFlags.CANFD_CAMERA_SCC | HyundaiFlags.CAMERA_SCC)):
lead_dict['yRel'] = float(-lead_msg.y[0])
return lead_dict