Skip to content

Commit

Permalink
2018+ Accord Manual 1.5L/2.0L
Browse files Browse the repository at this point in the history
  • Loading branch information
csouers committed Jan 4, 2024
1 parent c6ad15e commit 93cb788
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
url = ../../commaai/panda.git url = ../../commaai/panda.git
[submodule "opendbc"] [submodule "opendbc"]
path = opendbc path = opendbc
url = ../../commaai/opendbc.git url = ../../csouers/opendbc.git
branch = accordmanual
[submodule "laika_repo"] [submodule "laika_repo"]
path = laika_repo path = laika_repo
url = ../../commaai/laika.git url = ../../commaai/laika.git
Expand Down
39 changes: 28 additions & 11 deletions selfdrive/car/honda/carstate.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ def get_can_messages(CP, gearbox_msg):
("SCM_BUTTONS", 25), ("SCM_BUTTONS", 25),
] ]


if CP.carFingerprint in (CAR.CRV_HYBRID, CAR.CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E):
messages.append((gearbox_msg, 50)) if CP.transmissionType != TransmissionType.manual:
if CP.carFingerprint in (CAR.CRV_HYBRID, CAR.CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E):
messages.append((gearbox_msg, 50))
else:
messages.append((gearbox_msg, 100))
else: else:
messages.append((gearbox_msg, 100)) messages.append(("GAS_PEDAL_2", 100))


if CP.carFingerprint in HONDA_BOSCH_ALT_BRAKE_SIGNAL: if CP.carFingerprint in HONDA_BOSCH_ALT_BRAKE_SIGNAL:
messages.append(("BRAKE_MODULE", 50)) messages.append(("BRAKE_MODULE", 50))
Expand Down Expand Up @@ -88,15 +92,16 @@ class CarState(CarStateBase):
def __init__(self, CP): def __init__(self, CP):
super().__init__(CP) super().__init__(CP)
can_define = CANDefine(DBC[CP.carFingerprint]["pt"]) can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
self.gearbox_msg = "GEARBOX"
if CP.carFingerprint == CAR.ACCORD and CP.transmissionType == TransmissionType.cvt:
self.gearbox_msg = "GEARBOX_15T"

self.main_on_sig_msg = "SCM_FEEDBACK" self.main_on_sig_msg = "SCM_FEEDBACK"
if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES:
self.main_on_sig_msg = "SCM_BUTTONS" self.main_on_sig_msg = "SCM_BUTTONS"

self.gearbox_msg = "GEARBOX"
self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"] if CP.carFingerprint == CAR.ACCORD and CP.transmissionType == TransmissionType.cvt:
self.gearbox_msg = "GEARBOX_15T"
if CP.carFingerprint == CAR.ACCORD and CP.transmissionType == TransmissionType.manual:
self.gearbox_msg = None
if self.gearbox_msg is not None:
self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"]
self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"]) self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"])


self.brake_switch_prev = False self.brake_switch_prev = False
Expand Down Expand Up @@ -188,8 +193,16 @@ def update(self, cp, cp_cam, cp_body):
if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN}): if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN}):
ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0 ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0


gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) if self.CP.transmissionType != TransmissionType.manual:
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None))
else:
if bool(cp.vl["GAS_PEDAL_2"]['NEUTRAL']):
ret.gearShifter = 'neutral'
elif bool(cp.vl["SCM_FEEDBACK"]['REVERSE']):
ret.gearShifter = 'reverse'
else:
ret.gearShifter = 'drive'


if self.CP.enableGasInterceptor: if self.CP.enableGasInterceptor:
# Same threshold as panda, equivalent to 1e-5 with previous DBC scaling # Same threshold as panda, equivalent to 1e-5 with previous DBC scaling
Expand Down Expand Up @@ -242,6 +255,10 @@ def update(self, cp, cp_cam, cp_body):
ret.brakePressed = True ret.brakePressed = True


if self.CP.carFingerprint in HONDA_BOSCH: if self.CP.carFingerprint in HONDA_BOSCH:
if self.CP.transmissionType == TransmissionType.manual:
ret.clutchPressed = bool(cp.vl["GAS_PEDAL_2"]["CLUTCH_MAIN"] or cp.vl["GAS_PEDAL_2"]["CLUTCH_ACC"])
else:
ret.clutchPressed = False
# TODO: find the radarless AEB_STATUS bit and make sure ACCEL_COMMAND is correct to enable AEB alerts # TODO: find the radarless AEB_STATUS bit and make sure ACCEL_COMMAND is correct to enable AEB alerts
if self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS: if self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS:
ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5) ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5)
Expand Down
10 changes: 8 additions & 2 deletions selfdrive/car/honda/interface.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
ret.flags |= HondaFlags.BOSCH_EXT_HUD.value ret.flags |= HondaFlags.BOSCH_EXT_HUD.value


# Accord 1.5T CVT has different gearbox message # Accord 1.5T CVT has different gearbox message
if candidate == CAR.ACCORD and 0x191 in fingerprint[1]: if candidate == CAR.ACCORD:
ret.transmissionType = TransmissionType.cvt if 0x191 in fingerprint[1]:
ret.transmissionType = TransmissionType.cvt
# Accord 2.0 and Hybrid
elif 0x1a3 in fingerprint[1]:
ret.transmissionType = TransmissionType.automatic
else:
ret.transmissionType = TransmissionType.manual


# Certain Hondas have an extra steering sensor at the bottom of the steering rack, # Certain Hondas have an extra steering sensor at the bottom of the steering rack,
# which improves controls quality as it removes the steering column torsion from feedback. # which improves controls quality as it removes the steering column torsion from feedback.
Expand Down
3 changes: 3 additions & 0 deletions selfdrive/car/honda/values.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def init_make(self, CP: car.CarParams):
b'37805-6B2-C520\x00\x00', b'37805-6B2-C520\x00\x00',
b'37805-6A0-C540\x00\x00', b'37805-6A0-C540\x00\x00',
b'37805-6A1-H650\x00\x00', b'37805-6A1-H650\x00\x00',
b'37805-6B2-A210\x00\x00',
b'37805-6B2-A550\x00\x00', b'37805-6B2-A550\x00\x00',
b'37805-6B2-A560\x00\x00', b'37805-6B2-A560\x00\x00',
b'37805-6B2-A650\x00\x00', b'37805-6B2-A650\x00\x00',
Expand Down Expand Up @@ -310,6 +311,7 @@ def init_make(self, CP: car.CarParams):
b'78109-TVA-A220\x00\x00', b'78109-TVA-A220\x00\x00',
b'78109-TVA-A230\x00\x00', b'78109-TVA-A230\x00\x00',
b'78109-TVA-A310\x00\x00', b'78109-TVA-A310\x00\x00',
b'78109-TVA-A420\x00\x00',
b'78109-TVA-C010\x00\x00', b'78109-TVA-C010\x00\x00',
b'78109-TVA-L010\x00\x00', b'78109-TVA-L010\x00\x00',
b'78109-TVA-L210\x00\x00', b'78109-TVA-L210\x00\x00',
Expand All @@ -322,6 +324,7 @@ def init_make(self, CP: car.CarParams):
b'78109-TVC-A210\x00\x00', b'78109-TVC-A210\x00\x00',
b'78109-TVC-A220\x00\x00', b'78109-TVC-A220\x00\x00',
b'78109-TVC-A230\x00\x00', b'78109-TVC-A230\x00\x00',
b'78109-TVC-A330\x00\x00',
b'78109-TVC-C010\x00\x00', b'78109-TVC-C010\x00\x00',
b'78109-TVC-C110\x00\x00', b'78109-TVC-C110\x00\x00',
b'78109-TVC-L010\x00\x00', b'78109-TVC-L010\x00\x00',
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/interfaces.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True, allow_
if cs_out.seatbeltUnlatched: if cs_out.seatbeltUnlatched:
events.add(EventName.seatbeltNotLatched) events.add(EventName.seatbeltNotLatched)
if cs_out.gearShifter != GearShifter.drive and (extra_gears is None or if cs_out.gearShifter != GearShifter.drive and (extra_gears is None or
cs_out.gearShifter not in extra_gears): cs_out.gearShifter not in extra_gears) and not cs_out.clutchPressed:
events.add(EventName.wrongGear) events.add(EventName.wrongGear)
if cs_out.gearShifter == GearShifter.reverse: if cs_out.gearShifter == GearShifter.reverse:
events.add(EventName.reverseGear) events.add(EventName.reverseGear)
Expand Down

0 comments on commit 93cb788

Please sign in to comment.