mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-16 14:30:34 +08:00
Integrator: use 32bit integer to store dt to avoid overflow
Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
@@ -55,7 +55,7 @@ public:
|
||||
~Integrator() = default;
|
||||
|
||||
static constexpr float DT_MIN{1e-6f}; // 1 microsecond
|
||||
static constexpr float DT_MAX{static_cast<float>(UINT16_MAX) * 1e-6f};
|
||||
static constexpr float DT_MAX{static_cast<float>(UINT32_MAX) * 1e-6f};
|
||||
|
||||
/**
|
||||
* Put an item into the integral.
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
* @param integral_dt Get the dt in us of the current integration.
|
||||
* @return true if integral valid
|
||||
*/
|
||||
bool reset(matrix::Vector3f &integral, uint16_t &integral_dt)
|
||||
bool reset(matrix::Vector3f &integral, uint32_t &integral_dt)
|
||||
{
|
||||
if (integral_ready()) {
|
||||
integral = _alpha;
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
* @param integral_dt Get the dt in us of the current integration.
|
||||
* @return true if integral valid
|
||||
*/
|
||||
bool reset(matrix::Vector3f &integral, uint16_t &integral_dt)
|
||||
bool reset(matrix::Vector3f &integral, uint32_t &integral_dt)
|
||||
{
|
||||
if (Integrator::reset(integral, integral_dt)) {
|
||||
// apply coning corrections
|
||||
|
||||
Reference in New Issue
Block a user