mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-14 02:40:40 +08:00
integrator: add function to return filtered data
Instead of only being able to get the integral and its integration time, it can also be handy to get the integral divided/differentiated by the the integration time. This data is then just filtered by the integrator.
This commit is contained in:
@@ -143,6 +143,20 @@ Integrator::get(bool reset, uint64_t &integral_dt)
|
||||
return val;
|
||||
}
|
||||
|
||||
math::Vector<3>
|
||||
Integrator::get_and_filtered(bool reset, uint64_t &integral_dt, math::Vector<3> &filtered_val)
|
||||
{
|
||||
// Do the usual get with reset first but don't return yet.
|
||||
math::Vector<3> ret_integral = get(reset, integral_dt);
|
||||
|
||||
// Because we need both the integral and the integral_dt.
|
||||
filtered_val(0) = ret_integral(0) * 1000000 / integral_dt;
|
||||
filtered_val(1) = ret_integral(1) * 1000000 / integral_dt;
|
||||
filtered_val(2) = ret_integral(2) * 1000000 / integral_dt;
|
||||
|
||||
return ret_integral;
|
||||
}
|
||||
|
||||
void
|
||||
Integrator::_reset(uint64_t &integral_dt)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user