openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Toyota: 2021+ RAV4 Prime

Open pd0wm opened this issue 1 year ago • 6 comments

[!IMPORTANT]
Before trying this PR, ensure the SecOCKey param is set with the correct key for your vehicle. echo -n "ffffffffffffffffffffffffffffffff" > /data/params/d/SecOCKey

FW versions from 20ba9ade056a8c7b. Example route: 20ba9ade056a8c7b|2021-02-08--21-57-35.

TODO:

  • [x] Read key from param. Added to carParams, otherwise route wouldn't be reproducible without fetching the key from initData.
  • [x] Doesn't show up as a supported car
  • [ ] Figure out if layout of PRE_COLLISION changed for stock AEB detection. (not a blocked for the port)
  • [x] Replace missing GEAR_PACKET
    • [x] Check if weird GEAR_PACKET_HYBRID.COUNTER is Rav4 specific.
  • [ ] Replace missing PCM_CRUISE
    • [ ] Implement gas pressed from new GAS_PEDAL message. (Still missing in panda)
    • [ ] Find new cruise state signal (e.g. nonAdaptive)
  • [x] Replace missing BRAKE_MODULE
  • [ ] Add proper alerts for missing/wrong SecOCKey
  • [ ] Add flags for panda safety mode for alternate Brake/Gas messages
    • [ ] Ensure tests between panda and CarState match
  • [x] Test if ACC Cancel spam works. Looks like the ACCEL_CMD was moved to a message with SecOC, but the CANCEL_REQ is still in the old message without MAC.

Missing PCM_CRUISE.

There seems to be a new message on 0x1a2 that has a bit that corresponds to ACCEL_CMD_ALT != 0. 0x1a2 seems to be a different message than other TSS2 cars.

Missing GEAR_PACKET/ GEAR_PACKET_HYBRID

There is no GEAR_PACKET, but GEAR_PACKET_HYBRID seems a good replacement. The COUNTER doesn't seem to be a real counter. ~Removed it, but check if this is a Rav4 Prime specific quirk.~ Counter is also fake on a Corolla Hybrid route.

I'm switching to the new message automatically when GEAR_PACKET is missing, but GEAR_PACKET_HYBRID is present. I need to check if this doesn't break any other cars.

Missing BRAKE_MODULE

There seem to be two new messages related to the brakes 0xfc and 0x101. Unfortunately they are not present on other models, so they can't be compared directly. I was only able to reference against PCM_CRUISE_2.BRAKE_PRESSED.

I put the new messages in the SecOC dbc for now. Let's see if all SecOC cars switched to this new message, or if this is a quirk for the RAV4 Prime specifically.

2024-01-29-133018_811x834_scrot

pd0wm avatar Jan 26 '24 14:01 pd0wm

It looks like you didn't use one of the Pull Request templates. Please check the contributing docs. Also make sure that you didn't modify any of the checkboxes or headings within the template.

github-actions[bot] avatar Jan 26 '24 15:01 github-actions[bot]

I added a TODO to make sure this doesn't show up in the docs as supported.

  • [ ] Figure out if layout of PRE_COLLISION changed for stock AEB detection.

No need to block the port on this.

adeebshihadeh avatar Jan 26 '24 19:01 adeebshihadeh

What do I need to check to make sure it's not showing up as supported? It's not in the CAR_INFO list, and rerunning docs.py seems to cause no changes.

pd0wm avatar Jan 29 '24 12:01 pd0wm

What do I need to check to make sure it's not showing up as supported? It's not in the CAR_INFO list, and rerunning docs.py seems to cause no changes.

I think you'll need to set it to None in CarInfo. cc @sshane

adeebshihadeh avatar Jan 29 '24 17:01 adeebshihadeh

Yes None should work. It won't have its fingerprints auto updated with our bot though. We can add a field to hide it if we care about that

sshane avatar Jan 29 '24 19:01 sshane

Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • the change is something we merge
    • include a route or your device' dongle ID if relevant

github-actions[bot] avatar Mar 17 '24 16:03 github-actions[bot]