PX4 sensor driver helpers

This commit is contained in:
Daniel Agar
2019-01-18 10:39:15 -05:00
parent a2e9d9ffce
commit 91dcfb7ab2
12 changed files with 826 additions and 14 deletions
+5 -5
View File
@@ -48,7 +48,7 @@
class Integrator
{
public:
Integrator(uint64_t auto_reset_interval = 4000 /* 250 Hz */, bool coning_compensation = false);
Integrator(uint32_t auto_reset_interval = 4000 /* 250 Hz */, bool coning_compensation = false);
~Integrator() = default;
// no copy, assignment, move, move assignment
@@ -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, uint32_t &integral_dt);
bool put(const uint64_t &timestamp, const matrix::Vector3f &val, matrix::Vector3f &integral, uint32_t &integral_dt);
/**
* Put an item into the integral but provide an interval instead of a timestamp.
@@ -108,12 +108,12 @@ public:
/**
* Set auto reset interval during runtime. This won't reset the integrator.
*
* @param auto_reset_interval New reset time interval for the integrator.
* @param auto_reset_interval New reset time interval for the integrator (+- 10%).
*/
void set_autoreset_interval(uint64_t auto_reset_interval) { _auto_reset_interval = auto_reset_interval; }
void set_autoreset_interval(uint32_t auto_reset_interval) { _auto_reset_interval = 0.90f * auto_reset_interval; }
private:
uint64_t _auto_reset_interval{0}; /**< the interval after which the content will be published
uint32_t _auto_reset_interval{0}; /**< the interval after which the content will be published
and the integrator reset, 0 if no auto-reset */
uint64_t _last_integration_time{0}; /**< timestamp of the last integration step */