forked from Archive/PX4-Autopilot
Merge branch 'master' of github.com:PX4/Firmware into airspeed_test_fix
This commit is contained in:
commit
07d92c264c
|
@ -712,8 +712,8 @@ FixedwingEstimator::task_main()
|
|||
/* sets also parameters in the EKF object */
|
||||
parameters_update();
|
||||
|
||||
Vector3f lastAngRate = {0.0f, 0.0f, 0.0f};
|
||||
Vector3f lastAccel = {0.0f, 0.0f, 0.0f};
|
||||
Vector3f lastAngRate;
|
||||
Vector3f lastAccel;
|
||||
|
||||
/* wakeup source(s) */
|
||||
struct pollfd fds[2];
|
||||
|
|
|
@ -5,47 +5,120 @@
|
|||
|
||||
#define EKF_COVARIANCE_DIVERGED 1.0e8f
|
||||
|
||||
AttPosEKF::AttPosEKF()
|
||||
AttPosEKF::AttPosEKF() :
|
||||
covTimeStepMax(0.0f),
|
||||
covDelAngMax(0.0f),
|
||||
rngFinderPitch(0.0f),
|
||||
a1(0.0f),
|
||||
a2(0.0f),
|
||||
a3(0.0f),
|
||||
yawVarScale(0.0f),
|
||||
windVelSigma(0.0f),
|
||||
dAngBiasSigma(0.0f),
|
||||
dVelBiasSigma(0.0f),
|
||||
magEarthSigma(0.0f),
|
||||
magBodySigma(0.0f),
|
||||
gndHgtSigma(0.0f),
|
||||
vneSigma(0.0f),
|
||||
vdSigma(0.0f),
|
||||
posNeSigma(0.0f),
|
||||
posDSigma(0.0f),
|
||||
magMeasurementSigma(0.0f),
|
||||
airspeedMeasurementSigma(0.0f),
|
||||
gyroProcessNoise(0.0f),
|
||||
accelProcessNoise(0.0f),
|
||||
EAS2TAS(1.0f),
|
||||
magstate{},
|
||||
resetMagState{},
|
||||
KH{},
|
||||
KHP{},
|
||||
P{},
|
||||
Kfusion{},
|
||||
states{},
|
||||
resetStates{},
|
||||
storedStates{},
|
||||
statetimeStamp{},
|
||||
statesAtVelTime{},
|
||||
statesAtPosTime{},
|
||||
statesAtHgtTime{},
|
||||
statesAtMagMeasTime{},
|
||||
statesAtVtasMeasTime{},
|
||||
statesAtRngTime{},
|
||||
statesAtOptFlowTime{},
|
||||
correctedDelAng(),
|
||||
correctedDelVel(),
|
||||
summedDelAng(),
|
||||
summedDelVel(),
|
||||
accNavMag(),
|
||||
earthRateNED(),
|
||||
angRate(),
|
||||
lastGyroOffset(),
|
||||
delAngTotal(),
|
||||
Tbn(),
|
||||
Tnb(),
|
||||
accel(),
|
||||
dVelIMU(),
|
||||
dAngIMU(),
|
||||
dtIMU(0),
|
||||
fusionModeGPS(0),
|
||||
innovVelPos{},
|
||||
varInnovVelPos{},
|
||||
velNED{},
|
||||
accelGPSNED{},
|
||||
posNE{},
|
||||
hgtMea(0.0f),
|
||||
baroHgtOffset(0.0f),
|
||||
rngMea(0.0f),
|
||||
innovMag{},
|
||||
varInnovMag{},
|
||||
magData{},
|
||||
losData{},
|
||||
innovVtas(0.0f),
|
||||
innovRng(0.0f),
|
||||
innovOptFlow{},
|
||||
varInnovOptFlow{},
|
||||
varInnovVtas(0.0f),
|
||||
varInnovRng(0.0f),
|
||||
VtasMeas(0.0f),
|
||||
magDeclination(0.0f),
|
||||
latRef(0.0f),
|
||||
lonRef(-M_PI_F),
|
||||
hgtRef(0.0f),
|
||||
refSet(false),
|
||||
magBias(),
|
||||
covSkipCount(0),
|
||||
gpsLat(0.0),
|
||||
gpsLon(-M_PI),
|
||||
gpsHgt(0.0f),
|
||||
GPSstatus(0),
|
||||
baroHgt(0.0f),
|
||||
statesInitialised(false),
|
||||
fuseVelData(false),
|
||||
fusePosData(false),
|
||||
fuseHgtData(false),
|
||||
fuseMagData(false),
|
||||
fuseVtasData(false),
|
||||
fuseRngData(false),
|
||||
fuseOptFlowData(false),
|
||||
|
||||
/* NOTE: DO NOT initialize class members here. Use ZeroVariables()
|
||||
* instead to allow clean in-air re-initialization.
|
||||
*/
|
||||
inhibitWindStates(true),
|
||||
inhibitMagStates(true),
|
||||
inhibitGndHgtState(true),
|
||||
|
||||
onGround(true),
|
||||
staticMode(true),
|
||||
useAirspeed(true),
|
||||
useCompass(true),
|
||||
useRangeFinder(false),
|
||||
useOpticalFlow(false),
|
||||
|
||||
ekfDiverged(false),
|
||||
lastReset(0),
|
||||
current_ekf_state{},
|
||||
last_ekf_error{},
|
||||
numericalProtection(true),
|
||||
storeIndex(0)
|
||||
{
|
||||
summedDelAng.zero();
|
||||
summedDelVel.zero();
|
||||
|
||||
fusionModeGPS = 0;
|
||||
fuseVelData = false;
|
||||
fusePosData = false;
|
||||
fuseHgtData = false;
|
||||
fuseMagData = false;
|
||||
fuseVtasData = false;
|
||||
onGround = true;
|
||||
staticMode = true;
|
||||
useAirspeed = true;
|
||||
useCompass = true;
|
||||
useRangeFinder = true;
|
||||
useOpticalFlow = true;
|
||||
numericalProtection = true;
|
||||
refSet = false;
|
||||
storeIndex = 0;
|
||||
gpsHgt = 0.0f;
|
||||
baroHgt = 0.0f;
|
||||
GPSstatus = 0;
|
||||
VtasMeas = 0.0f;
|
||||
magDeclination = 0.0f;
|
||||
dAngIMU.zero();
|
||||
dVelIMU.zero();
|
||||
velNED[0] = 0.0f;
|
||||
velNED[1] = 0.0f;
|
||||
velNED[2] = 0.0f;
|
||||
accelGPSNED[0] = 0.0f;
|
||||
accelGPSNED[1] = 0.0f;
|
||||
accelGPSNED[2] = 0.0f;
|
||||
delAngTotal.zero();
|
||||
ekfDiverged = false;
|
||||
lastReset = 0;
|
||||
|
||||
memset(&last_ekf_error, 0, sizeof(last_ekf_error));
|
||||
memset(¤t_ekf_state, 0, sizeof(current_ekf_state));
|
||||
ZeroVariables();
|
||||
|
@ -73,7 +146,7 @@ void AttPosEKF::UpdateStrapdownEquationsNED()
|
|||
float qUpdated[4];
|
||||
float quatMag;
|
||||
float deltaQuat[4];
|
||||
const Vector3f gravityNED = {0.0,0.0,GRAVITY_MSS};
|
||||
const Vector3f gravityNED(0.0f, 0.0f, GRAVITY_MSS);
|
||||
|
||||
// Remove sensor bias errors
|
||||
correctedDelAng.x = dAngIMU.x - states[10];
|
||||
|
@ -2280,7 +2353,7 @@ float AttPosEKF::ConstrainFloat(float val, float min, float max)
|
|||
}
|
||||
|
||||
if (!isfinite(val)) {
|
||||
ekf_debug("constrain: non-finite!");
|
||||
//ekf_debug("constrain: non-finite!");
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2926,6 +2999,8 @@ void AttPosEKF::ZeroVariables()
|
|||
correctedDelAng.zero();
|
||||
summedDelAng.zero();
|
||||
summedDelVel.zero();
|
||||
dAngIMU.zero();
|
||||
dVelIMU.zero();
|
||||
lastGyroOffset.zero();
|
||||
|
||||
for (unsigned i = 0; i < data_buffer_size; i++) {
|
||||
|
|
|
@ -172,8 +172,6 @@ public:
|
|||
unsigned covSkipCount; // Number of state prediction frames (IMU daya updates to skip before doing the covariance prediction
|
||||
|
||||
// GPS input data variables
|
||||
float gpsCourse;
|
||||
float gpsVelD;
|
||||
double gpsLat;
|
||||
double gpsLon;
|
||||
float gpsHgt;
|
||||
|
|
|
@ -19,6 +19,12 @@ public:
|
|||
float y;
|
||||
float z;
|
||||
|
||||
Vector3f(float a=0.0f, float b=0.0f, float c=0.0f) :
|
||||
x(a),
|
||||
y(b),
|
||||
z(c)
|
||||
{}
|
||||
|
||||
float length(void) const;
|
||||
void zero(void);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue