-
Notifications
You must be signed in to change notification settings - Fork 17.2k
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
Slew rate 2 #8228
base: master
Are you sure you want to change the base?
Slew rate 2 #8228
Conversation
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com> Co-authored-by: Jacob Walser <jwalser90@gmail.com>
Use float multiplication, not division. |
// Apply rate of change limiting to an input | ||
// max_rate is the maximum allowed rate of change as a percentage of the range per second | ||
// dt is the time delta in seconds between calls | ||
void limit_value_slew_rate(float& previous, float& current, float range, float max_rate, float dt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The limit_demand_slew_rate
method is already big to be in the header, but this one is huge. Please move it to the cpp file.
max_change = 0.001 * range; | ||
} | ||
|
||
current = constrain_float(current, previous - max_change, previous + max_change); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if limit.X
should be set.
This one supercedes #8213 and is revised according to review in dev call.