mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 03:03:34 +08:00
Expand test framework and test cases (#685)
* Fix comment * Ekf wrapper for testing Add utility function for accessing information in the ekf object * Add step function for Gps sensor * Add RangeFinder and Flow to simulated sensors * Add first fusion logic tests * Add units to function name * Use EXPECT_TRUE * Adding missing qualifiers * Improve EXPECT_ calls * Improve naming
This commit is contained in:
+1
-1
@@ -76,7 +76,7 @@ struct flow_message {
|
||||
uint8_t quality; ///< Quality of Flow data
|
||||
Vector2f flowdata; ///< Optical flow rates about the X and Y body axes (rad/sec)
|
||||
Vector3f gyrodata; ///< Gyro rates about the XYZ body axes (rad/sec)
|
||||
uint32_t dt; ///< integration time of flow samples (sec)
|
||||
uint32_t dt; ///< integration time of flow samples (microseconds)
|
||||
};
|
||||
|
||||
struct ext_vision_message {
|
||||
|
||||
@@ -401,6 +401,7 @@ void Ekf::controlExternalVisionFusion()
|
||||
|
||||
void Ekf::controlOpticalFlowFusion()
|
||||
{
|
||||
// TODO: These motion checks run all the time. Pull them out of this function
|
||||
// Check if on ground motion is un-suitable for use of optical flow
|
||||
if (!_control_status.flags.in_air) {
|
||||
// When on ground check if the vehicle is being shaken or moved in a way that could cause a loss of navigation
|
||||
|
||||
@@ -344,7 +344,7 @@ void EstimatorInterface::setRangeData(uint64_t time_usec, float data, int8_t qua
|
||||
}
|
||||
}
|
||||
|
||||
// set optical flow data
|
||||
// TODO: Change pointer to constant reference
|
||||
void EstimatorInterface::setOpticalFlowData(uint64_t time_usec, flow_message *flow)
|
||||
{
|
||||
if (!_initialised || _flow_buffer_fail) {
|
||||
@@ -366,7 +366,7 @@ void EstimatorInterface::setOpticalFlowData(uint64_t time_usec, flow_message *fl
|
||||
if ((time_usec - _time_last_optflow) > _min_obs_interval_us) {
|
||||
// check if enough integration time and fail if integration time is less than 50%
|
||||
// of min arrival interval because too much data is being lost
|
||||
float delta_time = 1e-6f * (float)flow->dt;
|
||||
float delta_time = 1e-6f * (float)flow->dt; // in seconds
|
||||
float delta_time_min = 5e-7f * (float)_min_obs_interval_us;
|
||||
bool delta_time_good = delta_time >= delta_time_min;
|
||||
|
||||
@@ -407,7 +407,6 @@ void EstimatorInterface::setOpticalFlowData(uint64_t time_usec, flow_message *fl
|
||||
optflow_sample_new.gyroXYZ = - flow->gyrodata;
|
||||
optflow_sample_new.flowRadXY = -flow->flowdata;
|
||||
|
||||
// convert integration interval to seconds
|
||||
optflow_sample_new.dt = delta_time;
|
||||
_time_last_optflow = time_usec;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user