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

Added integrator_limit to allow prevention of integrator windup #626

Merged
merged 1 commit into from
Oct 10, 2021

Conversation

pbrier
Copy link
Contributor

@pbrier pbrier commented Sep 16, 2021

In some cases the speed controller integrator can windup (if the motor is pushed out of position for a long time, or an excessive command is given), as a result the motor will overshoot significantly. This can be prevented by limiting the integrator. This PR adds a setting to the speed controller to allow you to do this. Set to inf (default value) to disable it and have the original behavior.

@CLAassistant
Copy link

CLAassistant commented Sep 16, 2021

CLA assistant check
All committers have signed the CLA.

@Wetmelon
Copy link
Collaborator

Wetmelon commented Sep 29, 2021

The vel_integrator actually has anti-windup in the form of a clamp and decay. The output of the velocity loop is clamped to the current limit, and then the integrator is decayed by 1% every cycle.

Is there a particular benefit to clamping just the integrator to a particular value?

Also, please target fw-v0.5.4

@pbrier
Copy link
Contributor Author

pbrier commented Oct 3, 2021

Yes. This ensures that the integral part of the controller never exceeds a preset limit. for example: If you set it to 20% of the maximum current, a prolonged standstill with residual error would not have an output of this 20%, ever. If the external force that caused this residual error (a hard stop for example) is removed (by reversing for example), the axis would not under/overshoot excessively.

@pbrier
Copy link
Contributor Author

pbrier commented Oct 4, 2021

To be more exact: When the integrator term is more than 1% continuously, windup of the integrator will still occur (the code does mention this // TODO make decayfactor configurable) but even then, a decay factor does not have the same effect as a simple clamping of the integrator. There are different techniques to prevent windup, and they all have there pros and cons. A hard clamp is the most straightforward and is implemented in many motion controllers. Some background: https://e2e.ti.com/blogs_/b/industrial_strength/posts/teaching-your-pi-controller-to-behave-part-vii

@madcowswe madcowswe changed the base branch from master to fw-v0.5.4 October 10, 2021 23:20
@madcowswe
Copy link
Collaborator

There certainly is scope to limit/clamp the integrator value at some earlier limit than the configured current/torque limit, which is what the existing anti-windup does. Thanks for your contribution.

@madcowswe madcowswe merged commit f5caa53 into odriverobotics:fw-v0.5.4 Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants