|
|
|
@ -731,6 +731,28 @@ void Ekf::get_innovation_test_status(uint16_t *status, float *mag, float *vel, f
@@ -731,6 +731,28 @@ void Ekf::get_innovation_test_status(uint16_t *status, float *mag, float *vel, f
|
|
|
|
|
*hagl = sqrt(_terr_test_ratio); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// return a bitmask integer that describes which state estimates are valid
|
|
|
|
|
void Ekf::get_ekf_soln_status(uint16_t *status) |
|
|
|
|
{ |
|
|
|
|
ekf_solution_status soln_status; |
|
|
|
|
soln_status.flags.attitude = _control_status.flags.tilt_align && _control_status.flags.yaw_align && (_fault_status.value == 0); |
|
|
|
|
soln_status.flags.velocity_horiz = (_control_status.flags.gps || _control_status.flags.ev_pos || _control_status.flags.opt_flow) && (_fault_status.value == 0); |
|
|
|
|
soln_status.flags.velocity_vert = (_control_status.flags.baro_hgt || _control_status.flags.ev_hgt || _control_status.flags.gps_hgt || _control_status.flags.rng_hgt) && (_fault_status.value == 0); |
|
|
|
|
soln_status.flags.pos_horiz_rel = (_control_status.flags.gps || _control_status.flags.ev_pos || _control_status.flags.opt_flow) && (_fault_status.value == 0); |
|
|
|
|
soln_status.flags.pos_horiz_abs = (_control_status.flags.gps || _control_status.flags.ev_pos) && (_fault_status.value == 0); |
|
|
|
|
soln_status.flags.pos_vert_abs = soln_status.flags.velocity_vert; |
|
|
|
|
float dummy_var; |
|
|
|
|
soln_status.flags.pos_vert_agl = get_terrain_vert_pos(&dummy_var); |
|
|
|
|
soln_status.flags.const_pos_mode = !soln_status.flags.velocity_horiz; |
|
|
|
|
soln_status.flags.pred_pos_horiz_rel = soln_status.flags.pos_horiz_rel; |
|
|
|
|
soln_status.flags.pred_pos_horiz_abs = soln_status.flags.pos_vert_abs; |
|
|
|
|
bool gps_vel_innov_bad = (_vel_pos_test_ratio[0] > 1.0f) || (_vel_pos_test_ratio[1] > 1.0f); |
|
|
|
|
bool gps_pos_innov_bad = (_vel_pos_test_ratio[3] > 1.0f) || (_vel_pos_test_ratio[4] > 1.0f); |
|
|
|
|
bool mag_innov_good = (_mag_test_ratio[0] < 1.0f) && (_mag_test_ratio[1] < 1.0f) && (_mag_test_ratio[2] < 1.0f) && (_yaw_test_ratio < 1.0f); |
|
|
|
|
soln_status.flags.gps_glitch = (gps_vel_innov_bad || gps_pos_innov_bad) && mag_innov_good; |
|
|
|
|
*status = soln_status.value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// fuse measurement
|
|
|
|
|
void Ekf::fuse(float *K, float innovation) |
|
|
|
|
{ |
|
|
|
|