Split publishing of local position into horiz and vert components with separate validity checks
Split status reporting into separate update and get functions and only update once after each loop update. This removes unnecessary re-calculation of the status logic and ensures all consumers get the same data (avoid possible race conditions).
master
priseborough9 years agocommitted byAndrew Tridgell
// Return the last calculated NED position relative to the reference point (m).
// Return the last calculated NE position relative to the reference point (m).
// if a calculated solution is not available, use the best available data and return false
boolNavEKF_core::getPosNED(Vector3f&pos)const
boolNavEKF_core::getPosNE(Vector2f&posNE)const
{
// The EKF always has a height estimate regardless of mode of operation
pos.z=state.position.z;
// There are three modes of operation, absolute position (GPS fusion), relative position (optical flow fusion) and constant position (no position estimate available)
status.flags.const_pos_mode=constPosMode&&filterHealthy;// constant position mode
status.flags.pred_horiz_pos_rel=(optFlowNavPossible||gpsNavPossible)&&filterHealthy&&gyroHealthy;// we should be able to estimate a relative position when we enter flight mode
status.flags.pred_horiz_pos_abs=gpsNavPossible&&filterHealthy&&gyroHealthy;// we should be able to estimate an absolute position when we enter flight mode
status.flags.takeoff_detected=takeOffDetected;// takeoff for optical flow navigation has been detected
status.flags.takeoff=expectGndEffectTakeoff;// The EKF has been told to expect takeoff and is in a ground effect mitigation mode
status.flags.touchdown=expectGndEffectTouchdown;// The EKF has been told to detect touchdown and is in a ground effect mitigation mode
filterStatus.flags.const_pos_mode=constPosMode&&filterHealthy;// constant position mode
filterStatus.flags.pred_horiz_pos_rel=(optFlowNavPossible||gpsNavPossible)&&filterHealthy&&gyroHealthy;// we should be able to estimate a relative position when we enter flight mode
filterStatus.flags.pred_horiz_pos_abs=gpsNavPossible&&filterHealthy&&gyroHealthy;// we should be able to estimate an absolute position when we enter flight mode
filterStatus.flags.takeoff_detected=takeOffDetected;// takeoff for optical flow navigation has been detected
filterStatus.flags.takeoff=expectGndEffectTakeoff;// The EKF has been told to expect takeoff and is in a ground effect mitigation mode
filterStatus.flags.touchdown=expectGndEffectTouchdown;// The EKF has been told to detect touchdown and is in a ground effect mitigation mode
Vector3fdelAngBiasAtArming;// value of the gyro delta angle bias at arming
floathgtInnovFiltState;// state used for fitering of the height innovations used for pre-flight checks
QuaternionprevQuatMagReset;// Quaternion from the previous frame that the magnetic field state reset condition test was performed
nav_filter_statusfilterStatus;// contains the status of various filter outputs
// Used by smoothing of state corrections
Vector10gpsIncrStateDelta;// vector of corrections to attitude, velocity and position to be applied over the period between the current and next GPS measurement