Fix: Prevent NaN or zero dt in IMU propagation #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
During the execution of the code, I observed that due to possible desynchronizations, sensor instabilities, or very fast IMU readings, the time interval dt between IMU measurements could sometimes become very close to zero or exactly zero.
This issue destabilizes the system and propagates NaN values through all IMU state calculations, leading to incorrect state estimations, from which it never recovers.
Observed Behavior
I identified this phenomenon while using FAST-LIVO2 with a rotating LiDAR and no camera, specifically when the LiDAR was close to obstacles and the resulting point cloud was small. In these scenarios, the system exhibited inconsistencies, and NaN values started propagating within the IMU state.
Solution
Added the following safeguard to skip IMU propagation steps where dt is NaN or too small:
I am aware that simply skipping the iteration with continue may not be the best solution. There might be a better way to handle this issue instead of ignoring the propagation step. If anyone has suggestions for a better approach, I’d appreciate any feedback or insights on how to handle this more effectively.