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 TSS2: parse distance button #31722

Merged
merged 7 commits into from
Mar 6, 2024

Conversation

FrogAi
Copy link
Contributor

@FrogAi FrogAi commented Mar 6, 2024

Needs some cleaning up, especially in regards to handling the parameters, but figured I'd write up a quick draft just to get something going and gather some official feedback from the comma team to see which direction y'all wanted to go. But this is the gist of controlling personalities via the "Distance" button on the steering wheel for Toyota/Lexus.

Not too sure if y'all want the extra function to restore the previous drive's personality, but I put that in there since it's certainly a very nice QOL change since it defaults to the "Relaxed" personality upon ignition.

I added a bunch of comments as I went to help clear up the "why", but feel free to ask any questions or provide any inputs or critiques and I'll be happy to accommodate!

Copy link
Contributor

github-actions bot commented Mar 6, 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

@github-actions github-actions bot added the car vehicle-specific label Mar 6, 2024
@adeebshihadeh
Copy link
Contributor

Thanks! @sshane will clean this up and get it merged as the first example, then the community can do the rest of the brands.

@adeebshihadeh adeebshihadeh added this to the 0.9.7 milestone Mar 6, 2024
@sshane sshane changed the title Enable the distance button to switch personalities for Toyota/Lexus Toyota: parse distance button Mar 6, 2024
Comment on lines 178 to 182
elif self.CP.flags & ToyotaFlags.SMART_DSU:
self.distance_button = cp.vl["SDSU"]["FD_BUTTON"] == 1
# This may need some additional checks or can even simply be an "else" statement if all cars already have it mapped out
elif self.CP.openpilotLongitudinalControl:
self.distance_button = cp_acc.vl["ACC_CONTROL"]["DISTANCE"] == 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that we disable the radar on some TSS2 cars

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that’s one of the additional checks I was thinking I’ll need to add in. I’ll keep that in mind when I go through and clean it up tomorrow.

Copy link
Contributor

@sshane sshane Mar 6, 2024

Choose a reason for hiding this comment

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

Apparently the buttons are wired directly up to the camera. I blocked all messages that we normally forward through the panda to the camera and it still knew when we were pressing both the distance and lane keep button (but didn't know the wheel angle in STEERING_LTA for example) :(

Looks like no button parsing for RAV4 2022+, as they are probably then connected to the radar there

Found the button on no other message unfortunately

@sshane sshane changed the title Toyota: parse distance button Toyota TSS2: parse distance button Mar 6, 2024
@sshane sshane marked this pull request as ready for review March 6, 2024 08:54
@sshane
Copy link
Contributor

sshane commented Mar 6, 2024

image

@sshane sshane merged commit a2de011 into commaai:master Mar 6, 2024
27 checks passed
@sshane
Copy link
Contributor

sshane commented Mar 6, 2024

Thanks! We can do SDSU in a follow up PR

@FrogAi FrogAi deleted the toyota/lexus-distance-button branch March 6, 2024 17:36
cydia2020 pushed a commit to cydia2020/dodgypilot that referenced this pull request May 14, 2024
* Enable the distance button to switch personalities for Toyota/Lexus

* Default to the "standard" personality for now

* only parsing first

* only parse

* no personality in card

* safe

* comment

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car vehicle-specific toyota
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants