Browse Source

GNSS yaw unit test: test fallback to non yaw aiding mode

master
bresch 4 years ago committed by Paul Riseborough
parent
commit
f7c687e433
  1. 5
      test/sensor_simulator/ekf_wrapper.cpp
  2. 1
      test/sensor_simulator/ekf_wrapper.h
  3. 11
      test/test_EKF_gps_yaw.cpp

5
test/sensor_simulator/ekf_wrapper.cpp

@ -165,6 +165,11 @@ bool EkfWrapper::isIntendingMag3DFusion() const @@ -165,6 +165,11 @@ bool EkfWrapper::isIntendingMag3DFusion() const
return _ekf->control_status_flags().mag_3D;
}
void EkfWrapper::setMagFuseTypeNone()
{
_ekf_params->mag_fusion_type = MAG_FUSE_TYPE_NONE;
}
bool EkfWrapper::isWindVelocityEstimated() const
{
return _ekf->control_status_flags().wind;

1
test/sensor_simulator/ekf_wrapper.h

@ -87,6 +87,7 @@ public: @@ -87,6 +87,7 @@ public:
bool isIntendingMagHeadingFusion() const;
bool isIntendingMag3DFusion() const;
void setMagFuseTypeNone();
void enableExternalVisionAlignment();
void disableExternalVisionAlignment();

11
test/test_EKF_gps_yaw.cpp

@ -257,4 +257,15 @@ TEST_F(EkfGpsHeadingTest, stop_on_ground) @@ -257,4 +257,15 @@ TEST_F(EkfGpsHeadingTest, stop_on_ground)
// should stop as well because the yaw is not aligned anymore
EXPECT_FALSE(_ekf_wrapper.isIntendingGpsHeadingFusion());
EXPECT_FALSE(_ekf_wrapper.isIntendingGpsFusion());
// AND IF: the mag fusion type is set to NONE
_ekf_wrapper.setMagFuseTypeNone();
// WHEN: running without yaw aiding
const matrix::Vector<float, 4> quat_variance_before = _ekf_wrapper.getQuaternionVariance();
_sensor_simulator.runSeconds(20.0);
const matrix::Vector<float, 4> quat_variance_after = _ekf_wrapper.getQuaternionVariance();
// THEN: the yaw variance is constrained by fusing constant data
EXPECT_LT(quat_variance_after(3), quat_variance_before(3));
}

Loading…
Cancel
Save