PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <integrator.h>
Public Member Functions | |
Integrator (uint32_t auto_reset_interval=4000, bool coning_compensation=false) | |
~Integrator ()=default | |
Integrator (const Integrator &)=delete | |
Integrator & | operator= (const Integrator &)=delete |
Integrator (Integrator &&)=delete | |
Integrator & | operator= (Integrator &&)=delete |
bool | put (const uint64_t ×tamp, const matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt) |
Put an item into the integral. More... | |
bool | put_with_interval (unsigned interval_us, matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt) |
Put an item into the integral but provide an interval instead of a timestamp. More... | |
matrix::Vector3f | get (bool reset, uint32_t &integral_dt) |
Get the current integral and reset the integrator if needed. More... | |
matrix::Vector3f | get_and_filtered (bool reset, uint32_t &integral_dt, matrix::Vector3f &filtered_val) |
Get the current integral and reset the integrator if needed. More... | |
void | set_autoreset_interval (uint32_t auto_reset_interval) |
Set auto reset interval during runtime. More... | |
Private Member Functions | |
void | _reset (uint32_t &integral_dt) |
Private Attributes | |
uint32_t | _auto_reset_interval {0} |
the interval after which the content will be published and the integrator reset, 0 if no auto-reset More... | |
uint64_t | _last_integration_time {0} |
timestamp of the last integration step More... | |
uint64_t | _last_reset_time {0} |
last auto-announcement of integral value More... | |
matrix::Vector3f | _alpha {0.0f, 0.0f, 0.0f} |
integrated value before coning corrections are applied More... | |
matrix::Vector3f | _last_alpha {0.0f, 0.0f, 0.0f} |
previous value of _alpha More... | |
matrix::Vector3f | _beta {0.0f, 0.0f, 0.0f} |
accumulated coning corrections More... | |
matrix::Vector3f | _last_val {0.0f, 0.0f, 0.0f} |
previous input More... | |
matrix::Vector3f | _last_delta_alpha {0.0f, 0.0f, 0.0f} |
integral from previous previous sampling interval More... | |
bool | _coning_comp_on {false} |
true to turn on coning corrections More... | |
Definition at line 48 of file integrator.h.
Integrator::Integrator | ( | uint32_t | auto_reset_interval = 4000 , |
bool | coning_compensation = false |
||
) |
Definition at line 47 of file integrator.cpp.
References set_autoreset_interval().
|
default |
|
delete |
|
delete |
|
private |
Definition at line 162 of file integrator.cpp.
References _alpha, _beta, _last_alpha, _last_integration_time, _last_reset_time, and matrix::Matrix< Type, M, N >::zero().
Referenced by get(), and put().
matrix::Vector3f Integrator::get | ( | bool | reset, |
uint32_t & | integral_dt | ||
) |
Get the current integral and reset the integrator if needed.
reset | Reset the integral to zero. |
integral_dt | Get the dt in us of the current integration (only if reset). |
Definition at line 138 of file integrator.cpp.
References _alpha, and _reset().
matrix::Vector3f Integrator::get_and_filtered | ( | bool | reset, |
uint32_t & | integral_dt, | ||
matrix::Vector3f & | filtered_val | ||
) |
Get the current integral and reset the integrator if needed.
Additionally give the integral over the samples differentiated by the integration time (mean filtered values).
reset | Reset the integral to zero. |
integral_dt | Get the dt in us of the current integration (only if reset). |
filtered_val | The integral differentiated by the integration time. |
Definition at line 150 of file integrator.cpp.
References lps22hb::reset().
Referenced by DfMPU6050Wrapper::_publish(), and DfLsm9ds1Wrapper::_publish().
|
delete |
|
delete |
bool Integrator::put | ( | const uint64_t & | timestamp, |
const matrix::Vector3f & | val, | ||
matrix::Vector3f & | integral, | ||
uint32_t & | integral_dt | ||
) |
Put an item into the integral.
timestamp | Timestamp of the current value. |
val | Item to put. |
integral | Current integral in case the integrator did reset, else the value will not be modified |
integral_dt | Get the dt in us of the current integration (only if reset). |
Definition at line 54 of file integrator.cpp.
References _alpha, _auto_reset_interval, _beta, _coning_comp_on, _last_alpha, _last_delta_alpha, _last_integration_time, _last_reset_time, _last_val, _reset(), dt, and f().
Referenced by DfMPU6050Wrapper::_publish(), DfMpu9250Wrapper::_publish(), put_with_interval(), PX4Accelerometer::update(), and PX4Gyroscope::update().
bool Integrator::put_with_interval | ( | unsigned | interval_us, |
matrix::Vector3f & | val, | ||
matrix::Vector3f & | integral, | ||
uint32_t & | integral_dt | ||
) |
Put an item into the integral but provide an interval instead of a timestamp.
interval_us | Interval in us since last integration. |
val | Item to put. |
integral | Current integral in case the integrator did reset, else the value will not be modified |
integral_dt | Get the dt in us of the current integration (only if reset). Note that this values might not be accurate vs. hrt_absolute_time because it is just the sum of the supplied intervals. |
Definition at line 118 of file integrator.cpp.
References _last_integration_time, _last_reset_time, _last_val, hrt_absolute_time(), hrt_abstime, and put().
Referenced by DfLsm9ds1Wrapper::_publish().
|
inline |
Set auto reset interval during runtime.
This won't reset the integrator.
auto_reset_interval | New reset time interval for the integrator (+- 10%). |
Definition at line 113 of file integrator.h.
References _auto_reset_interval.
Referenced by Integrator().
|
private |
integrated value before coning corrections are applied
Definition at line 122 of file integrator.h.
|
private |
the interval after which the content will be published and the integrator reset, 0 if no auto-reset
Definition at line 116 of file integrator.h.
Referenced by put(), and set_autoreset_interval().
|
private |
accumulated coning corrections
Definition at line 124 of file integrator.h.
|
private |
true to turn on coning corrections
Definition at line 128 of file integrator.h.
Referenced by put().
|
private |
previous value of _alpha
Definition at line 123 of file integrator.h.
|
private |
integral from previous previous sampling interval
Definition at line 126 of file integrator.h.
Referenced by put().
|
private |
timestamp of the last integration step
Definition at line 119 of file integrator.h.
Referenced by _reset(), put(), and put_with_interval().
|
private |
last auto-announcement of integral value
Definition at line 120 of file integrator.h.
Referenced by _reset(), put(), and put_with_interval().
|
private |
previous input
Definition at line 125 of file integrator.h.
Referenced by put(), and put_with_interval().