From 84968fe6b6f2d59dd77ff61fa75caf79748c01fe Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Mon, 12 Jan 2026 12:17:27 +0800 Subject: [PATCH] init --- opendbc_repo/opendbc/car/honda/carstate.py | 13 ++++++++----- opendbc_repo/opendbc/car/honda/fingerprints.py | 11 +++++++++++ opendbc_repo/opendbc/car/honda/interface.py | 6 +++++- opendbc_repo/opendbc/car/honda/values.py | 6 ++++++ .../opendbc/car/torque_data/substitute.toml | 1 + .../dbc/generator/honda/_steering_control_c.dbc | 17 +++++++++++++++++ .../dbc/generator/honda/_steering_sensors_c.dbc | 7 +++++++ .../generator/honda/honda_odyssey_twn_2018.dbc | 7 +++++++ 8 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 opendbc_repo/opendbc/dbc/generator/honda/_steering_control_c.dbc create mode 100644 opendbc_repo/opendbc/dbc/generator/honda/_steering_sensors_c.dbc create mode 100644 opendbc_repo/opendbc/dbc/generator/honda/honda_odyssey_twn_2018.dbc diff --git a/opendbc_repo/opendbc/car/honda/carstate.py b/opendbc_repo/opendbc/car/honda/carstate.py index 20bb3fc05..f1c46b856 100644 --- a/opendbc_repo/opendbc/car/honda/carstate.py +++ b/opendbc_repo/opendbc/car/honda/carstate.py @@ -48,6 +48,8 @@ class CarState(CarStateBase): # When available we use cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] to populate vEgoCluster # However, on cars without a digital speedometer this is not always present (HRV, FIT, CRV 2016, ILX and RDX) self.dash_speed_seen = False + self.is_metric = False + self.v_cruise_factor = 1. def update(self, can_parsers) -> structs.CarState: cp = can_parsers[Bus.pt] @@ -68,7 +70,7 @@ class CarState(CarStateBase): self.cruise_buttons = cp.vl["SCM_BUTTONS"]["CRUISE_BUTTONS"] # used for car hud message - self.is_metric = not cp.vl["CAR_SPEED"]["IMPERIAL_UNIT"] + self.is_metric = True if self.CP.carFingerprint in (CAR.HONDA_ODYSSEY_TWN) else not cp.vl["CAR_SPEED"]["IMPERIAL_UNIT"] self.v_cruise_factor = CV.MPH_TO_MS if self.dynamic_v_cruise_units and not self.is_metric else CV.KPH_TO_MS # ******************* parse out can ******************* @@ -127,10 +129,11 @@ class CarState(CarStateBase): ret.espDisabled = cp.vl["VSA_STATUS"]["ESP_DISABLED"] != 0 - self.dash_speed_seen = self.dash_speed_seen or cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] > 1e-3 - if self.dash_speed_seen: - conversion = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS - ret.vEgoCluster = cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] * conversion + if self.CP.carFingerprint not in (CAR.HONDA_ODYSSEY_TWN): + self.dash_speed_seen = self.dash_speed_seen or cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] > 1e-3 + if self.dash_speed_seen: + conversion = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS + ret.vEgoCluster = cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] * conversion ret.steeringAngleDeg = cp.vl["STEERING_SENSORS"]["STEER_ANGLE"] ret.steeringRateDeg = cp.vl["STEERING_SENSORS"]["STEER_ANGLE_RATE"] diff --git a/opendbc_repo/opendbc/car/honda/fingerprints.py b/opendbc_repo/opendbc/car/honda/fingerprints.py index 0133dca02..4d5a3ca35 100644 --- a/opendbc_repo/opendbc/car/honda/fingerprints.py +++ b/opendbc_repo/opendbc/car/honda/fingerprints.py @@ -577,6 +577,17 @@ FW_VERSIONS = { b'54008-THR-A020\x00\x00', ], }, + CAR.HONDA_ODYSSEY_TWN: { + (Ecu.eps, 0x18da30f1, None): [ + b'39990-T6A-J210\x00\x00', + ], + (Ecu.srs, 0x18da53f1, None): [ + b'77959-T6A-P110\x00\x00', + ], + (Ecu.fwdRadar, 0x18dab0f1, None): [ + b'36161-T6A-P040\x00\x00', + ], + }, CAR.HONDA_ODYSSEY_5G_MMR: { (Ecu.vsa, 0x18da28f1, None): [ b'57114-THR-A240\x00\x00', diff --git a/opendbc_repo/opendbc/car/honda/interface.py b/opendbc_repo/opendbc/car/honda/interface.py index bd3c61430..f08b39e8d 100755 --- a/opendbc_repo/opendbc/car/honda/interface.py +++ b/opendbc_repo/opendbc/car/honda/interface.py @@ -163,6 +163,10 @@ class CarInterface(CarInterfaceBase): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]] + elif candidate == CAR.HONDA_ODYSSEY_TWN: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.28], [0.08]] + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 32767], [0, 32767]] # TODO: determine if there is a dead zone at the top end + elif candidate in (CAR.HONDA_HRV, CAR.HONDA_HRV_3G): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] if candidate == CAR.HONDA_HRV: @@ -235,7 +239,7 @@ class CarInterface(CarInterfaceBase): # to a negative value, so it won't matter. Otherwise, add 0.5 mph margin to not # conflict with PCM acc ret.autoResumeSng = candidate in (HONDA_BOSCH | {CAR.HONDA_CIVIC}) - ret.minEnableSpeed = -1. if ret.autoResumeSng else 25.51 * CV.MPH_TO_MS + ret.minEnableSpeed = -1. #if ret.autoResumeSng else 25.51 * CV.MPH_TO_MS ret.steerLimitTimer = 0.8 ret.radarDelay = 0.1 diff --git a/opendbc_repo/opendbc/car/honda/values.py b/opendbc_repo/opendbc/car/honda/values.py index 4171a02e7..8680612a4 100644 --- a/opendbc_repo/opendbc/car/honda/values.py +++ b/opendbc_repo/opendbc/car/honda/values.py @@ -324,6 +324,12 @@ class CAR(Platforms): radar_dbc_dict('honda_odyssey_exl_2018_generated'), flags=HondaFlags.NIDEC_ALT_PCM_ACCEL | HondaFlags.HAS_ALL_DOOR_STATES, ) + HONDA_ODYSSEY_TWN = HondaNidecPlatformConfig( + [], + CarSpecs(mass=1865, wheelbase=2.9, steerRatio=14.35, centerToFrontRatio=0.44, tireStiffnessFactor=0.82), + radar_dbc_dict('honda_odyssey_twn_2018_generated'), + flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, + ) ACURA_RDX = HondaNidecPlatformConfig( [HondaCarDocs("Acura RDX 2016-18", "AcuraWatch Plus or Advance Package", min_steer_speed=12. * CV.MPH_TO_MS)], CarSpecs(mass=3925 * CV.LB_TO_KG, wheelbase=2.68, steerRatio=15.0, centerToFrontRatio=0.38, tireStiffnessFactor=0.444), # as spec diff --git a/opendbc_repo/opendbc/car/torque_data/substitute.toml b/opendbc_repo/opendbc/car/torque_data/substitute.toml index db26c1a01..678d4018d 100644 --- a/opendbc_repo/opendbc/car/torque_data/substitute.toml +++ b/opendbc_repo/opendbc/car/torque_data/substitute.toml @@ -51,6 +51,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HONDA_CRV_EU" = "HONDA_CRV" "HONDA_CIVIC_BOSCH_DIESEL" = "HONDA_CIVIC_BOSCH" "HONDA_E" = "HONDA_CIVIC_BOSCH" +"HONDA_ODYSSEY_TWN" = "HONDA_ODYSSEY" "BUICK_LACROSSE" = "CHEVROLET_VOLT" "BUICK_REGAL" = "CHEVROLET_VOLT" diff --git a/opendbc_repo/opendbc/dbc/generator/honda/_steering_control_c.dbc b/opendbc_repo/opendbc/dbc/generator/honda/_steering_control_c.dbc new file mode 100644 index 000000000..596d0e32a --- /dev/null +++ b/opendbc_repo/opendbc/dbc/generator/honda/_steering_control_c.dbc @@ -0,0 +1,17 @@ +BO_ 404 STEERING_CONTROL: 4 EON + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS + SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS + SG_ STEER_TORQUE : 7|16@0- (-1,0) [-32767|32767] "" EPS + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-2985|2985] "tbd" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON + SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + +VAL_ 399 STEER_STATUS 7 "permanent_fault" 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 1 "driver_steering" 0 "normal" ; diff --git a/opendbc_repo/opendbc/dbc/generator/honda/_steering_sensors_c.dbc b/opendbc_repo/opendbc/dbc/generator/honda/_steering_sensors_c.dbc new file mode 100644 index 000000000..8d70ac936 --- /dev/null +++ b/opendbc_repo/opendbc/dbc/generator/honda/_steering_sensors_c.dbc @@ -0,0 +1,7 @@ +CM_ "steer_angle_rate is negative vs _steering_sensors_b.dbc"; + +BO_ 342 STEERING_SENSORS: 6 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON diff --git a/opendbc_repo/opendbc/dbc/generator/honda/honda_odyssey_twn_2018.dbc b/opendbc_repo/opendbc/dbc/generator/honda/honda_odyssey_twn_2018.dbc new file mode 100644 index 000000000..4dc4ea5ca --- /dev/null +++ b/opendbc_repo/opendbc/dbc/generator/honda/honda_odyssey_twn_2018.dbc @@ -0,0 +1,7 @@ +CM_ "IMPORT _honda_common.dbc"; +CM_ "IMPORT _nidec_common.dbc"; +CM_ "IMPORT _lkas_hud_5byte.dbc"; +CM_ "IMPORT _nidec_scm_group_a.dbc"; +CM_ "IMPORT _steering_sensors_c.dbc"; +CM_ "IMPORT _steering_control_c.dbc"; +CM_ "IMPORT _gearbox_common.dbc";