Minor improvements to estimator

This commit is contained in:
Lorenz Meier
2014-05-12 11:23:48 +02:00
parent 1b3007aa81
commit 6906dc4eda
2 changed files with 9 additions and 3 deletions
@@ -1,5 +1,6 @@
#include "estimator.h"
#include <string.h>
#include <stdarg.h>
// Define EKF_DEBUG here to enable the debug print calls
// if the macro is not set, these will be completely
@@ -2119,9 +2120,7 @@ void AttPosEKF::ConstrainStates()
}
// Constrain delta velocity bias
ekf_debug("pre delta vel");
states[13] = ConstrainFloat(states[13], -1.0f * dtIMU, 1.0f * dtIMU);
ekf_debug("post delta vel");
// Wind velocity limits - assume 120 m/s max velocity
for (unsigned i = 14; i <= 15; i++) {
@@ -2483,12 +2482,18 @@ void AttPosEKF::InitializeDynamic(float (&initvelNED)[3], float declination)
void AttPosEKF::InitialiseFilter(float (&initvelNED)[3], double referenceLat, double referenceLon, float referenceHgt, float declination)
{
//store initial lat,long and height
// store initial lat,long and height
latRef = referenceLat;
lonRef = referenceLon;
hgtRef = referenceHgt;
refSet = true;
// we are at reference altitude, so measurement must be zero
hgtMea = 0.0f;
// the baro offset must be this difference now
baroHgtOffset = baroHgt - referenceHgt;
memset(&last_ekf_error, 0, sizeof(last_ekf_error));
InitializeDynamic(initvelNED, declination);
@@ -198,6 +198,7 @@ public:
float velNED[3]; // North, East, Down velocity obs (m/s)
float posNE[2]; // North, East position obs (m)
float hgtMea; // measured height (m)
float baroHgtOffset; ///< the baro (weather) offset from normalized altitude
float rngMea; // Ground distance
float posNED[3]; // North, East Down position (m)