Browse Source

EKF: Add reporting of inertial dead-reckoning status

master
Paul Riseborough 8 years ago committed by Lorenz Meier
parent
commit
d22599b440
  1. 3
      EKF/ekf.h
  2. 12
      EKF/ekf_helper.cpp
  3. 3
      EKF/estimator_interface.h

3
EKF/ekf.h

@ -139,6 +139,9 @@ public: @@ -139,6 +139,9 @@ public:
// return true if the global position estimate is valid
bool global_position_is_valid();
// return true if the EKF is dead reckoning the position using inertial data only
bool inertial_dead_reckoning();
// return true if the etimate is valid
// return the estimated terrain vertical position relative to the NED origin
bool get_terrain_vert_pos(float *ret);

12
EKF/ekf_helper.cpp

@ -741,7 +741,7 @@ void Ekf::get_ekf_accuracy(float *ekf_eph, float *ekf_epv, bool *dead_reckoning) @@ -741,7 +741,7 @@ void Ekf::get_ekf_accuracy(float *ekf_eph, float *ekf_epv, bool *dead_reckoning)
}
// report dead reckoning if it is more than a second since we fused in position measurements
bool is_dead_reckoning = (_time_last_imu - _time_last_pos_fuse > 1e6) && vel_pos_aiding;
bool is_dead_reckoning = (_time_last_imu - _time_last_pos_fuse > 1e6);
memcpy(ekf_eph, &hpos_err, sizeof(float));
memcpy(ekf_epv, &vpos_err, sizeof(float));
@ -857,6 +857,16 @@ bool Ekf::global_position_is_valid() @@ -857,6 +857,16 @@ bool Ekf::global_position_is_valid()
return (_NED_origin_initialised && ((_time_last_imu - _time_last_gps) < 5e6) && _control_status.flags.gps);
}
// return true if we are totally reliant on inertial dead-reckoning for position
bool Ekf::inertial_dead_reckoning()
{
bool velPosAiding = (_control_status.flags.gps || _control_status.flags.ev_pos) && ((_time_last_imu - _time_last_pos_fuse <= 1E6) || (_time_last_imu - _time_last_vel_fuse <= 1E6));
bool optFlowAiding = _control_status.flags.opt_flow && (_time_last_imu - _time_last_of_fuse <= 1E6);
bool airDataAiding = _control_status.flags.wind && (_time_last_imu - _time_last_arsp_fuse <= 1E6);
return !velPosAiding && !optFlowAiding && !airDataAiding;
}
// perform a vector cross product
Vector3f EstimatorInterface::cross_product(const Vector3f &vecIn1, const Vector3f &vecIn2)
{

3
EKF/estimator_interface.h

@ -175,6 +175,9 @@ public: @@ -175,6 +175,9 @@ public:
// return true if the global position estimate is valid
virtual bool global_position_is_valid() = 0;
// return true if the EKF is dead reckoning the position using inertial data only
virtual bool inertial_dead_reckoning() = 0;
// return true if the estimate is valid
// return the estimated terrain vertical position relative to the NED origin
virtual bool get_terrain_vert_pos(float *ret) = 0;

Loading…
Cancel
Save