sensor messages remove unused fields and improve comments

This commit is contained in:
Daniel Agar
2018-07-29 21:04:21 +02:00
committed by Lorenz Meier
parent fc8a05f636
commit cc96e5ec5e
33 changed files with 57 additions and 128 deletions
+9 -14
View File
@@ -51,7 +51,7 @@ Integrator::Integrator(uint64_t auto_reset_interval, bool coning_compensation) :
}
bool
Integrator::put(uint64_t timestamp, matrix::Vector3f &val, matrix::Vector3f &integral, uint64_t &integral_dt)
Integrator::put(uint64_t timestamp, matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt)
{
if (_last_integration_time == 0) {
/* this is the first item in the integrator */
@@ -115,7 +115,7 @@ Integrator::put(uint64_t timestamp, matrix::Vector3f &val, matrix::Vector3f &int
bool
Integrator::put_with_interval(unsigned interval_us, matrix::Vector3f &val, matrix::Vector3f &integral,
uint64_t &integral_dt)
uint32_t &integral_dt)
{
if (_last_integration_time == 0) {
/* this is the first item in the integrator */
@@ -134,7 +134,7 @@ Integrator::put_with_interval(unsigned interval_us, matrix::Vector3f &val, matri
}
matrix::Vector3f
Integrator::get(bool reset, uint64_t &integral_dt)
Integrator::get(bool reset, uint32_t &integral_dt)
{
matrix::Vector3f val = _alpha;
@@ -146,7 +146,7 @@ Integrator::get(bool reset, uint64_t &integral_dt)
}
matrix::Vector3f
Integrator::get_and_filtered(bool reset, uint64_t &integral_dt, matrix::Vector3f &filtered_val)
Integrator::get_and_filtered(bool reset, uint32_t &integral_dt, matrix::Vector3f &filtered_val)
{
// Do the usual get with reset first but don't return yet.
matrix::Vector3f ret_integral = get(reset, integral_dt);
@@ -160,18 +160,13 @@ Integrator::get_and_filtered(bool reset, uint64_t &integral_dt, matrix::Vector3f
}
void
Integrator::_reset(uint64_t &integral_dt)
Integrator::_reset(uint32_t &integral_dt)
{
_alpha(0) = 0.0f;
_alpha(1) = 0.0f;
_alpha(2) = 0.0f;
_last_alpha(0) = 0.0f;
_last_alpha(1) = 0.0f;
_last_alpha(2) = 0.0f;
_beta(0) = 0.0f;
_beta(1) = 0.0f;
_beta(2) = 0.0f;
_alpha.zero();
_last_alpha.zero();
_beta.zero();
integral_dt = (_last_integration_time - _last_reset_time);
_last_reset_time = _last_integration_time;
}
+5 -6
View File
@@ -67,7 +67,7 @@ public:
* @return true if putting the item triggered an integral reset and the integral should be
* published.
*/
bool put(uint64_t timestamp, matrix::Vector3f &val, matrix::Vector3f &integral, uint64_t &integral_dt);
bool put(uint64_t timestamp, matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt);
/**
* Put an item into the integral but provide an interval instead of a timestamp.
@@ -81,8 +81,7 @@ public:
* @return true if putting the item triggered an integral reset and the integral should be
* published.
*/
bool put_with_interval(unsigned interval_us, matrix::Vector3f &val, matrix::Vector3f &integral,
uint64_t &integral_dt);
bool put_with_interval(unsigned interval_us, matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt);
/**
* Get the current integral and reset the integrator if needed.
@@ -91,7 +90,7 @@ public:
* @param integral_dt Get the dt in us of the current integration (only if reset).
* @return the integral since the last read-reset
*/
matrix::Vector3f get(bool reset, uint64_t &integral_dt);
matrix::Vector3f get(bool reset, uint32_t &integral_dt);
/**
@@ -103,7 +102,7 @@ public:
* @param filtered_val The integral differentiated by the integration time.
* @return the integral since the last read-reset
*/
matrix::Vector3f get_and_filtered(bool reset, uint64_t &integral_dt, matrix::Vector3f &filtered_val);
matrix::Vector3f get_and_filtered(bool reset, uint32_t &integral_dt, matrix::Vector3f &filtered_val);
/**
@@ -132,5 +131,5 @@ private:
*
* @param integral_dt Get the dt in us of the current integration.
*/
void _reset(uint64_t &integral_dt);
void _reset(uint32_t &integral_dt);
};