Skip to content

Commit 3fe04a9

Browse files
committed
GNSS yaw: add observation jump on ground
Some receivers are initializing to some heading and then resetting to the correct one after a couple of seconds. EKF2 should detect that and reset to the new value
1 parent 30c7a59 commit 3fe04a9

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/modules/ekf2/test/test_EKF_gps_yaw.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,26 @@ TEST_F(EkfGpsHeadingTest, fallBackToMag)
213213
EXPECT_EQ(_ekf_wrapper.getQuaternionResetCounter(), initial_quat_reset_counter + 1);
214214
}
215215

216-
TEST_F(EkfGpsHeadingTest, yaw_jump)
216+
TEST_F(EkfGpsHeadingTest, yaw_jump_on_ground)
217+
{
218+
// GIVEN: the GPS yaw fusion activated
219+
float gps_heading = _ekf_wrapper.getYawAngle();
220+
_sensor_simulator._gps.setYaw(gps_heading);
221+
_sensor_simulator.runSeconds(1);
222+
_ekf->set_in_air_status(false);
223+
224+
// WHEN: the measurement suddenly changes
225+
const int initial_quat_reset_counter = _ekf_wrapper.getQuaternionResetCounter();
226+
gps_heading = matrix::wrap_pi(_ekf_wrapper.getYawAngle() + math::radians(45.f));
227+
_sensor_simulator._gps.setYaw(gps_heading);
228+
_sensor_simulator.runSeconds(2);
229+
230+
// THEN: the fusion should reset
231+
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsHeadingFusion());
232+
EXPECT_EQ(_ekf_wrapper.getQuaternionResetCounter(), initial_quat_reset_counter + 1);
233+
}
234+
235+
TEST_F(EkfGpsHeadingTest, yaw_jump_in_air)
217236
{
218237
// GIVEN: the GPS yaw fusion activated
219238
float gps_heading = _ekf_wrapper.getYawAngle();

0 commit comments

Comments
 (0)