diff --git a/src/modules/ekf2/test/change_indication/ekf_gsf_reset.csv b/src/modules/ekf2/test/change_indication/ekf_gsf_reset.csv index 6311ea06c8d..522a9a75497 100644 --- a/src/modules/ekf2/test/change_indication/ekf_gsf_reset.csv +++ b/src/modules/ekf2/test/change_indication/ekf_gsf_reset.csv @@ -388,4 +388,4 @@ Timestamp,state[0],state[1],state[2],state[3],state[4],state[5],state[6],state[7 38590000,-0.66,-0.00066,-0.0024,0.75,0.042,0.18,0.014,0,0,-4.9e+02,-0.0016,-0.0063,0.00056,-0.14,0.17,-0.14,0.22,-0.00061,0.43,0.00036,0.00089,0.0035,0,0,-4.9e+02,1.5e-05,1.5e-05,0.00075,0.019,0.019,0.005,0.043,0.043,0.03,2.6e-07,2.7e-07,9.5e-07,0.0011,0.0011,6.3e-05,3.5e-06,3.2e-05,0.00037,4.2e-06,3.1e-06,0.00037,1,1,0.72 38690000,-0.66,-0.00075,-0.0024,0.75,0.042,0.19,0.021,0,0,-4.9e+02,-0.0016,-0.0063,0.00055,-0.14,0.17,-0.14,0.22,-0.00061,0.43,0.00038,0.00091,0.0035,0,0,-4.9e+02,1.5e-05,1.5e-05,0.00075,0.02,0.02,0.005,0.048,0.048,0.03,2.7e-07,2.7e-07,9.5e-07,0.0011,0.0011,6.3e-05,3.4e-06,3.2e-05,0.00037,4.2e-06,3e-06,0.00037,1,1,0.75 38790000,-0.66,-0.00061,-0.0023,0.75,0.032,0.17,0.027,0,0,-4.9e+02,-0.0016,-0.0062,0.00055,-0.14,0.17,-0.14,0.22,-0.0005,0.43,0.00039,0.0009,0.0035,0,0,-4.9e+02,1.5e-05,1.5e-05,0.00074,0.018,0.018,0.0049,0.043,0.043,0.03,2.7e-07,2.7e-07,9.5e-07,0.0011,0.001,6.3e-05,3.3e-06,3.2e-05,0.00037,4.2e-06,3e-06,0.00037,1,1,0.77 -38890000,-0.66,-0.0008,-0.0024,0.75,0.022,0.17,0.53,0,0,-4.9e+02,-0.0016,-0.0062,0.00055,-0.14,0.17,-0.14,0.22,-0.0005,0.43,0.0004,0.00086,0.0035,0,0,-4.9e+02,1.5e-05,1.5e-05,0.00075,0.019,0.019,0.005,0.047,0.047,0.03,2.7e-07,2.7e-07,9.5e-07,0.0011,0.001,6.3e-05,3.2e-06,3.2e-05,0.00037,4.2e-06,2.9e-06,0.00037,1,1,0.8 +38890000,-0.66,-0.00072,-0.0023,0.75,0.031,0.18,0.036,0,0,-4.9e+02,-0.0016,-0.0062,0.00055,-0.14,0.17,-0.14,0.22,-0.0005,0.43,0.0004,0.00086,0.0035,0,0,-4.9e+02,1.5e-05,1.5e-05,0.00075,0.019,0.019,0.005,0.047,0.047,0.03,2.7e-07,2.7e-07,9.5e-07,0.0011,0.001,6.3e-05,3.2e-06,3.2e-05,0.00037,4.2e-06,2.9e-06,0.00037,1,1,0.8 diff --git a/src/modules/ekf2/test/change_indication/iris_gps.csv b/src/modules/ekf2/test/change_indication/iris_gps.csv index bc8d980ab1c..78c8a3357a7 100644 --- a/src/modules/ekf2/test/change_indication/iris_gps.csv +++ b/src/modules/ekf2/test/change_indication/iris_gps.csv @@ -345,7 +345,7 @@ Timestamp,state[0],state[1],state[2],state[3],state[4],state[5],state[6],state[7 34290000,0.99,-0.0096,-0.014,0.17,-0.018,-0.096,-0.064,0,0,-4.9e+02,-0.0014,-0.0057,9.3e-05,0.041,-0.03,-0.14,0.2,-8.7e-06,0.43,-0.002,-0.0026,0.0013,0,0,-4.9e+02,0.00027,0.00026,0.033,0.012,0.013,0.0049,0.038,0.04,0.029,2.4e-07,2.2e-07,9.8e-07,0.024,0.023,7.9e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.26 34390000,0.99,-0.0095,-0.014,0.17,-0.02,-0.089,-0.059,0,0,-4.9e+02,-0.0014,-0.0057,8.3e-05,0.043,-0.03,-0.14,0.2,-6.2e-06,0.43,-0.002,-0.0025,0.0013,0,0,-4.9e+02,0.00027,0.00026,0.033,0.011,0.012,0.0049,0.035,0.036,0.029,2.3e-07,2.2e-07,9.7e-07,0.024,0.023,7.9e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.28 34490000,0.99,-0.0096,-0.014,0.17,-0.023,-0.093,-0.057,0,0,-4.9e+02,-0.0014,-0.0057,9.4e-05,0.042,-0.03,-0.14,0.2,-6.1e-06,0.43,-0.002,-0.0025,0.0013,0,0,-4.9e+02,0.00027,0.00026,0.033,0.012,0.013,0.0049,0.038,0.04,0.029,2.3e-07,2.2e-07,9.7e-07,0.024,0.023,7.9e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.31 -34590000,0.99,-0.0094,-0.013,0.17,-0.025,-0.085,0.74,0,0,-4.9e+02,-0.0014,-0.0056,8.3e-05,0.044,-0.029,-0.14,0.2,-2.8e-06,0.43,-0.002,-0.0025,0.0013,0,0,-4.9e+02,0.00026,0.00026,0.033,0.011,0.012,0.0048,0.035,0.036,0.029,2.3e-07,2.2e-07,9.5e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.33 -34690000,0.99,-0.0094,-0.013,0.17,-0.031,-0.083,1.7,0,0,-4.9e+02,-0.0014,-0.0056,8.7e-05,0.044,-0.029,-0.14,0.2,-2.4e-06,0.43,-0.002,-0.0025,0.0013,0,0,-4.9e+02,0.00026,0.00026,0.033,0.011,0.012,0.0049,0.038,0.04,0.029,2.3e-07,2.2e-07,9.5e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.36 -34790000,0.99,-0.0093,-0.013,0.17,-0.034,-0.074,2.7,0,0,-4.9e+02,-0.0014,-0.0056,7.8e-05,0.046,-0.03,-0.14,0.2,8.8e-07,0.43,-0.0021,-0.0025,0.0014,0,0,-4.9e+02,0.00026,0.00025,0.033,0.011,0.011,0.0049,0.035,0.036,0.029,2.3e-07,2.2e-07,9.4e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.38 -34890000,0.99,-0.0092,-0.013,0.17,-0.04,-0.073,3.7,0,0,-4.9e+02,-0.0014,-0.0056,8.2e-05,0.047,-0.03,-0.14,0.2,1.1e-06,0.43,-0.0021,-0.0025,0.0014,0,0,-4.9e+02,0.00026,0.00026,0.033,0.012,0.013,0.0049,0.038,0.039,0.029,2.3e-07,2.2e-07,9.3e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.41 +34590000,0.99,-0.0097,-0.013,0.17,-0.02,-0.087,-0.051,0,0,-4.9e+02,-0.0014,-0.0056,8.4e-05,0.044,-0.029,-0.14,0.2,-2.9e-06,0.43,-0.002,-0.0025,0.0013,0,0,-4.9e+02,0.00026,0.00026,0.033,0.011,0.012,0.0048,0.035,0.036,0.029,2.3e-07,2.2e-07,9.5e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.33 +34690000,0.99,-0.01,-0.013,0.17,-0.02,-0.088,-0.046,0,0,-4.9e+02,-0.0014,-0.0056,9e-05,0.044,-0.029,-0.14,0.2,-2.5e-06,0.43,-0.002,-0.0025,0.0013,0,0,-4.9e+02,0.00026,0.00026,0.033,0.012,0.013,0.0049,0.038,0.04,0.029,2.3e-07,2.2e-07,9.5e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.36 +34790000,0.99,-0.01,-0.013,0.17,-0.018,-0.082,-0.04,0,0,-4.9e+02,-0.0014,-0.0056,8.3e-05,0.045,-0.029,-0.14,0.2,1e-07,0.43,-0.002,-0.0024,0.0014,0,0,-4.9e+02,0.00026,0.00025,0.033,0.011,0.012,0.0049,0.035,0.036,0.029,2.3e-07,2.2e-07,9.4e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.38 +34890000,0.99,-0.011,-0.013,0.17,-0.018,-0.085,-0.034,0,0,-4.9e+02,-0.0014,-0.0056,9.2e-05,0.045,-0.029,-0.14,0.2,4.5e-09,0.43,-0.0021,-0.0024,0.0014,0,0,-4.9e+02,0.00026,0.00025,0.033,0.012,0.013,0.0049,0.038,0.04,0.029,2.3e-07,2.2e-07,9.3e-07,0.024,0.023,7.8e-05,0.0012,4e-05,0.0012,0.0012,0.0013,0.0012,1,1,0.41 diff --git a/src/modules/ekf2/test/sensor_simulator/sensor_simulator.cpp b/src/modules/ekf2/test/sensor_simulator/sensor_simulator.cpp index 1e5f4998672..b792d5f0b2d 100644 --- a/src/modules/ekf2/test/sensor_simulator/sensor_simulator.cpp +++ b/src/modules/ekf2/test/sensor_simulator/sensor_simulator.cpp @@ -226,19 +226,11 @@ void SensorSimulator::runReplayMicroseconds(uint32_t duration) void SensorSimulator::setSensorDataFromReplayData() { if (_replay_data.size() > 0) { - sensor_info sample = _replay_data[_current_replay_data_index]; - - while (sample.timestamp < _time) { - setSingleReplaySample(sample); - - if (_current_replay_data_index < _replay_data.size()) { - _current_replay_data_index ++; - - } else { - break; - } - - sample = _replay_data[_current_replay_data_index]; + // stop at the end of the replay data instead of reading past it + while (_current_replay_data_index < _replay_data.size() + && _replay_data[_current_replay_data_index].timestamp < _time) { + setSingleReplaySample(_replay_data[_current_replay_data_index]); + _current_replay_data_index++; } } else {