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

[Feature]: Implement Velocity Controller to also actively Brake #136

Closed
4 tasks done
hellschwalex opened this issue Dec 6, 2023 · 3 comments · Fixed by #125
Closed
4 tasks done

[Feature]: Implement Velocity Controller to also actively Brake #136

hellschwalex opened this issue Dec 6, 2023 · 3 comments · Fixed by #125
Assignees
Labels

Comments

@hellschwalex
Copy link
Collaborator

hellschwalex commented Dec 6, 2023

Description

Since the current implementation of the velocity controller only includes a PID for throttling ( accelerating the car) and uses the included frictions of the simulation to brake, which is not good enough to control the velocity especially on jumping to lower max_velocities, BRAKING-functionality needs to be included.

Implement new Controller for the brake-inputs of carla:

  • Since another PID Controller would interact with the already implemented and tuned throttle PID Controller, only test P- Controllers, which should be enough (testing different Kp = 0.5 , 1.0, 1.5, ...)
  • Always also test if allowing the throttle PID Controller to calculate negative throttles which can be used as positive brakes
  • Preferably the easiest, most predictable Solution is used.
  • Test with different Velocities and testcases.

Definition of Done

  • the Velocity Controller can actively brake, reaching better performance in controlling velocity
  • Improve braking times compared to without braking-Controller by at least 50% (since friction is already braking alot and even fully braking brake=1 is not doing much more, higher than 50% is not really possible)
@hellschwalex
Copy link
Collaborator Author

Compared so far:

  • braking with throttle = 0 (only frictions from simulation)
  • giving the throttle PID the range -1 to 1 (instead of 0 to 1) and use all negative throttles as positive brake inputs
  • using another PID for braking with negative parameters (braking is negative acceleration) to brake instead, while throttlePID sets throttle = 0. Currently brakingPID = PID(0.5,0,0) and needs tuning, but how to tune this efficiently? Can i set a starting velocity and deactivate throttlePID??)

Why are 2 and 3 so similar:

  • At the drop of target velocity both set brake to max and throttle to 0. So we actually see the maximum possible braking in the first few seconds, then the brakingPID WILL BE BETTER IF TUNED CORRECTLY.
    braking

@hellschwalex
Copy link
Collaborator Author

Since a braking PID controller with I and D parts will badly interact with the throttlePID controller ( and since braking is alot simpler considering that the vehicle model already de-accelerates alot and stable when no throttle is used) a simple P-Controller will be used for braking.
This will increase the general velocity controlling alot, while hardly interacting with the already well tuned throttlePID.
Since a P-Controller brakes only proportionally to the (negative) velocity error with maximum braking being = 1, the Kp of this controller can be tuned to get the velocity error point where we stop fully braking.
E.G. if we want to slow down braking at v_err = -3 m/s (around 10km/h over target velocity) we just set Kp = 1 / v_err. (while braking = 0 at target velocity and below).

@hellschwalex hellschwalex linked a pull request Dec 11, 2023 that will close this issue
7 tasks
@hellschwalex hellschwalex moved this from 🏗 In progress to ✅ Done in PAF Project Backlog Dec 11, 2023
@hellschwalex hellschwalex moved this from ✅ Done to 🏗 In progress in PAF Project Backlog Dec 11, 2023
@hellschwalex
Copy link
Collaborator Author

For now the negative-throttle solution is implemented, as it has the most predictable outcome while highly improving braking times without interfering with other controllers since there are none (as a braking-PID would do).

@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in PAF Project Backlog Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant