EKF: improve compatibility with ARM cross compiler

This change removes the following compiler error when building using the ARM cross compiler.

/Users/paul/src/Firmware/src/lib/ecl/EKF/ekf_helper.cpp:45:12: error: 'std::abs' has not been declared
 using std::abs;
This commit is contained in:
Paul Riseborough 2017-03-13 08:46:55 +11:00 committed by Lorenz Meier
parent 9bb54ccc08
commit f7cae7f3ab
1 changed files with 2 additions and 3 deletions

View File

@ -41,8 +41,7 @@
#include "ekf.h"
#include "mathlib.h"
using std::abs;
#include <cstdlib>
// Reset the velocity states. If we have a recent and valid
// gps measurement then use for velocity initialisation
@ -231,7 +230,7 @@ void Ekf::resetHeight()
// use the most recent data if it's time offset from the fusion time horizon is smaller
int32_t dt_newest = ev_newest.time_us - _imu_sample_delayed.time_us;
int32_t dt_delayed = _ev_sample_delayed.time_us - _imu_sample_delayed.time_us;
if (abs(dt_newest) < abs(dt_delayed)) {
if (std::abs(dt_newest) < std::abs(dt_delayed)) {
_state.pos(2) = ev_newest.posNED(2);
} else {
_state.pos(2) = _ev_sample_delayed.posNED(2);