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

I gain is rounded off. #52

Open
nyxrobotics opened this issue Dec 9, 2022 · 3 comments
Open

I gain is rounded off. #52

nyxrobotics opened this issue Dec 9, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@nyxrobotics
Copy link
Contributor

Abstract

The problem occurs when adjusting the PID gain of the position.
When the I-gain is 0.4 or less, it is not integrated at all.
When the I-gain is set to 0.5 or higher, it suddenly becomes integrated.

How to Reproduce the Bug

Problem due to the Bug

Factors

Suggestion

@nyxrobotics nyxrobotics added the bug Something isn't working label Dec 9, 2022
@nyxrobotics
Copy link
Contributor Author

nyxrobotics commented Jan 17, 2023

If the value obtained by multiplying the gain by the deviation is less than 1, a digit drop occurs, which occurs for all PID gains.

@nyxrobotics nyxrobotics self-assigned this Jan 17, 2023
@nyxrobotics
Copy link
Contributor Author

The I control calculation was correctly performed with a double type.
However, there seems to be a bug in the calculation of antiwindup.
We need to check if the #72 change has improved the situation.

// calculates I control if PD input is not saturated
if (isSaturated(u_pd))
{
u = saturate(u_pd);
}
else
{
double error_integ_new = error_integ_ + (error_current + error_previous_) / 2.0 * control_period_;
const double u_pid = u_pd + Ki_ * error_integ_new;
// not use I control if PID input is saturated
// since error integration causes bugs
if (isSaturated(u_pid))
{
u = saturate(u_pid);
}
else
{
u = u_pid;
error_integ_ = error_integ_new;
}
}

@nyxrobotics
Copy link
Contributor Author

In order to improve the calculation of antiwindup, we referred to the following article.
Anti-windup of PID controller

The behavior was unstable because of the proprietary calculation method. It has been re-implemented using the "Back-Calculation" method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant