I'm working with ground rover without baro, only GPS. I'm using a workaround for EKF initialization without baro (#876), but I found another issue.
If GPS data get stopped, firstly (after 5 secs) we get into controlHeightSensorTimeouts() and trying to reset to baro, but without it we are staying on GPS height fusion (_control_status.flags.gps_hgt is still set).
|
if (reset_to_baro) { |
|
startBaroHgtFusion(); |
|
|
|
request_height_reset = true; |
|
failing_height_source = "gps"; |
|
new_height_source = "baro"; |
|
|
|
} else if (!_gps_hgt_intermittent) { |
|
request_height_reset = true; |
|
failing_height_source = "gps"; |
|
new_height_source = "gps"; |
|
} |
Then (after 10 secs) we get into stopGpsFusion() where _control_status.flags.gps_hgt get cleared.
That's all. Now none of the height flags is set and controlHeightSensorTimeouts() can't do nothing and will not call startGpsHgtFusion() if GPS is available again. At the same timeGpsFusion for horizontal position is returning back normally.
Additional 'else' to controlHeightSensorTimeouts() like this fix the problem for my particular case:
} else if (_control_status.flags.ev_hgt) {
...
} else {
if (_params.vdist_sensor_type == VDIST_SENSOR_GPS) {
// check if GPS height is available
const gpsSample &gps_init = _gps_buffer.get_newest();
const bool gps_hgt_accurate = (gps_init.vacc < _params.req_vacc);
// check for inertial sensing errors in the last BADACC_PROBATION seconds
const bool prev_bad_vert_accel = isRecent(_time_bad_vert_accel, BADACC_PROBATION);
// reset to GPS if adequate GPS data is available and the timeout cannot be blamed on IMU data
const bool reset_to_gps = !_gps_hgt_intermittent &&
((gps_hgt_accurate && !prev_bad_vert_accel) || _baro_hgt_faulty);
if (reset_to_gps) {
// set height sensor health
_baro_hgt_faulty = true;
startGpsHgtFusion();
//reset sensor offset because height can drift quite far away
_hgt_sensor_offset = 0.0f;
request_height_reset = true;
failing_height_source = "";
new_height_source = "gps";
}
}
}
I suppose that issue is related to other height sources too. Also as I see even on systems with baro there still a small probability to never return to any height fusion if baro was faulty (_baro_hgt_faulty) on time of height sensor timeout.
For your note, @dagar and for addition to working on #931. Thanks!
I'm working with ground rover without baro, only GPS. I'm using a workaround for EKF initialization without baro (#876), but I found another issue.
If GPS data get stopped, firstly (after 5 secs) we get into controlHeightSensorTimeouts() and trying to reset to baro, but without it we are staying on GPS height fusion (
_control_status.flags.gps_hgtis still set).PX4-ECL/EKF/control.cpp
Lines 832 to 843 in df7f261
Then (after 10 secs) we get into stopGpsFusion() where
_control_status.flags.gps_hgtget cleared.That's all. Now none of the height flags is set and controlHeightSensorTimeouts() can't do nothing and will not call startGpsHgtFusion() if GPS is available again. At the same timeGpsFusion for horizontal position is returning back normally.
Additional 'else' to controlHeightSensorTimeouts() like this fix the problem for my particular case:
I suppose that issue is related to other height sources too. Also as I see even on systems with baro there still a small probability to never return to any height fusion if baro was faulty (_baro_hgt_faulty) on time of height sensor timeout.
For your note, @dagar and for addition to working on #931. Thanks!