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

Toyota: 2021+ RAV4 Prime #31179

Closed
wants to merge 11 commits into from
Closed

Toyota: 2021+ RAV4 Prime #31179

wants to merge 11 commits into from

Conversation

pd0wm
Copy link
Contributor

@pd0wm pd0wm commented Jan 26, 2024

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:

  • Read key from param. Added to carParams, otherwise route wouldn't be reproducible without fetching the key from initData.
  • 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)
  • Replace missing GEAR_PACKET
    • 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)
  • 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
  • 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

Copy link
Contributor

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.

@adeebshihadeh
Copy link
Contributor

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.

@pd0wm
Copy link
Contributor Author

pd0wm commented Jan 29, 2024

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.

@adeebshihadeh
Copy link
Contributor

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

@sshane
Copy link
Contributor

sshane commented Jan 29, 2024

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

Copy link
Contributor

github-actions bot commented Mar 17, 2024

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

@pd0wm pd0wm force-pushed the rav4-prime branch 3 times, most recently from 6a3835c to 7e9424d Compare March 19, 2024 10:55
@pd0wm pd0wm force-pushed the rav4-prime branch 2 times, most recently from 234fd81 to 4db3a45 Compare May 5, 2024 09:31
pd0wm added 2 commits May 5, 2024 11:40
no engine RPM message

verify mac of sync message

fix PCM_CRUISE

fix line too long

add placeholder test route

use default SecOC key in CI

add dbc to release files

always in drive for now

fix radar dbc file

fix gear shifter parsing

add gasPressed

bump submodules

move secoc stuff in own file

typo

turn alt gas msg into flag

bump panda

name fixes
@jyoung8607 jyoung8607 added car vehicle-specific toyota labels Jul 3, 2024
@sshane
Copy link
Contributor

sshane commented Aug 20, 2024

We've moved the car interfacing code to our opendbc repository, which is now the new home for car ports and fingerprints. Please re-open your pull request against opendbc at your convenience by using this command below. This will transform all changes under selfdrive/car/ to opendbc_repo/opendbc/car/. Make sure you have initialized submodules beforehand and have checked out the latest opendbc commit.

PR_NUMBER=33045
curl -L https://github.com/commaai/openpilot/pull/$PR_NUMBER.patch | sed -e 's/selfdrive\/car/opendbc_repo\/opendbc\/car/g' | git apply -v --reject

Simply replace the PR number with your own. Once done, add the files, fix any conflicts, and open a new PR. Alternatively, you may start a new PR from scratch if that is easier for you.

@sshane sshane closed this Aug 20, 2024
jyoung8607 added a commit to jyoung8607/opendbc that referenced this pull request Sep 26, 2024
jyoung8607 added a commit to jyoung8607/openpilot that referenced this pull request Sep 26, 2024
jyoung8607 added a commit to commaai/opendbc that referenced this pull request Oct 4, 2024
* from @pd0wm #1005

* from @pd0wm commaai/openpilot#31179

* we did need that flag rename

* those flags were numbered like that for a reason

* no more bustime

* add secOCKey to structs

* hack around new pitch value for now

* secOCKey placeholder

* help the test along for now

* codespell disapproves of my creative vision

* add crypto dependency

* the other one

* the other other one

* temp use SecOC branch of Panda

* i am the panda, for now

* propitiate static type checker

* on second thought, moving car.capnp is a good idea

* remove the SecOC key from CarParams

* remove SecOC key reading from Toyota port

* add secoc_key to CS/CC

* update SecOC key references

* default key in interfaces for tests

* more CarParams.SecurityConfig

* set secOcRequired at startup for SecOC car

* see if type checker likes this better

* santa please bring car.capnp back soon

* list -> flag

* diff reduction: won't need the flag rename

* add IDLE_COAST signal

* regen RAV4 DBC

* consolidate and remove ALT_GAS_MSG flag

* consolidate and remove GEAR_PACKET_HYBRID flag

* cleanup pitch signal

* cleanup can_gear

* cleanup SECOC_SYNCHRONIZATION

* more cleanup

* cleanup Mirai

* FLAG.value consistency, in case capnp move needs this

* not necessary, reduce diff with master

* prettier

* validation like this should be an offline test

* match non-SecOC LTA message

* follow secoc library move

* repack flag values

* whitespace fix

* cleanup stockAeb

* comment not necessary

* add explicit FIXME for pandacan ref

* how did that sneak back in

* mention why CarDocs are missing

* use carlog to note wrong key problems

* limit logging volume

* prep for new CARS.md infra

* pandacan back to panda master
jyoung8607 added a commit to commaai/opendbc that referenced this pull request Oct 4, 2024
* from @pd0wm #1005

* from @pd0wm commaai/openpilot#31179

* we did need that flag rename

* those flags were numbered like that for a reason

* no more bustime

* add secOCKey to structs

* hack around new pitch value for now

* secOCKey placeholder

* help the test along for now

* codespell disapproves of my creative vision

* add crypto dependency

* the other one

* the other other one

* temp use SecOC branch of Panda

* i am the panda, for now

* propitiate static type checker

* on second thought, moving car.capnp is a good idea

* remove the SecOC key from CarParams

* remove SecOC key reading from Toyota port

* add secoc_key to CS/CC

* update SecOC key references

* default key in interfaces for tests

* more CarParams.SecurityConfig

* set secOcRequired at startup for SecOC car

* see if type checker likes this better

* santa please bring car.capnp back soon

* list -> flag

* diff reduction: won't need the flag rename

* add IDLE_COAST signal

* regen RAV4 DBC

* consolidate and remove ALT_GAS_MSG flag

* consolidate and remove GEAR_PACKET_HYBRID flag

* cleanup pitch signal

* cleanup can_gear

* cleanup SECOC_SYNCHRONIZATION

* more cleanup

* cleanup Mirai

* FLAG.value consistency, in case capnp move needs this

* not necessary, reduce diff with master

* prettier

* validation like this should be an offline test

* match non-SecOC LTA message

* follow secoc library move

* repack flag values

* whitespace fix

* cleanup stockAeb

* comment not necessary

* add explicit FIXME for pandacan ref

* how did that sneak back in

* mention why CarDocs are missing

* use carlog to note wrong key problems

* limit logging volume

* add migration entry for old routes

* add FW from 2fdfcfb945894324/00000151--11c864bd11

* add FW from 955536bf30ea4500/00000266--b60f72d541

* add FW from 5ac52f5bc37079ce/00000004--dd8686b2d0

* Revert "add migration entry for old routes"

This reverts commit 9791f10.
jyoung8607 added a commit that referenced this pull request Oct 4, 2024
* bump submodules

* bump opendbc

* from @pd0wm #31179

* bump panda

* we did need that flag rename

* bump opendbc

* bump opendbc

* bump submodules

* remove the SecOC key from CarParams

* don't log contents of SecOCKey Param

* read and set secoc_key from card

* bump opendbc

* better init flow

* bump opendbc

* saved SecOC key validation

* concise

* CarParams.SecurityConfig

* de-bump panda

* bump opendbc

* cleanup, pass only if required

* add startup event for missing SecOC key

* comment tweak

* bump opendbc

* add capnp entry for startupNoSecOcKey

* bump panda

* bump opendbc

* need priority over underlying LKA fault

* diff reduction: won't need the flag rename

* bump opendbc and panda

* bump submodules

* bump submodules

* bump panda

* bump submodules

* bump panda

* bump opendbc

* bump panda

* bump opendbc

* bump panda

* bump opendbc

* bump opendbc

* bump panda

* bump opendbc

* bump panda to master

* bump opendbc
cydia2020 pushed a commit to cydia2020/dodgypilot that referenced this pull request Oct 6, 2024
* bump submodules

* bump opendbc

* from @pd0wm commaai#31179

* bump panda

* we did need that flag rename

* bump opendbc

* bump opendbc

* bump submodules

* remove the SecOC key from CarParams

* don't log contents of SecOCKey Param

* read and set secoc_key from card

* bump opendbc

* better init flow

* bump opendbc

* saved SecOC key validation

* concise

* CarParams.SecurityConfig

* de-bump panda

* bump opendbc

* cleanup, pass only if required

* add startup event for missing SecOC key

* comment tweak

* bump opendbc

* add capnp entry for startupNoSecOcKey

* bump panda

* bump opendbc

* need priority over underlying LKA fault

* diff reduction: won't need the flag rename

* bump opendbc and panda

* bump submodules

* bump submodules

* bump panda

* bump submodules

* bump panda

* bump opendbc

* bump panda

* bump opendbc

* bump panda

* bump opendbc

* bump opendbc

* bump panda

* bump opendbc

* bump panda to master

* bump opendbc
jyoung8607 added a commit to commaai/opendbc that referenced this pull request Oct 7, 2024
* from @pd0wm #1005

* from @pd0wm commaai/openpilot#31179

* we did need that flag rename

* those flags were numbered like that for a reason

* no more bustime

* add secOCKey to structs

* hack around new pitch value for now

* secOCKey placeholder

* help the test along for now

* codespell disapproves of my creative vision

* add crypto dependency

* the other one

* the other other one

* temp use SecOC branch of Panda

* i am the panda, for now

* propitiate static type checker

* on second thought, moving car.capnp is a good idea

* remove the SecOC key from CarParams

* remove SecOC key reading from Toyota port

* add secoc_key to CS/CC

* update SecOC key references

* default key in interfaces for tests

* more CarParams.SecurityConfig

* set secOcRequired at startup for SecOC car

* see if type checker likes this better

* santa please bring car.capnp back soon

* list -> flag

* diff reduction: won't need the flag rename

* add IDLE_COAST signal

* regen RAV4 DBC

* consolidate and remove ALT_GAS_MSG flag

* consolidate and remove GEAR_PACKET_HYBRID flag

* cleanup pitch signal

* cleanup can_gear

* cleanup SECOC_SYNCHRONIZATION

* more cleanup

* cleanup Mirai

* FLAG.value consistency, in case capnp move needs this

* not necessary, reduce diff with master

* prettier

* validation like this should be an offline test

* match non-SecOC LTA message

* follow secoc library move

* repack flag values

* whitespace fix

* cleanup stockAeb

* comment not necessary

* add explicit FIXME for pandacan ref

* how did that sneak back in

* mention why CarDocs are missing

* use carlog to note wrong key problems

* limit logging volume

* add SecOC Sienna, FW from 970f02decf19930c/00000007--744397430a

* add FW from 0bbe367c98fa1538/00000001--1c0d7ae2e4

* add CI test route for Sienna

* SR closer to online learned, tweak mass to Edmunds value

* add FW from 8bfb000e03b2a257/00000004--f9eee5f52e

* fix transposition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants