openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Poor longitudinal tuning

Open haraschax opened this issue 5 years ago • 47 comments

Some cars (mostly Hondas) have very poor longitudinal tuning. They undershoot desired acceleration from the planner consistently. This causes the car to never accelerate even if the planner tells it to for 10+ seconds.

These cars need to be retuned so this does not happen. Here is the average difference between desired acceleration (from the longitudinalPlan message) and actual acceleration (from the carState message).

steady_state

These values should be very close to 0. In the hondas they are not, this will cause the car to drive too slow and the following distance be larger than it should be.

If you have one of the poorly tuned cars, your help would be appreciated! Using plotjuggle to compare desired and actual acceleration on your drives would be the first step.

haraschax avatar Jul 23 '21 06:07 haraschax

https://github.com/commaai/openpilot/issues/21586 related

haraschax avatar Jul 23 '21 06:07 haraschax

So what parameters should we change to get it to zero?

che220 avatar Jul 23 '21 14:07 che220

Any good guides on how to use plotjuggler with the comma2?

adidasboy517 avatar Jul 23 '21 15:07 adidasboy517

@adidasboy517 https://github.com/commaai/openpilot/tree/master/tools/plotjuggler Has a README

@che220 https://github.com/commaai/openpilot/blob/master/selfdrive/controls/lib/longcontrol.py This is the longitudinal control loop. It has PID values that are specific to each car/brand. And then there is some car-specific interface code here https://github.com/commaai/openpilot/blob/master/selfdrive/car/honda/interface.py and here https://github.com/commaai/openpilot/blob/master/selfdrive/car/honda/carcontroller.py

I'm not super familiar with it myself, it's likely quite a bit more complicated than just tuning some numbers.

haraschax avatar Jul 23 '21 18:07 haraschax

If those Hondas have gas interceptors, then it's probably due to longcontrol outputting an acceleration request, but the pedal taking in a gas percentage, leading to undershoot as 0 m/s/s desired acceleration means that no gas will be applied. I don't think you can tune this out, you need some way to convert acceleration to gas, per car. Or a general conversion function that works well enough for all with the pedal

sshane avatar Jul 27 '21 20:07 sshane

@sshane If it's just that, shouldn't the PID be able to deal with it?

haraschax avatar Jul 27 '21 23:07 haraschax

Eventually, but there's always going to be some oscillation with acceleration. If you want to maintain your speed openpilot will request 0 acceleration (which is really 0% gas if using a pedal) so it slows down and then integral will build up and overshoot. It may be less responsive to gas on Hondas though so it may never overshoot (I'm used to Toyota) and stay below the setpoint.

sshane avatar Jul 27 '21 23:07 sshane

Sounds like you need a gas feedforward term

ghost avatar Jul 29 '21 21:07 ghost

Related https://github.com/commaai/openpilot/issues/21803

haraschax avatar Aug 04 '21 02:08 haraschax

Basically the main cause of this issue is that honda nidec accel control goes through a strange function, not the long control loop like it does for all cars. I am working on a PR to fix this. But I can only test on our own Civic. So feedback from other cars would be very welcome.

https://github.com/commaai/openpilot/pull/21845/files

If anyone is willing to do some testing that'd be great. @adidasboy517 @che220 @Smurf

haraschax avatar Aug 04 '21 02:08 haraschax

Hi HaraldSchafer,

I am brand new to github. I have the issue on my 2016 Civic. I would be glad to load you change and test it but I don't know how. If you can point me to where this is explained (load specified SW) I will do that..

KevinYoung2 avatar Aug 05 '21 15:08 KevinYoung2

@KevinYoung2 https://github.com/commaai/openpilot/wiki/Forks

ghost avatar Aug 05 '21 17:08 ghost

Thank you!

From: grekiki @.> Sent: Thursday, August 5, 2021 10:35 AM To: commaai/openpilot @.> Cc: KevinYoung2 @.>; Mention @.> Subject: Re: [commaai/openpilot] Poor longitudinal tuning (#21697)

@KevinYoung2 https://github.com/KevinYoung2 https://github.com/commaai/openpilot/wiki/Forks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/commaai/openpilot/issues/21697#issuecomment-893653217 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVDG5JEQG745PGHLPZ7AZA3T3LDTVANCNFSM5A3MJOVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email . https://github.com/notifications/beacon/AVDG5JABVYXYXKM4EBAMJ53T3LDTVA5CNFSM5A3MJOV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGVCBBYI.gif

KevinYoung2 avatar Aug 05 '21 20:08 KevinYoung2

I have looked at the link from grekiki above. I created the following command: https://smiskol.com/fork/github.com/commaai/openpilot/pull/21845/files This seems to start the loading process. I get the 'Installing Openpilot' screen with the comma and revolving circle. But it never finishes. I imagine there is something wrong with my command, Can anyone tell me what the error is?

Thanks.

KevinYoung2 avatar Aug 06 '21 15:08 KevinYoung2

So what until now My problem hasn't been solved?! commaai/openpilot#21803.

Na112786 avatar Aug 10 '21 04:08 Na112786

@Na112786 it's generally preferred to consolidate identical issues into one. Don't worry, this one hasn't been closed and your issue was linked.

sshane avatar Aug 10 '21 05:08 sshane

https://github.com/commaai/openpilot/commit/a8f3e2b3c26f2b617a1c9c94250b44adce861d04

Just merged a potential fix into master. This should hopefully help with some Hondas. I was not able to test some, so any feedback is welcome.

haraschax avatar Aug 12 '21 01:08 haraschax

Feedback, Nothing change still same problem.. This my all information, Pls try again..

Honda pilot 2019 Comma two This my Dongle : 1631748f51929063 Serial number: 9152f8f3 Git_branch: release2 Git_Commit: 1b4d1a8d46 OS version: NEOS 17

Uploading IMG_20210812_173153.jpg…

Na112786 avatar Aug 12 '21 17:08 Na112786

Uploading IMG_20210812_173153.jpg…

Na112786 avatar Aug 12 '21 17:08 Na112786

Uploading IMG_20210812_173130.jpg…

Na112786 avatar Aug 12 '21 17:08 Na112786