PX4 Firmware
PX4 Autopilot Software http://px4.io
Integrator Class Reference

#include <integrator.h>

Collaboration diagram for Integrator:

Public Member Functions

 Integrator (uint32_t auto_reset_interval=4000, bool coning_compensation=false)
 
 ~Integrator ()=default
 
 Integrator (const Integrator &)=delete
 
Integratoroperator= (const Integrator &)=delete
 
 Integrator (Integrator &&)=delete
 
Integratoroperator= (Integrator &&)=delete
 
bool put (const uint64_t &timestamp, 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...
 

Detailed Description

Definition at line 48 of file integrator.h.

Constructor & Destructor Documentation

◆ Integrator() [1/3]

Integrator::Integrator ( uint32_t  auto_reset_interval = 4000,
bool  coning_compensation = false 
)

Definition at line 47 of file integrator.cpp.

References set_autoreset_interval().

Here is the call graph for this function:

◆ ~Integrator()

Integrator::~Integrator ( )
default

◆ Integrator() [2/3]

Integrator::Integrator ( const Integrator )
delete

◆ Integrator() [3/3]

Integrator::Integrator ( Integrator &&  )
delete

Member Function Documentation

◆ _reset()

void Integrator::_reset ( uint32_t &  integral_dt)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

matrix::Vector3f Integrator::get ( bool  reset,
uint32_t &  integral_dt 
)

Get the current integral and reset the integrator if needed.

Parameters
resetReset the integral to zero.
integral_dtGet the dt in us of the current integration (only if reset).
Returns
the integral since the last read-reset

Definition at line 138 of file integrator.cpp.

References _alpha, and _reset().

Here is the call graph for this function:

◆ get_and_filtered()

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).

Parameters
resetReset the integral to zero.
integral_dtGet the dt in us of the current integration (only if reset).
filtered_valThe integral differentiated by the integration time.
Returns
the integral since the last read-reset

Definition at line 150 of file integrator.cpp.

References lps22hb::reset().

Referenced by DfMPU6050Wrapper::_publish(), and DfLsm9ds1Wrapper::_publish().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

Integrator& Integrator::operator= ( const Integrator )
delete

◆ operator=() [2/2]

Integrator& Integrator::operator= ( Integrator &&  )
delete

◆ put()

bool Integrator::put ( const uint64_t &  timestamp,
const matrix::Vector3f val,
matrix::Vector3f integral,
uint32_t &  integral_dt 
)

Put an item into the integral.

Parameters
timestampTimestamp of the current value.
valItem to put.
integralCurrent integral in case the integrator did reset, else the value will not be modified
integral_dtGet the dt in us of the current integration (only if reset).
Returns
true if putting the item triggered an integral reset and the integral should be published.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ put_with_interval()

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.

Parameters
interval_usInterval in us since last integration.
valItem to put.
integralCurrent integral in case the integrator did reset, else the value will not be modified
integral_dtGet 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.
Returns
true if putting the item triggered an integral reset and the integral should be published.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_autoreset_interval()

void Integrator::set_autoreset_interval ( uint32_t  auto_reset_interval)
inline

Set auto reset interval during runtime.

This won't reset the integrator.

Parameters
auto_reset_intervalNew reset time interval for the integrator (+- 10%).

Definition at line 113 of file integrator.h.

References _auto_reset_interval.

Referenced by Integrator().

Here is the caller graph for this function:

Member Data Documentation

◆ _alpha

matrix::Vector3f Integrator::_alpha {0.0f, 0.0f, 0.0f}
private

integrated value before coning corrections are applied

Definition at line 122 of file integrator.h.

Referenced by _reset(), get(), and put().

◆ _auto_reset_interval

uint32_t Integrator::_auto_reset_interval {0}
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().

◆ _beta

matrix::Vector3f Integrator::_beta {0.0f, 0.0f, 0.0f}
private

accumulated coning corrections

Definition at line 124 of file integrator.h.

Referenced by _reset(), and put().

◆ _coning_comp_on

bool Integrator::_coning_comp_on {false}
private

true to turn on coning corrections

Definition at line 128 of file integrator.h.

Referenced by put().

◆ _last_alpha

matrix::Vector3f Integrator::_last_alpha {0.0f, 0.0f, 0.0f}
private

previous value of _alpha

Definition at line 123 of file integrator.h.

Referenced by _reset(), and put().

◆ _last_delta_alpha

matrix::Vector3f Integrator::_last_delta_alpha {0.0f, 0.0f, 0.0f}
private

integral from previous previous sampling interval

Definition at line 126 of file integrator.h.

Referenced by put().

◆ _last_integration_time

uint64_t Integrator::_last_integration_time {0}
private

timestamp of the last integration step

Definition at line 119 of file integrator.h.

Referenced by _reset(), put(), and put_with_interval().

◆ _last_reset_time

uint64_t Integrator::_last_reset_time {0}
private

last auto-announcement of integral value

Definition at line 120 of file integrator.h.

Referenced by _reset(), put(), and put_with_interval().

◆ _last_val

matrix::Vector3f Integrator::_last_val {0.0f, 0.0f, 0.0f}
private

previous input

Definition at line 125 of file integrator.h.

Referenced by put(), and put_with_interval().


The documentation for this class was generated from the following files: