mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 13:17:36 +08:00
ECL Unit Test Clean Up
This commit is contained in:
committed by
Mathieu Bresciani
parent
6b25dbd6c7
commit
2d2edd90e3
@@ -34,9 +34,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <math.h>
|
||||
#include "EKF/ekf.h"
|
||||
#include "SensorSimulator.h"
|
||||
#include "SensorSimulator/SensorSimulator.h"
|
||||
|
||||
using namespace simulator;
|
||||
|
||||
class EkfInitializationTest : public ::testing::Test {
|
||||
public:
|
||||
@@ -54,7 +53,7 @@ class EkfInitializationTest : public ::testing::Test {
|
||||
_ekf->init(0);
|
||||
_sensor_simulator = new SensorSimulator(_ekf);
|
||||
|
||||
_sensor_simulator->update_with_const_sensors(_init_duration_us);
|
||||
_sensor_simulator->run(_init_duration_us);
|
||||
}
|
||||
|
||||
// Use this method to clean up any memory, network etc. after each test
|
||||
@@ -111,7 +110,7 @@ TEST_F(EkfInitializationTest, convergesToZero)
|
||||
{
|
||||
// GIVEN: initialized EKF with default IMU, baro and mag input for 2s
|
||||
// WHEN: Added more defautl sensor measurements
|
||||
_sensor_simulator->update_with_const_sensors(4000000); // for further 4s
|
||||
_sensor_simulator->run(4000000); // for further 4s
|
||||
|
||||
float converged_pos[3];
|
||||
float converged_vel[3];
|
||||
@@ -137,8 +136,8 @@ TEST_F(EkfInitializationTest, gpsFusion)
|
||||
// GIVEN: initialized EKF with default IMU, baro and mag input for 2s
|
||||
// WHEN: setting GPS measurements for 11s, minimum GPS health time is set to 10 sec
|
||||
|
||||
_sensor_simulator->setGpsFusionTrue();
|
||||
_sensor_simulator->update_with_const_sensors(11000000,Vector3f{0.0f,0.0f,0.0f},Vector3f{0.0f,0.0f,-CONSTANTS_ONE_G}); // for further 3s
|
||||
_sensor_simulator->startGps();
|
||||
_sensor_simulator->run(11000000); // for further 3s
|
||||
|
||||
// THEN: EKF should fuse GPS, but no other position sensor
|
||||
filter_control_status_u control_status;
|
||||
@@ -176,8 +175,9 @@ TEST_F(EkfInitializationTest, accleBiasEstimation)
|
||||
// WHEN: Added more sensor measurements with accel bias and gps measurements
|
||||
Vector3f accel_bias = {0.0f,0.0f,0.1f};
|
||||
|
||||
_sensor_simulator->setGpsFusionTrue();
|
||||
_sensor_simulator->update_with_const_sensors(10000000,Vector3f{0.0f,0.0f,0.0f},Vector3f{0.0f,0.0f,-CONSTANTS_ONE_G}+accel_bias); // for further 10s
|
||||
_sensor_simulator->startGps();
|
||||
_sensor_simulator->setImuBias(accel_bias, Vector3f{0.0f,0.0f,0.0f});
|
||||
_sensor_simulator->run(10000000);
|
||||
|
||||
float converged_pos[3];
|
||||
float converged_vel[3];
|
||||
|
||||
Reference in New Issue
Block a user