From 891cd9f12b715e838660068fb945c352a8e03bfb Mon Sep 17 00:00:00 2001 From: Irene <12470297+cydia2020@users.noreply.github.com> Date: Fri, 6 Sep 2024 20:00:52 +1000 Subject: [PATCH] Reapply "Move radar delay to carParams (#1224)" This reverts commit 10a4df2c7d27e5e0ee886a157700e112aa9eeca4. --- opendbc/car/honda/interface.py | 1 + opendbc/car/honda/radar_interface.py | 2 -- opendbc/car/interfaces.py | 1 - opendbc/car/structs.py | 1 + 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/opendbc/car/honda/interface.py b/opendbc/car/honda/interface.py index a13fb67db8..e54d804280 100755 --- a/opendbc/car/honda/interface.py +++ b/opendbc/car/honda/interface.py @@ -207,6 +207,7 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime ret.steerActuatorDelay = 0.1 ret.steerLimitTimer = 0.8 + ret.radarDelay = 0.1 return ret diff --git a/opendbc/car/honda/radar_interface.py b/opendbc/car/honda/radar_interface.py index a47cc70e7f..316838aa5d 100755 --- a/opendbc/car/honda/radar_interface.py +++ b/opendbc/car/honda/radar_interface.py @@ -20,8 +20,6 @@ def __init__(self, CP): self.radar_off_can = CP.radarUnavailable self.radar_ts = CP.radarTimeStep - self.delay = int(round(0.1 / CP.radarTimeStep)) # 0.1s delay of radar - # Nidec if self.radar_off_can: self.rcp = None diff --git a/opendbc/car/interfaces.py b/opendbc/car/interfaces.py index 2f0a47909f..39819e511c 100644 --- a/opendbc/car/interfaces.py +++ b/opendbc/car/interfaces.py @@ -261,7 +261,6 @@ def __init__(self, CP: structs.CarParams): self.CP = CP self.rcp = None self.pts: dict[int, structs.RadarData.RadarPoint] = {} - self.delay = 0 self.radar_ts = CP.radarTimeStep self.frame = 0 diff --git a/opendbc/car/structs.py b/opendbc/car/structs.py index bba40251ad..425b60c620 100644 --- a/opendbc/car/structs.py +++ b/opendbc/car/structs.py @@ -390,6 +390,7 @@ class LateralTorqueTuning: carFw: list['CarParams.CarFw'] = auto_field() radarTimeStep: float = 0.05 # time delta between radar updates, 20Hz is very standard + radarDelay: float = auto_field() fingerprintSource: 'CarParams.FingerprintSource' = field(default_factory=lambda: CarParams.FingerprintSource.can) # Where Panda/C2 is integrated into the car's CAN network networkLocation: 'CarParams.NetworkLocation' = field(default_factory=lambda: CarParams.NetworkLocation.fwdCamera)