Skip to content

Commit

Permalink
Merge pull request PX4#98 from priseborough/pr-ekf2StatusReporting
Browse files Browse the repository at this point in the history
EKF: improve reporting of filter status
  • Loading branch information
LorenzMeier committed Apr 20, 2016
2 parents 6344fa0 + 2fa8a11 commit 9487eac
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions EKF/ekf.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ class Ekf : public EstimatorInterface

void get_accel_bias(float *bias) {*bias = _state.accel_z_bias;}

// get GPS check status
void get_gps_check_status(uint16_t *_gps_check_fail_status);

private:

static const uint8_t _k_num_states = 24;
Expand Down
6 changes: 6 additions & 0 deletions EKF/ekf_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ void Ekf::get_heading_innov_var(float *heading_innov_var)
memcpy(heading_innov_var, &_heading_innov_var, sizeof(float));
}

// get GPS check status
void Ekf::get_gps_check_status(uint16_t *val)
{
*val = _gps_check_fail_status.value;
}

// get the state vector at the delayed time horizon
void Ekf::get_state_delayed(float *state)
{
Expand Down
2 changes: 1 addition & 1 deletion EKF/estimator_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,5 +366,5 @@ void EstimatorInterface::unallocate_buffers()
bool EstimatorInterface::local_position_is_valid()
{
// return true if the position estimate is valid
return ((_time_last_imu - _time_last_optflow) < 5e6) || global_position_is_valid();
return (((_time_last_imu - _time_last_optflow) < 5e6) && _control_status.flags.opt_flow) || global_position_is_valid();
}
9 changes: 9 additions & 0 deletions EKF/estimator_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ class EstimatorInterface

virtual void get_accel_bias(float *bias) = 0;

// get EKF mode status
void get_control_mode(uint16_t *val)
{
*val = _control_status.value;
}

// get GPS check status
virtual void get_gps_check_status(uint16_t *val) = 0;

protected:

parameters _params; // filter parameters
Expand Down

0 comments on commit 9487eac

Please sign in to comment.