openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Subaru: Crosstrek Hybrid support

Open adeebshihadeh opened this issue 2 years ago • 4 comments

adeebshihadeh avatar Aug 06 '22 06:08 adeebshihadeh

@martinl got a test route for me?

adeebshihadeh avatar Aug 06 '22 06:08 adeebshihadeh

It appears there are no similar messages on bus 0 to the cruise active status. Most common bits are quite a bit off:

hex(msg)='0x361', bit_mismatches=981 of 3720 (26.37%), byt_idx=1, bit_idx=2
hex(msg)='0x1f9', bit_mismatches=1476 of 6009 (24.56%), byt_idx=5, bit_idx=7
hex(msg)='0x1f9', bit_mismatches=1002 of 6009 (16.67%), byt_idx=5, bit_idx=6
hex(msg)='0x244', bit_mismatches=1589 of 10190 (15.59%), byt_idx=4, bit_idx=3
Searched bus: 0

On bus 2, it gets a bit interesting. There's of course the bit on 0x321 which is what I'm comparing (ES_DashStatus), but also 0x220 which is (ES_Brake):

ex(msg)='0x321', bit_mismatches=864 of 2423 (35.66%), byt_idx=5, bit_idx=2
hex(msg)='0x220', bit_mismatches=56 of 4800 (1.17%), byt_idx=0, bit_idx=0
hex(msg)='0x220', bit_mismatches=56 of 4800 (1.17%), byt_idx=4, bit_idx=0
hex(msg)='0x321', bit_mismatches=9 of 2423 (0.37%), byt_idx=4, bit_idx=3
Searched bus: 2

However I checked both signals on older ICE cars, and they proved to be inaccurate, specifically:

There's no other similar signals to ES_DashStatus->Cruise_Activated, so we'll have to verify that this signal on the hybrids don't have these same problems.

sshane avatar Aug 26 '22 21:08 sshane

This is also missing the hybrid signals for gas and brake: https://github.com/ClockeNessMnstr/openpilot/blob/crosstrek-pid/selfdrive/car/subaru/carstate.py#L23

ES_DashStatus->Cruise_Activated has the same gas pressed issue, but ES_Brake does not seem to have the same issue where you press the brake at a standstill and it doesn't fall.

Screenshot from 2022-08-30 11-39-23

Showing gas pressed behavior: Screenshot from 2022-08-30 11-39-31

sshane avatar Aug 30 '22 18:08 sshane

There is also ES_Status (0x222) Cruise_Activated, I'll check if it behaves differently

martinl avatar Dec 05 '22 08:12 martinl

On Crosstrek ICE, ES_Status Cruise_Activated is identical to CruiseControl Cruise_Activated signal, I tested with 3 cases above - stopping behind lead car / hold (standstill), disengage using brake while in standstill, gas press while engaged 8de015561e1ea4a0|2022-12-10--14-08-26

martinl avatar Dec 10 '22 14:12 martinl

I checked Crosstrek Hybrid dbc and it does not have ES_Status message. I'll find the signal once I find someone who can provide route for Crosstrek Hybrid

martinl avatar Dec 10 '22 17:12 martinl

crosstrek hybrid route: 31d10447d8c7dc19|2023-08-17--07-30-31--0

jnewb1 avatar Aug 17 '23 19:08 jnewb1

I'll just merge the hybrid cars behind dashcam, we still need a good cruise_activated bit. Would be helpful to get a forester hybrid route so I can see if they are the same

jnewb1 avatar Aug 23 '23 21:08 jnewb1

Can you merge https://github.com/commaai/openpilot/pull/24770 as dashcam after this? Make sure to leave a comment in the code at least of what is required to un-dashcam

sshane avatar Aug 23 '23 22:08 sshane

Make sure to request a final review before merging

sshane avatar Aug 24 '23 02:08 sshane