Skip to content

Commit

Permalink
Honda: Car Port for Accord 4-Cylinder 9th Generation (commaai#124)
Browse files Browse the repository at this point in the history
* Add 2016/2017 Accord 2.4L (Serial Steering V3)

* No longer used

* bump opendbc

* bump opendbc

* bump opendbc

* IDE

* unused

* small cleanup

* platform rename

* some more

* add to docs

* shorter name

* add to FCR

* update footnote

* Update CARS.md

* Update CARS.md

* bump opendbc

* Update footnote

* Update CARS.md

* Update CHANGELOGS.md

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
  • Loading branch information
mlocoteta and sunnyhaibin authored Jul 12, 2023
1 parent 1dfa7c0 commit ac9315f
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 89 deletions.
2 changes: 2 additions & 0 deletions CHANGELOGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ sunnypilot - 0.9.3.2 (2023-07-xx)
========================
* FIXED: Disallow torque lateral control for angle control platforms (e.g. Ford, Nissan, Tesla)
* Torque lateral control cannot be used by angle control platforms, and would cause a "Controls Unresponsive" error if Torque lateral control is enforced in settings
* Honda Accord 2016-17 support thanks to mlocoteta!
* Serial Steering hardware required. For more information, see https://github.com/mlocoteta/serialSteeringHardware

sunnypilot - 0.9.3.1 (2023-07-09)
========================
Expand Down
171 changes: 87 additions & 84 deletions docs/CARS.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion opendbc
9 changes: 6 additions & 3 deletions selfdrive/car/honda/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
from selfdrive.car.honda.hondacan import get_cruise_speed_conversion, get_pt_bus
from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL, HONDA_BOSCH_RADARLESS
from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL, HONDA_BOSCH_RADARLESS, SERIAL_STEERING
from selfdrive.car.interfaces import CarStateBase

TransmissionType = car.CarParams.TransmissionType
Expand Down Expand Up @@ -57,7 +57,7 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg):
("STEER_MOTOR_TORQUE", 0), # TODO: not on every car
]

if CP.carFingerprint == CAR.ODYSSEY_CHN:
if CP.carFingerprint in (SERIAL_STEERING | {CAR.ODYSSEY_CHN, }):
checks += [
("SCM_FEEDBACK", 25),
("SCM_BUTTONS", 50),
Expand Down Expand Up @@ -99,7 +99,7 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg):
signals += [("CRUISE_SPEED_PCM", "CRUISE"),
("CRUISE_SPEED_OFFSET", "CRUISE_PARAMS")]

if CP.carFingerprint == CAR.ODYSSEY_CHN:
if CP.carFingerprint in (SERIAL_STEERING | {CAR.ODYSSEY_CHN, }):
checks.append(("CRUISE_PARAMS", 10))
else:
checks.append(("CRUISE_PARAMS", 50))
Expand Down Expand Up @@ -343,6 +343,9 @@ def get_cam_can_parser(CP):
("STEERING_CONTROL", 100),
]

if CP.carFingerprint in SERIAL_STEERING:
checks = []

if CP.carFingerprint in HONDA_BOSCH_RADARLESS:
signals.append(("LKAS_PROBLEM", "LKAS_HUD"))
checks.append(("LKAS_HUD", 10))
Expand Down
14 changes: 14 additions & 0 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,20 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]]
tire_stiffness_factor = 0.677

elif candidate == CAR.ACCORD_NIDEC_4CYL:
ret.mass = 3279. * CV.LB_TO_KG + STD_CARGO_KG
ret.wheelbase = 2.75
ret.centerToFront = ret.wheelbase * 0.39
ret.steerRatio = 13.66 # 13.37 is spec
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 239], [0, 239]]
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.,20], [0.,20]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.4,0.3], [0,0]]
tire_stiffness_factor = 0.8467
ret.longitudinalTuning.kpBP = [0., 5., 35.]
ret.longitudinalTuning.kpV = [2.4, 1.6, 0.8]
ret.longitudinalTuning.kiBP = [0., 35.]
ret.longitudinalTuning.kiV = [0.2, 0.16]

elif candidate in (CAR.ODYSSEY, CAR.ODYSSEY_CHN):
ret.mass = 1900. + STD_CARGO_KG
ret.wheelbase = 3.00
Expand Down
30 changes: 29 additions & 1 deletion selfdrive/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class CruiseButtons:
class CAR:
ACCORD = "HONDA ACCORD 2018"
ACCORDH = "HONDA ACCORD HYBRID 2018"
ACCORD_NIDEC_4CYL = "HONDA ACCORD 4CYL 9TH GEN"
CIVIC = "HONDA CIVIC 2016"
CIVIC_BOSCH = "HONDA CIVIC (BOSCH) 2019"
CIVIC_BOSCH_DIESEL = "HONDA CIVIC SEDAN 1.6 DIESEL 2019"
Expand Down Expand Up @@ -103,6 +104,14 @@ class Footnote(Enum):
CIVIC_DIESEL = CarFootnote(
"2019 Honda Civic 1.6L Diesel Sedan does not have ALC below 12mph.",
Column.FSR_STEERING)
ACCORD_NIDEC = CarFootnote(
"openpilot operates above 25mph for 9th Generation Accord 4CYL, 6CYL and Hybrid which don't have Low-Speed Follow.",
Column.FSR_LONGITUDINAL)
SERIAL_STEERING = CarFootnote(
"9th Generation model-years have ALC data over serial lines and require third party hardware to " +
"interface with openpilot. For more information, " +
"see <a href=\"https://github.com/mlocoteta/serialSteeringHardware\" target=\"_blank\">mlocoteta's GitHub</a>.",
Column.HARDWARE)


@dataclass
Expand Down Expand Up @@ -153,6 +162,7 @@ def init_make(self, CP: car.CarParams):
CAR.INSIGHT: HondaCarInfo("Honda Insight 2019-22", "All", min_steer_speed=3. * CV.MPH_TO_MS),
CAR.HONDA_E: HondaCarInfo("Honda e 2020", "All", min_steer_speed=3. * CV.MPH_TO_MS),
CAR.CLARITY: HondaCarInfo("Honda Clarity 2018-22"),
CAR.ACCORD_NIDEC_4CYL: HondaCarInfo("Honda Accord 4-Cylinder 2016-17", footnotes=[Footnote.ACCORD_NIDEC, Footnote.SERIAL_STEERING], min_steer_speed=3. * CV.MPH_TO_MS),
}

HONDA_VERSION_REQUEST = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER]) + \
Expand Down Expand Up @@ -418,6 +428,20 @@ def init_make(self, CP: car.CarParams):
b'39990-TWB-H120\x00\x00',
],
},
CAR.ACCORD_NIDEC_4CYL: {
(Ecu.vsa, 0x18DA28F1, None): [
b'57114-T2F-X840\x00\x00',
],
(Ecu.fwdRadar, 0x18DAB0F1, None): [
b'36161-T2F-A140\x00\x00',
],
(Ecu.combinationMeter, 0x18DA60F1, None): [
b'78109-T2F-L110\x00\x00',
],
(Ecu.srs, 0x18DA53F1, None): [
b'77959-T2F-A030\x00\x00',
],
},
CAR.CIVIC: {
(Ecu.programmedFuelInjection, 0x18da10f1, None): [
b'37805-5AA-A640\x00\x00',
Expand Down Expand Up @@ -1584,6 +1608,7 @@ def init_make(self, CP: car.CarParams):
}

DBC = {
CAR.ACCORD_NIDEC_4CYL: dbc_dict('honda_accord_touring_2016_can_generated', 'acura_ilx_2016_nidec'),
CAR.ACCORD: dbc_dict('honda_accord_2018_can_generated', None),
CAR.ACCORDH: dbc_dict('honda_accord_2018_can_generated', None),
CAR.ACURA_ILX: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'),
Expand Down Expand Up @@ -1612,14 +1637,17 @@ def init_make(self, CP: car.CarParams):

STEER_THRESHOLD = {
# default is 1200, overrides go here
CAR.ACCORD_NIDEC_4CYL: 30,
CAR.ACURA_RDX: 400,
CAR.CRV_EU: 400,
}

HONDA_NIDEC_ALT_PCM_ACCEL = {CAR.ODYSSEY}
HONDA_NIDEC_ALT_SCM_MESSAGES = {CAR.ACURA_ILX, CAR.ACURA_RDX, CAR.CRV, CAR.CRV_EU, CAR.FIT, CAR.FREED, CAR.HRV, CAR.ODYSSEY_CHN,
CAR.PILOT, CAR.RIDGELINE}
CAR.PILOT, CAR.RIDGELINE, CAR.ACCORD_NIDEC_4CYL}
HONDA_BOSCH = {CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_5G,
CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.CIVIC_2022, CAR.HRV_3G}
HONDA_BOSCH_ALT_BRAKE_SIGNAL = {CAR.ACCORD, CAR.CRV_5G, CAR.ACURA_RDX_3G, CAR.HRV_3G}
HONDA_BOSCH_RADARLESS = {CAR.CIVIC_2022, CAR.HRV_3G}

SERIAL_STEERING = {CAR.ACCORD_NIDEC_4CYL, }
1 change: 1 addition & 0 deletions selfdrive/car/sunnypilot_carname.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"Genesis GV80 2023": "GENESIS GV80 2023",
"GMC Acadia 2018": "GMC ACADIA DENALI 2018",
"GMC Sierra 1500 2020-21": "CHEVROLET SILVERADO 1500 2020",
"Honda Accord 4-Cylinder 2016-17": "HONDA ACCORD 4CYL 9TH GEN",
"Honda Accord 2018-22": "HONDA ACCORD 2018",
"Honda Accord Hybrid 2018-22": "HONDA ACCORD HYBRID 2018",
"Honda Civic 2016-18": "HONDA CIVIC 2016",
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/torque_data/override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ KIA SORENTO 4TH GEN: [2.5, 2.5, 0.1]
KIA NIRO HYBRID 2ND GEN: [2.42, 2.5, 0.12]
KIA NIRO EV 2ND GEN: [2.05, 2.5, 0.14]
GENESIS GV80 2023: [2.5, 2.5, 0.1]
HONDA ACCORD 4CYL 9TH GEN: [1.7, 0.35, 0.21]

# Dashcam or fallback configured as ideal car
mock: [10.0, 10, 0.0]
Expand Down

0 comments on commit ac9315f

Please sign in to comment.