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

Civic Type R support #32920

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion opendbc
18 changes: 14 additions & 4 deletions selfdrive/car/honda/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from openpilot.selfdrive.car.honda.hondacan import CanBus, get_cruise_speed_conversion
from openpilot.selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, \
HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_RADARLESS, \
HondaFlags
HondaFlags, GearShifter
from openpilot.selfdrive.car.interfaces import CarStateBase

TransmissionType = car.CarParams.TransmissionType
Expand Down Expand Up @@ -87,12 +87,15 @@ def __init__(self, CP):
self.gearbox_msg = "GEARBOX"
if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt:
self.gearbox_msg = "GEARBOX_15T"
elif CP.transmissionType == TransmissionType.manual:
self.gearbox_msg = "GEARBOX_BOH"

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

self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"]
if CP.transmissionType != TransmissionType.manual:
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.brake_switch_prev = False
Expand Down Expand Up @@ -184,8 +187,15 @@ def update(self, cp, cp_cam, cp_body):
if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN}):
ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0

gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None))
if self.CP.transmissionType == TransmissionType.manual:
ret.clutchPressed = cp.vl["GEARBOX_BOH"]["GEAR_MT"] == 0
if cp.vl["GEARBOX_BOH"]["GEAR_MT"] == 14:
ret.gearShifter = GearShifter.reverse
else:
ret.gearShifter = GearShifter.drive
else:
gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None))

ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"]
ret.gasPressed = ret.gas > 1e-5
Expand Down
5 changes: 5 additions & 0 deletions selfdrive/car/honda/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@
b'39990-T24-T120\x00\x00',
b'39990-T39-A130\x00\x00',
b'39990-T43-J020\x00\x00',
b'39990-T60-J030\x00\x00',
],
(Ecu.gateway, 0x18daeff1, None): [
b'38897-T20-A020\x00\x00',
Expand All @@ -864,13 +865,15 @@
b'38897-T20-A510\x00\x00',
b'38897-T21-A010\x00\x00',
b'38897-T24-Z120\x00\x00',
b'38897-T60-A110\x00\x00',
],
(Ecu.srs, 0x18da53f1, None): [
b'77959-T20-A970\x00\x00',
b'77959-T20-A980\x00\x00',
b'77959-T20-M820\x00\x00',
b'77959-T47-A940\x00\x00',
b'77959-T47-A950\x00\x00',
b'77959-T60-A920\x00\x00',
],
(Ecu.fwdRadar, 0x18dab0f1, None): [
b'36161-T20-A060\x00\x00',
Expand All @@ -881,11 +884,13 @@
b'36161-T47-A070\x00\x00',
b'8S102-T20-AA10\x00\x00',
b'8S102-T47-AA10\x00\x00',
b'8S102-T60-AA10\x00\x00',
],
(Ecu.vsa, 0x18da28f1, None): [
b'57114-T20-AB40\x00\x00',
b'57114-T24-TB30\x00\x00',
b'57114-T43-JB30\x00\x00',
b'57114-T60-AA20\x00\x00',
],
(Ecu.transmission, 0x18da1ef1, None): [
b'28101-65D-A020\x00\x00',
Expand Down
3 changes: 3 additions & 0 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
# Accord ICE 1.5T CVT has different gearbox message
if candidate == CAR.HONDA_ACCORD and 0x191 in fingerprint[CAN.pt]:
ret.transmissionType = TransmissionType.cvt
# New Civics can have manual transmission
elif candidate == CAR.HONDA_CIVIC_2022 and 0x191 not in fingerprint[CAN.pt]:
ret.transmissionType = TransmissionType.manual

# 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.
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

Ecu = car.CarParams.Ecu
VisualAlert = car.CarControl.HUDControl.VisualAlert
GearShifter = car.CarState.GearShifter


class CarControllerParams:
Expand Down
Loading