-
Notifications
You must be signed in to change notification settings - Fork 650
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
TrajectoryPoint.acceleration_mps2
is not really an acceleration
#5987
Comments
Currently, we define the sign of the acceleration in the planning/control/vehicle like this. The vehicle layer receives the longitudinal control command and the shift separately from the control layer. When we change the shift from the DRIVE to REAR for example, and if there is synchronization mismatch between the control command and the shift, the direction of acceleration may not be correct, causing unexpected acceleration. I feel that rather than renaming to |
Avoiding synchronization mismatch cannot be bad, but my issue is rather that using the name "acceleration" is confusing at code level without proper documentation. "Directed acceleration" is not necessarily very clear, but at least if I read that I immediately understand it might not be the "normal" acceleration I am used to and so I will double check its definition somewhere. If renaming is too annoying, I think at least adding documentation or a few comments here and there would greatly help. For example, in the |
I agree with this. |
This pull request has been automatically marked as stale because it has not had recent activity. |
I have created these two PRs adding comments and a note in a readme file trying to clarify the usage of
Please let me know if any further change is needed. |
@yukkysaito @mitsudome-r |
As the above PRs are merged, we can close this issue as completed. |
Checklist
Description
Pretty much everywhere I see
acceleration_mps2
used, the value is implicitely interpreted as follow:acceleration_mps2 > 0
then the vehicle is accelerating.acceleration_mps2 < 0
then the vehicle is braking.This is correct as long as the vehicle drives forward. If you drive backward (v < 0), then:
acceleration_mps2 > 0
acceleration_mps2 < 0
In practice, I observe the opposite: when using the freespace planner to go backward, the vehicle goes faster (backward) when
acceleration_mps2 > 0
and slower whenacceleration_mps2 < 0
.In other words,
TrajectoryPoint.acceleration_mps2
is rather the "directed acceleration" (i.e.a(t) = sign(v(t)) * (v(t+dt) - v(t)) / dt
) than the mathematical acceleration (i.e.a(t) = (v(t+dt) - v(t)) / dt
)I understand this design choice, as it is consistent with the way cars behave: pushing the acceleration pedal will always accelerate the vehicle, and pressing the brakes strongly while stopped will not make the vehicle go reverse. But then, I would suggest to change the name
acceleration_mps2
to something more appropriate (such asdirected_acceleration_mps2
or w/e is the appropriate term) to avoid confusion.TL;DR
grep -ril acceleration_mps2 src | xargs sed -i 's/acceleration_mps2/directed_acceleration_mps2/g'
?Expected behavior
N/A
Actual behavior
N/A
Steps to reproduce
N/A
Versions
No response
Possible causes
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: