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

Add setpoint derivative feed forward term to PID controller #5642

Merged
merged 14 commits into from
Jun 9, 2020

Conversation

DzikuVx
Copy link
Member

@DzikuVx DzikuVx commented Apr 28, 2020

As part of this PR:

  • Dterm is always computed from measurement
  • Control Derivative is computed from filtered setpoint
  • Removed Dterm FIR filter
  • Removed Dterm notch
  • Omnibus F3 removed from release list

@digitalentity
Copy link
Member

So, this is not a feed-forward itself, it's a multiplier for one of the components of the D-term

@DzikuVx
Copy link
Member Author

DzikuVx commented Apr 28, 2020 via email

@digitalentity
Copy link
Member

Maybe we should then separate D/setpoint and D/measurement into two PID parameters and deprecate setpoint weight?

We'll end up with P, I, D/setpoint, D/meas and FF, may be a lot, but it will in fact may tuning simpler. D/setpoint and FF will only affect reaction to the stick.

@DzikuVx
Copy link
Member Author

DzikuVx commented Apr 29, 2020

That would mean we will need 5th gain in each bank, new frames for MSP, Configurator support and so on.
So, in general I agree that would be good, but quite complicated. As long as possible I want to avoid adding a 5th gain to each PID bank, even if naming will be not quite right.
Also, pilots on MC are used to BF FF and that another reason not to overcomplicate.

@digitalentity
Copy link
Member

Makes sense, but can we please not call it "feed-forward" to avoid confusion with real FF-term on fixed wings?

@DzikuVx
Copy link
Member Author

DzikuVx commented Apr 29, 2020 via email

digitalentity
digitalentity previously approved these changes Apr 29, 2020
@DzikuVx DzikuVx added this to the 2.6 milestone May 1, 2020
@DzikuVx
Copy link
Member Author

DzikuVx commented May 4, 2020

First flight tests completed and result are very appealing. There is less vibrations due to better behaving Dterm that now is measured only from measurement. The amount of control on fast strick movements was better than before. Unfortunatley I do not have a log with CDterm recorded.

image

DVR: https://youtu.be/tFXFGss8aFE

It still needs some check but seems like a good feature

src/main/flight/pid.h Show resolved Hide resolved
src/main/flight/pid.c Show resolved Hide resolved
@digitalentity
Copy link
Member

Happy to hear. Finally we're getting rid of dterm_setpoint_weight in favor of more intuitive tuning.

@Avegawanderer
Copy link

Maybe let's call the derivative of setpoint not DS but DFF (Differential Feed-Forward, or Differentiated Feed Forward) People have got used to "Feed Forward" name and it would be easier to explain that Betaflight's FF is actually DFF in iNav and the real feed-forward is just FF in iNav. At least both FF and DFF names describe their impact for the system. DS does not.

@digitalentity
Copy link
Member

IMO "feed-forward" has nothing to do with how this works (neither in INAV nor in BF).
The behavior is exactly about taking a derivative of setpoint (control) and propagating that straight to the motors. This is exactly what dterm_setpoint_weight does, just having a dedicated gain, decoupled from derivative of measurement (gyro).

@Avegawanderer
Copy link

Yes, what is called FF in Betaflight and iNav is different from true FF in a control system theory. But speaking about iNav, FF for fixed-wings simply propagates setpoint (control) to output (servos). While such FF is not used for multirotors, it's derivative is used, and, as I understand (please correct me if I'm wrong) Pawel in this PR brings it to PID controller settings, dropping dterm_setpoint_weight. The question is to name it properly. My proposal is to keep FF as it is for FW and name new component DFF instead of DS. It directly explains what it does (takes FF (=setpoint) and gets it's derivative). The goal is to use familiar FF name.

@digitalentity
Copy link
Member

I see, so the idea is to avoid adding a new term "setpoint" to prevent user confusion. @DzikuVx WDYT?

@DzikuVx
Copy link
Member Author

DzikuVx commented May 29, 2020

Actually I think that Control Derivative which is the name used in the code right now is exactly what this functionality is.
I'm even thinking about renaming D in configurator to Gyro Derivative so there is zero confusion what is what

@DzikuVx DzikuVx changed the base branch from development to master June 8, 2020 07:17
@DzikuVx DzikuVx dismissed digitalentity’s stale review June 8, 2020 07:17

The base branch was changed.

@DzikuVx DzikuVx added the Release Notes Add this when a PR needs to be mentioned in the release notes label Jun 8, 2020
@DzikuVx DzikuVx merged commit 839a877 into master Jun 9, 2020
@DzikuVx DzikuVx deleted the dzikuvx-mc-feed-forward branch June 9, 2020 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Release Notes Add this when a PR needs to be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants