mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 06:03:34 +08:00
ekf2: move flow buffer pop to controlOpticalFlowFusion
This commit is contained in:
@@ -174,15 +174,6 @@ void Ekf::controlFusionModes(const imuSample &imu_delayed)
|
|||||||
_control_status.flags.rng_kin_consistent = _rng_consistency_check.isKinematicallyConsistent();
|
_control_status.flags.rng_kin_consistent = _rng_consistency_check.isKinematicallyConsistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_flow_buffer) {
|
|
||||||
// We don't fuse flow data immediately because we have to wait for the mid integration point to fall behind the fusion time horizon.
|
|
||||||
// This means we stop looking for new data until the old data has been fused, unless we are not fusing optical flow,
|
|
||||||
// in this case we need to empty the buffer
|
|
||||||
if (!_flow_data_ready || (!_control_status.flags.opt_flow && !_hagl_sensor_status.flags.flow)) {
|
|
||||||
_flow_data_ready = _flow_buffer->pop_first_older_than(imu_delayed.time_us, &_flow_sample_delayed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_airspeed_buffer) {
|
if (_airspeed_buffer) {
|
||||||
_tas_data_ready = _airspeed_buffer->pop_first_older_than(imu_delayed.time_us, &_airspeed_sample_delayed);
|
_tas_data_ready = _airspeed_buffer->pop_first_older_than(imu_delayed.time_us, &_airspeed_sample_delayed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,15 @@
|
|||||||
|
|
||||||
void Ekf::controlOpticalFlowFusion(const imuSample &imu_delayed)
|
void Ekf::controlOpticalFlowFusion(const imuSample &imu_delayed)
|
||||||
{
|
{
|
||||||
|
if (_flow_buffer) {
|
||||||
|
// We don't fuse flow data immediately because we have to wait for the mid integration point to fall behind the fusion time horizon.
|
||||||
|
// This means we stop looking for new data until the old data has been fused, unless we are not fusing optical flow,
|
||||||
|
// in this case we need to empty the buffer
|
||||||
|
if (!_flow_data_ready || (!_control_status.flags.opt_flow && !_hagl_sensor_status.flags.flow)) {
|
||||||
|
_flow_data_ready = _flow_buffer->pop_first_older_than(imu_delayed.time_us, &_flow_sample_delayed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if on ground motion is un-suitable for use of optical flow
|
// Check if on ground motion is un-suitable for use of optical flow
|
||||||
if (!_control_status.flags.in_air) {
|
if (!_control_status.flags.in_air) {
|
||||||
updateOnGroundMotionForOpticalFlowChecks();
|
updateOnGroundMotionForOpticalFlowChecks();
|
||||||
|
|||||||
Reference in New Issue
Block a user