Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honda: 2024 CR-V Hybrid Car Port #31527

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
55060f0
init 24 CR-V Hybrid
vanillagorillaa Feb 21, 2024
4efe5df
forgot
vanillagorillaa Feb 21, 2024
7e38eaa
small fixes
vanillagorillaa Feb 21, 2024
c447510
fix
vanillagorillaa Feb 21, 2024
7df3bff
missing
vanillagorillaa Feb 21, 2024
7b237e5
fixes and bump opendbc
vanillagorillaa Feb 21, 2024
3bdb3f6
fwdCamera fw version
vanillagorillaa Feb 21, 2024
9ef7efc
test route
vanillagorillaa Feb 22, 2024
c11a903
revert
vanillagorillaa Feb 26, 2024
7c778e7
revert opendbc changes
vanillagorillaa Feb 26, 2024
bcdd822
Merge branch 'commaai:master' into 24_CRV
vanillagorillaa Feb 26, 2024
5096490
add pilot dbc to release
vanillagorillaa Feb 26, 2024
77d5441
Merge branch 'master' into 24_CRV
vanillagorillaa Feb 29, 2024
75294fe
missed in rebase
vanillagorillaa Feb 29, 2024
9cdab76
force fingerprint
vanillagorillaa Mar 6, 2024
89ac0d4
fix?
vanillagorillaa Mar 6, 2024
1b3e387
Merge branch 'master' into 24_CRV
vanillagorillaa Mar 29, 2024
6616bbc
New name
vanillagorillaa Mar 29, 2024
cc8de17
missing
vanillagorillaa Mar 29, 2024
5f1cec9
honda
vanillagorillaa Mar 29, 2024
8edbf66
honda
vanillagorillaa Mar 29, 2024
93511b4
fixes
vanillagorillaa Mar 29, 2024
a84a921
new format
vanillagorillaa Mar 29, 2024
8b00cdd
to support no comma power
vanillagorillaa Mar 30, 2024
3d5e7f7
fixes
vanillagorillaa Mar 30, 2024
d67d93f
pass flag
vanillagorillaa Mar 30, 2024
4b24a40
Merge branch 'master' into 24_CRV
vanillagorillaa Apr 16, 2024
e2ae9f9
fix
vanillagorillaa Apr 28, 2024
3f6c434
Merge branch 'master' into 24_CRV
vanillagorillaa May 13, 2024
0294491
add more firmware
vanillagorillaa May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release/files_common
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ opendbc/honda_odyssey_extreme_edition_2018_china_can_generated.dbc
opendbc/honda_insight_ex_2019_can_generated.dbc
opendbc/acura_ilx_2016_nidec.dbc
opendbc/honda_civic_ex_2022_can_generated.dbc
opendbc/honda_pilot_2023_can_generated.dbc

opendbc/hyundai_canfd.dbc
opendbc/hyundai_kia_generic.dbc
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/honda/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_can_messages(CP, gearbox_msg):

# TODO: clean this up
if CP.carFingerprint in (CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CRV_HYBRID, CAR.HONDA_INSIGHT,
CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G):
CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G, CAR.HONDA_CRV_HYBRID_6G):
pass
elif CP.carFingerprint in (CAR.HONDA_ODYSSEY_CHN, CAR.HONDA_FREED, CAR.HONDA_HRV):
pass
Expand Down Expand Up @@ -126,7 +126,7 @@ def update(self, cp, cp_cam, cp_body):
ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5
# TODO: find a common signal across all cars
if self.CP.carFingerprint in (CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CRV_HYBRID, CAR.HONDA_INSIGHT,
CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G):
CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G, CAR.HONDA_CRV_HYBRID_6G):
ret.doorOpen = bool(cp.vl["SCM_FEEDBACK"]["DRIVERS_DOOR_OPEN"])
elif self.CP.carFingerprint in (CAR.HONDA_ODYSSEY_CHN, CAR.HONDA_FREED, CAR.HONDA_HRV):
ret.doorOpen = bool(cp.vl["SCM_BUTTONS"]["DRIVERS_DOOR_OPEN"])
Expand Down
9 changes: 9 additions & 0 deletions selfdrive/car/honda/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,4 +1140,13 @@
b'37805-64S-AA10\x00\x00',
],
},
CAR.HONDA_CRV_HYBRID_6G: {
(Ecu.fwdRadar, 0x18dab0f1, None): [
b'8S302-3D4-A050\x00\x00',
],
(Ecu.fwdCamera, 0x18dab5f1, None): [
b'8S102-3D4-A060\x00\x00',
b'8S102-3D4-A080\x00\x00',
],
},
}
13 changes: 9 additions & 4 deletions selfdrive/car/honda/hondacan.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car import CanBusBase
from openpilot.selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, CAR, CarControllerParams
from openpilot.selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_CANFD_CAR, CAR, CarControllerParams

# CAN bus layout with relay
# 0 = ACC-CAN - radar side
Expand All @@ -14,7 +14,7 @@ def __init__(self, CP=None, fingerprint=None) -> None:
# use fingerprint if specified
super().__init__(CP if fingerprint is None else None, fingerprint)

if CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS):
if CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS - HONDA_CANFD_CAR):
self._pt, self._radar = self.offset + 1, self.offset
else:
self._pt, self._radar = self.offset, self.offset + 1
Expand All @@ -34,7 +34,7 @@ def camera(self) -> int:

def get_lkas_cmd_bus(CAN, car_fingerprint, radar_disabled=False):
no_radar = car_fingerprint in HONDA_BOSCH_RADARLESS
if radar_disabled or no_radar:
if radar_disabled or no_radar or car_fingerprint in HONDA_CANFD_CAR:
# when radar is disabled, steering commands are sent directly to powertrain bus
return CAN.pt
# normally steering commands are sent to radar, which forwards them to powertrain bus
Expand All @@ -43,7 +43,7 @@ def get_lkas_cmd_bus(CAN, car_fingerprint, radar_disabled=False):

def get_cruise_speed_conversion(car_fingerprint: str, is_metric: bool) -> float:
# on certain cars, CRUISE_SPEED changes to imperial with car's unit setting
return CV.MPH_TO_MS if car_fingerprint in HONDA_BOSCH_RADARLESS and not is_metric else CV.KPH_TO_MS
return CV.MPH_TO_MS if car_fingerprint in (HONDA_BOSCH_RADARLESS | HONDA_CANFD_CAR) and not is_metric else CV.KPH_TO_MS


def create_brake_command(packer, CAN, apply_brake, pump_on, pcm_override, pcm_cancel_cmd, fcw, car_fingerprint, stock_brake):
Expand Down Expand Up @@ -179,6 +179,11 @@ def create_ui_commands(packer, CAN, CP, enabled, pcm_speed, hud, is_metric, acc_
# car likely needs to see LKAS_PROBLEM fall within a specific time frame, so forward from camera
lkas_hud_values['LKAS_PROBLEM'] = lkas_hud['LKAS_PROBLEM']

if CP.carFingerprint in HONDA_CANFD_CAR:
lkas_hud_values['LANE_LINES'] = 3
lkas_hud_values['SOLID_LANES'] = hud.lanes_visible
lkas_hud_values['DASHED_LANES'] = hud.lanes_visible

if not (CP.flags & HondaFlags.BOSCH_EXT_HUD):
lkas_hud_values['SET_ME_X48'] = 0x48

Expand Down
15 changes: 11 additions & 4 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from openpilot.common.numpy_fast import interp
from openpilot.selfdrive.car.honda.hondacan import CanBus
from openpilot.selfdrive.car.honda.values import CarControllerParams, CruiseButtons, CruiseSettings, HondaFlags, CAR, HONDA_BOSCH, \
HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_RADARLESS
HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_RADARLESS, HONDA_CANFD_CAR
from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.disable_ecu import disable_ecu
Expand Down Expand Up @@ -37,7 +37,14 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):

CAN = CanBus(ret, fingerprint)

if candidate in HONDA_BOSCH:
if candidate in HONDA_CANFD_CAR:
cfgs = [get_safety_config(car.CarParams.SafetyModel.hondaBosch)]
if CAN.pt >= 4:
cfgs.insert(0, get_safety_config(car.CarParams.SafetyModel.noOutput))
ret.safetyConfigs = cfgs
ret.radarUnavailable = True
ret.openpilotLongitudinalControl = False
elif candidate in HONDA_BOSCH:
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hondaBosch)]
ret.radarUnavailable = True
# Disable the radar and let openpilot control longitudinal
Expand Down Expand Up @@ -136,7 +143,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]]
ret.wheelSpeedFactor = 1.025

elif candidate == CAR.HONDA_CRV_HYBRID:
elif candidate in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CRV_HYBRID_6G):
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]]
ret.wheelSpeedFactor = 1.025
Expand Down Expand Up @@ -206,7 +213,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
if ret.openpilotLongitudinalControl and candidate in HONDA_BOSCH:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_BOSCH_LONG

if candidate in HONDA_BOSCH_RADARLESS:
if candidate in (HONDA_BOSCH_RADARLESS | HONDA_CANFD_CAR):
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_RADARLESS

# min speed to enable ACC. if car can do stop and go, then set enabling speed
Expand Down
14 changes: 12 additions & 2 deletions selfdrive/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class HondaFlags(IntFlag):
NIDEC_ALT_PCM_ACCEL = 32
NIDEC_ALT_SCM_MESSAGES = 64

CANFD_CAR = 128


# Car button codes
class CruiseButtons:
Expand Down Expand Up @@ -183,6 +185,13 @@ class CAR(Platforms):
CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
dbc_dict('acura_rdx_2020_can_generated', None),
)
HONDA_CRV_HYBRID_6G = HondaBoschPlatformConfig(
[HondaCarDocs("Honda CR-V Hybrid 2024", "All")],
# mass: mean of 4 models in kg, steerRatio: 12.3 is spec end-to-end
CarSpecs(mass=1667, wheelbase=2.66, steerRatio=16, centerToFrontRatio=0.41, tireStiffnessFactor=0.677),
dbc_dict('honda_pilot_2023_can_generated', None),
flags=HondaFlags.CANFD_CAR,
)

# Nidec Cars
ACURA_ILX = HondaNidecPlatformConfig(
Expand Down Expand Up @@ -300,9 +309,9 @@ class CAR(Platforms):
# We lose these ECUs without the comma power on these cars.
# Note that we still attempt to match with them when they are present
non_essential_ecus={
Ecu.eps: [CAR.ACURA_RDX_3G, CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_2022, CAR.HONDA_E, CAR.HONDA_HRV_3G],
Ecu.eps: [CAR.ACURA_RDX_3G, CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_2022, CAR.HONDA_E, CAR.HONDA_HRV_3G, CAR.HONDA_CRV_HYBRID_6G],
Ecu.vsa: [CAR.ACURA_RDX_3G, CAR.HONDA_ACCORD, CAR.HONDA_CIVIC, CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_2022, CAR.HONDA_CRV_5G, CAR.HONDA_CRV_HYBRID,
CAR.HONDA_E, CAR.HONDA_HRV_3G, CAR.HONDA_INSIGHT],
CAR.HONDA_E, CAR.HONDA_HRV_3G, CAR.HONDA_INSIGHT, CAR.HONDA_CRV_HYBRID_6G],
},
extra_ecus=[
(Ecu.combinationMeter, 0x18da60f1, None),
Expand All @@ -324,6 +333,7 @@ class CAR(Platforms):
HONDA_NIDEC_ALT_SCM_MESSAGES = CAR.with_flags(HondaFlags.NIDEC_ALT_SCM_MESSAGES)
HONDA_BOSCH = CAR.with_flags(HondaFlags.BOSCH)
HONDA_BOSCH_RADARLESS = CAR.with_flags(HondaFlags.BOSCH_RADARLESS)
HONDA_CANFD_CAR = CAR.with_flags(HondaFlags.CANFD_CAR)


DBC = CAR.create_dbc_map()
1 change: 1 addition & 0 deletions selfdrive/car/tests/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class CarTestRoute(NamedTuple):
CarTestRoute("54fd8451b3974762|2021-04-01--14-50-10", HONDA.HONDA_RIDGELINE),
CarTestRoute("2d5808fae0b38ac6|2021-09-01--17-14-11", HONDA.HONDA_E),
CarTestRoute("f44aa96ace22f34a|2021-12-22--06-22-31", HONDA.HONDA_CIVIC_2022),
CarTestRoute("197afc441c1f8c4f|2024-02-21--11-18-08", HONDA.HONDA_CRV_HYBRID_6G),

CarTestRoute("87d7f06ade479c2e|2023-09-11--23-30-11", HYUNDAI.HYUNDAI_AZERA_6TH_GEN),
CarTestRoute("66189dd8ec7b50e6|2023-09-20--07-02-12", HYUNDAI.HYUNDAI_AZERA_HEV_6TH_GEN),
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/torque_data/substitute.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
"HONDA_CIVIC_BOSCH_DIESEL" = "HONDA_CIVIC_BOSCH"
"HONDA_E" = "HONDA_CIVIC_BOSCH"
"HONDA_ODYSSEY_CHN" = "HONDA_ODYSSEY"
"HONDA_CRV_HYBRID_6G" = "HONDA_CRV_HYBRID"

"BUICK_LACROSSE" = "CHEVROLET_VOLT"
"BUICK_REGAL" = "CHEVROLET_VOLT"
Expand Down
Loading