openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Toyota: match stock standstill entrance behavior

Open cydia2020 opened this issue 1 year ago • 3 comments

Description

Behavior explained: This PR fixes #29613 by mimicking stock longitudinal standstill entrance behavior. After this PR is merged, openpilot will:

  • Enter standstill once the car determines that it is appropriate (vehicle is stopped, standstill bit is always set unless openpilot wants to resume).
  • Request exiting standstill once the lead starts moving (CC.cruiseControl.resume = True).
  • Keep requesting to exit standstill for 1.5 seconds after the last CC.cruiseControl.resume = True request.
    • This timer resets after the vehicle exits standstill to prevent PCM from not re-entering standstill.
  • Request resume for as long as the lead is creeping if vehicle is stopped and lead is creeping, it will stop doing so once the lead stops moving and long planner isn't requesting any acceleration.
    • The user can elect to not depress the RES button, keeping the vehicle in standstill, and only resume once the user deems it appropriate.
  • Request resume exit immediately if the user engages at a standstill with a far-away lead or with no lead.
  • Ignore standstill on NO_STOP_TIMER_CAR

Verification

Went on a drive and vehicle behaves like stock.

Route

7069d98b0de453c0|2024-02-08--12-21-10--0 7069d98b0de453c0|2024-02-08--11-36-39--0

See bookmarks, there are a few good examples in there about how this is now handled, and this should be pretty easy to test as well.

cydia2020 avatar Feb 06 '24 11:02 cydia2020

~~One issue with this is the event that's created:~~ ~~EventName.resumeRequired will always be displayed even if the vehicle isn't ready for resume, should this be fixed? It can definitely be by using:~~

      if ret.cruiseState.standstill and not ret.brakePressed and not self.CP.enableGasInterceptor and \ 
          c.cruiseControl.resume: 
         events.add(EventName.resumeRequired) 

~~But then the same hysteresis that's used for the vehicle won't apply to the alert.~~

Fixed

cydia2020 avatar Feb 08 '24 07:02 cydia2020

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 May 17 '24 02:05 github-actions[bot]

Hey folks, would this something that's mergeable?

cydia2020 avatar May 17 '24 02:05 cydia2020

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 avatar Aug 20 '24 06:08 sshane