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: Car Port Acura Integra #1722

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
22 changes: 16 additions & 6 deletions opendbc/car/honda/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

def get_can_messages(CP, gearbox_msg):
messages = [
("ENGINE_DATA", 100),
("WHEEL_SPEEDS", 50),
("STEERING_SENSORS", 100),
("SEATBELT_STATUS", 10),
Expand All @@ -33,6 +32,11 @@ def get_can_messages(CP, gearbox_msg):
("STEER_MOTOR_TORQUE", 0), # TODO: not on every car
]

if CP.carFingerprint != CAR.ACURA_INTEGRA:
messages += [
("ENGINE_DATA", 100), # Not found on Integra, but still want to check all others
]

if CP.carFingerprint == CAR.HONDA_ODYSSEY_CHN:
messages += [
("SCM_FEEDBACK", 25),
Expand All @@ -44,7 +48,7 @@ def get_can_messages(CP, gearbox_msg):
("SCM_BUTTONS", 25),
]

if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E):
if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.ACURA_INTEGRA):
messages.append((gearbox_msg, 50))
else:
messages.append((gearbox_msg, 100))
Expand All @@ -70,7 +74,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.ACURA_INTEGRA):
pass
elif CP.carFingerprint in (CAR.HONDA_ODYSSEY_CHN, CAR.HONDA_FREED, CAR.HONDA_HRV):
pass
Expand Down Expand Up @@ -136,10 +140,13 @@ def update(self, can_parsers) -> structs.CarState:
# ******************* parse out can *******************
# STANDSTILL->WHEELS_MOVING bit can be noisy around zero, so use XMISSION_SPEED
# panda checks if the signal is non-zero
ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5
if self.CP.carFingerprint == CAR.ACURA_INTEGRA:
ret.standstill = cp.vl["CAR_SPEED"]["CAR_SPEED"] < 1e-5
Comment on lines +143 to +144
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm definitely not in love with this message, it's almost certainly intended for instrument cluster display. Low frequency, high arb ID, and has a considerable response lag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can take another look to see what we have, or can use

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a pinch, there's a message that has ABS wheel speed sensor impulse integral, and that doesn't have the 2 kmh cutoff. We'd have to calibrate it against the main reference speed, but there's precedent and support for briefly suppressing engagement for steering angle sensor calibration and the like.

The reason I asked about stock ACC is that I'd be surprised if it does FtS/SnG if its own reference source has the 2kmh cutoff.

else:
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.ACURA_INTEGRA):
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 Expand Up @@ -178,7 +185,10 @@ def update(self, can_parsers) -> structs.CarState:

# blend in transmission speed at low speed, since it has more low speed accuracy
v_weight = float(np.interp(v_wheel, v_weight_bp, v_weight_v))
ret.vEgoRaw = (1. - v_weight) * cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel
if self.CP.carFingerprint == CAR.ACURA_INTEGRA:
ret.vEgoRaw = (1. - v_weight) * cp.vl["CAR_SPEED"]["CAR_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel
else:
ret.vEgoRaw = (1. - v_weight) * cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel
ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw)

self.dash_speed_seen = self.dash_speed_seen or cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] > 1e-3
Expand Down
28 changes: 28 additions & 0 deletions opendbc/car/honda/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,4 +910,32 @@
b'28101-65J-N010\x00\x00',
],
},
CAR.ACURA_INTEGRA: {
(Ecu.eps, 0x18da30f1, None): [
b'39990-T38-A040\x00\x00',
],
(Ecu.gateway, 0x18daeff1, None): [
b'38897-3S5-A110\x00\x00',
b'38897-3S5-A210\x00\x00',
],
(Ecu.srs, 0x18da53f1, None): [
b'77959-3S5-A920\x00\x00',
],
(Ecu.vsa, 0x18da28f1, None): [
b'57114-3S5-CA30\x00\x00',
b'57114-3S5-CB30\x00\x00',
],
(Ecu.fwdRadar, 0x18dab0f1, None): [
b'8S102-3S5-AA10\x00\x00',
],
(Ecu.transmission, 0x18da1ef1, None): [
b'28101-6LP-A010\x00\x00',
],
(Ecu.hud, 0x18da61f1, None): [
b'78209-3S5-A030\x00\x00',
],
(Ecu.electricBrakeBooster, 0x18da2bf1, None): [
b'39494-T20-A010\x00\x00',
],
},
}
2 changes: 1 addition & 1 deletion opendbc/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]]

elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022):
elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022, CAR.ACURA_INTEGRA):
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.8], [0.24]]

Expand Down
10 changes: 8 additions & 2 deletions opendbc/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ class CAR(Platforms):
CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
{Bus.pt: 'acura_rdx_2020_can_generated'},
)
ACURA_INTEGRA = HondaBoschPlatformConfig(
[HondaCarDocs("Acura Integra 2024", "All")],
CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
{Bus.pt: 'honda_civic_ex_2022_can_generated'},
flags=HondaFlags.BOSCH_RADARLESS,
)

# Nidec Cars
ACURA_ILX = HondaNidecPlatformConfig(
Expand Down Expand Up @@ -314,9 +320,9 @@ class CAR(Platforms):
# Note that we still attempt to match with them when they are present
# This is or'd with (ALL_ECUS - ESSENTIAL_ECUS) from fw_versions.py
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.ACURA_INTEGRA],
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.ACURA_INTEGRA],
},
extra_ecus=[
(Ecu.combinationMeter, 0x18da60f1, None),
Expand Down
1 change: 1 addition & 0 deletions opendbc/car/tests/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class CarTestRoute(NamedTuple):
CarTestRoute("2d5808fae0b38ac6|2021-09-01--17-14-11", HONDA.HONDA_E),
CarTestRoute("f44aa96ace22f34a|2021-12-22--06-22-31", HONDA.HONDA_CIVIC_2022),
CarTestRoute("1f032f5173c8ad99/00000006--573b3fcaf5", HONDA.HONDA_CIVIC_2022), # Civic Type R with manual transmission
CarTestRoute("3f8ae015ce70365f/00000003--a22590d0e4", HONDA.ACURA_INTEGRA),

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 opendbc/car/torque_data/substitute.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,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"
"ACURA_INTEGRA" = "HONDA_CIVIC_2022"

"BUICK_LACROSSE" = "CHEVROLET_VOLT"
"BUICK_REGAL" = "CHEVROLET_VOLT"
Expand Down
6 changes: 4 additions & 2 deletions opendbc/safety/safety/safety_honda.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#define HONDA_COMMON_NO_SCM_FEEDBACK_RX_CHECKS(pt_bus) \
{.msg = {{0x1A6, (pt_bus), 8, .max_counter = 3U, .frequency = 25U}, /* SCM_BUTTONS */ \
{0x296, (pt_bus), 4, .max_counter = 3U, .frequency = 25U}, { 0 }}}, \
{.msg = {{0x158, (pt_bus), 8, .max_counter = 3U, .frequency = 100U}, { 0 }, { 0 }}}, /* ENGINE_DATA */ \
{.msg = {{0x158, (pt_bus), 8, .max_counter = 3U, .frequency = 100U}, /* ENGINE_DATA */ \
{0x309, (pt_bus), 8, .max_counter = 3U, .frequency = 10U}, { 0 }}}, /* CAR_SPEED */ \
{.msg = {{0x17C, (pt_bus), 8, .max_counter = 3U, .frequency = 100U}, { 0 }, { 0 }}}, /* POWERTRAIN_DATA */ \

#define HONDA_COMMON_RX_CHECKS(pt_bus) \
Expand Down Expand Up @@ -80,7 +81,8 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
int bus = GET_BUS(to_push);

// sample speed
if (addr == 0x158) {
// 0x158 used for all suported Hondas except Integra (use 0x309 car_speed message)
if ((addr == 0x158) || (addr == 0x309)){
Comment on lines +84 to +85
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 0x309 case and its corresponding RxCheck aren't exercised in tests. I'm not sure we can depend on it anyway, so it may be irrelevant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will leave for the moment. Maybe we can find another message for speed

// first 2 bytes
vehicle_moving = GET_BYTE(to_push, 0) | GET_BYTE(to_push, 1);
}
Expand Down