-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Lateral PID: move steer feedforward to CarInterface #22411
Conversation
I've done some testing by making
and setting P and I to zero(so what the model was outputting was irrelevant). Then I tuned the kf to ensure that the wheel had no centering anymore(reducing kf if it was unstable and increasing if the wheel was centering). I think this is a nice way to tune the kf term, but it also confirmed in my case that the values need to be quite a bit different depending on speed(which makes sense if we consider openpilot torque output as the simulatet driver torque, which the EPS is boosting by different amounts depending on the speed). Haven't checked for nonlinearity in angle a lot, but if it's just the speed, wouldn't breakpoints like for P and I be a nicer solution? |
@qadmus For the first formula, looking at this simulation for example (https://www.youtube.com/watch?v=cJyIYjwakKo) I'd say it's quite reasonable to assume that the front tyres are being "pushed" down by the weight of the engine thereby generating lateral loads to keep the car straight, which should generate centering force. (@pd0wm any opinion on that?) (thinking a bit more, I am not confident this is true. Slip seems complicated...) For the sigmoid, seems interesting. From just physics, I'd say that the centering torque should be about proportional to the Are there plots something you can make from any rlogs? |
@grekiki the plots could work with any car's rlogs, but there are a few hardcoded values like GM's max steer command. See my branch That sigmoid will hopefully come after this refactor, I tried fitting all the sigmoids with all the degrees of freedom for variables, arctan is close but 1/(1+|x|) is best. |
Renamed LatControlPID.get_steer_feedforward() @pd0wm , an alternative implementation is to do the best with the original LateralPID output, then try to re-map the steer command in CarController. But, that would interfere with clipping / saturation behavior. I like how each car could get their own feedforward estimate here. |
Yeah like that too! If you're looking for another small project you could make all lateral control classes inherit from the same base class. After this change the PID controller has a different API for the constructor than the others, which could be confusing. |
That sounds quite simmilar to #21967 |
I'll rebase it for this PR soon! |
Description This is useful for cars with strange steer commands that aren't proportional to angle * speed ** 2.
I want to implement this in the best way, and I'm still figuring out Python's tricks (this is cargo cult coding), so suggest any improvements and we'll iterate.
On top of this change, I'll add GM steer feedforward and lateral tuning.
Verification Process replay is unchanged.