mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 03:50:34 +08:00
Update optical flow interface
This commit is contained in:
@@ -16,21 +16,22 @@ Flow::~Flow()
|
||||
void Flow::send(uint64_t time)
|
||||
{
|
||||
_flow_data.dt = time - _time_last_data_sent;
|
||||
_ekf->setOpticalFlowData(time, &_flow_data);
|
||||
_flow_data.time_us = time;
|
||||
_ekf->setOpticalFlowData(_flow_data);
|
||||
}
|
||||
|
||||
void Flow::setData(const flow_message& flow)
|
||||
void Flow::setData(const flowSample& flow)
|
||||
{
|
||||
_flow_data = flow;
|
||||
|
||||
}
|
||||
|
||||
flow_message Flow::dataAtRest()
|
||||
flowSample Flow::dataAtRest()
|
||||
{
|
||||
flow_message _flow_at_rest;
|
||||
_flow_at_rest.dt = 20000;
|
||||
_flow_at_rest.flowdata = Vector2f{0.0f, 0.0f};
|
||||
_flow_at_rest.gyrodata = Vector3f{0.0f, 0.0f, 0.0f};
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
Flow(std::shared_ptr<Ekf> ekf);
|
||||
~Flow();
|
||||
|
||||
void setData(const flow_message& flow);
|
||||
flow_message dataAtRest();
|
||||
void setData(const flowSample& flow);
|
||||
flowSample dataAtRest();
|
||||
|
||||
private:
|
||||
flow_message _flow_data;
|
||||
flowSample _flow_data;
|
||||
|
||||
void send(uint64_t time) override;
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ public:
|
||||
~RangeFinder();
|
||||
|
||||
void setData(float range_data, int8_t range_quality);
|
||||
flow_message dataAtRest();
|
||||
|
||||
private:
|
||||
rangeSample _range_sample {};
|
||||
|
||||
@@ -161,8 +161,7 @@ TEST_F(EkfFusionLogicTest, doFlowFusion)
|
||||
|
||||
// WHEN: Flow data is not send and we enable flow fusion
|
||||
_sensor_simulator.stopFlow();
|
||||
_sensor_simulator.runSeconds(3); // TODO: without this line tests fail
|
||||
// probably there are still values in the buffer.
|
||||
_sensor_simulator.runSeconds(1); // empty buffer
|
||||
_ekf_wrapper.enableFlowFusion();
|
||||
_sensor_simulator.runSeconds(3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user