mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 18:40:35 +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:
@@ -48,39 +48,47 @@
|
||||
#include "mag.h"
|
||||
#include "baro.h"
|
||||
#include "gps.h"
|
||||
#include "flow.h"
|
||||
#include "range_finder.h"
|
||||
#include "EKF/ekf.h"
|
||||
|
||||
using namespace sensor_simulator::sensor;
|
||||
|
||||
class SensorSimulator
|
||||
{
|
||||
|
||||
private:
|
||||
std::shared_ptr<Ekf> _ekf;
|
||||
|
||||
uint32_t _time {0}; // in microseconds
|
||||
|
||||
void setSensorDataToDefault();
|
||||
void setSensorRateToDefault();
|
||||
void startBasicSensor();
|
||||
|
||||
public:
|
||||
SensorSimulator(std::shared_ptr<Ekf> ekf);
|
||||
~SensorSimulator();
|
||||
|
||||
void setImuRate(uint32_t rate){ _imu.setRate(rate); }
|
||||
void setMagRate(uint32_t rate){ _mag.setRate(rate); }
|
||||
void setBaroRate(uint32_t rate){ _baro.setRate(rate); }
|
||||
void setGpsRate(uint32_t rate){ _gps.setRate(rate); }
|
||||
|
||||
void run_seconds(float duration_seconds);
|
||||
void run_microseconds(uint32_t duration);
|
||||
void runSeconds(float duration_seconds);
|
||||
void runMicroseconds(uint32_t duration);
|
||||
|
||||
void startGps(){ _gps.start(); }
|
||||
void stopGps(){ _gps.stop(); }
|
||||
|
||||
void setImuBias(Vector3f accel_bias, Vector3f gyro_bias);
|
||||
void startFlow(){ _flow.start(); }
|
||||
void stopFlow(){ _flow.stop(); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<Ekf> _ekf;
|
||||
void startRangeFinder(){ _rng.start(); }
|
||||
void stopRangeFinder(){ _rng.stop(); }
|
||||
|
||||
void setImuBias(Vector3f accel_bias, Vector3f gyro_bias);
|
||||
|
||||
Imu _imu;
|
||||
Mag _mag;
|
||||
Baro _baro;
|
||||
Gps _gps;
|
||||
|
||||
uint32_t _time {0}; // in microseconds
|
||||
|
||||
gps_message getDefaultGpsData();
|
||||
Flow _flow;
|
||||
RangeFinder _rng;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user