flow: restructure optical flow control logic (#928)

- extract motion checks performed on ground
- move all non-timing check to controlOpticalFlowFusion. This simplifies and standardirzes the setOpticalFlowData function. Furthermore, in some cases (SITL, PX4Flow), the dt is forced to 0 when the quality is 0 (which is usual on ground) so the ekf needs to ignore those values on ground to initialize properly the flow fusion.
- add filter convergence test
- move check for dt time max in setOpticalFlowData
- in the simulator, do not update dt as this is the sensor integration
period.
This commit is contained in:
Mathieu Bresciani
2020-12-09 11:33:00 +01:00
committed by GitHub
parent 38358002bb
commit 8f3df7a97b
9 changed files with 193 additions and 147 deletions
+6 -7
View File
@@ -15,7 +15,6 @@ Flow::~Flow()
void Flow::send(uint64_t time)
{
_flow_data.dt = static_cast<float>(time - _time_last_data_sent) * 1e-6f;
_flow_data.time_us = time;
_ekf->setOpticalFlowData(_flow_data);
}
@@ -28,12 +27,12 @@ void Flow::setData(const flowSample& flow)
flowSample Flow::dataAtRest()
{
flowSample _flow_at_rest;
_flow_at_rest.dt = 0.02f;
_flow_at_rest.flow_xy_rad = Vector2f{0.0f, 0.0f};
_flow_at_rest.gyro_xyz = Vector3f{0.0f, 0.0f, 0.0f};
_flow_at_rest.quality = 255;
return _flow_at_rest;
flowSample flow_at_rest;
flow_at_rest.dt = static_cast<float>(_update_period) * 1e-6f;
flow_at_rest.flow_xy_rad = Vector2f{0.0f, 0.0f};
flow_at_rest.gyro_xyz = Vector3f{0.0f, 0.0f, 0.0f};
flow_at_rest.quality = 255;
return flow_at_rest;
}
} // namespace sensor