Conversation
There was a problem hiding this comment.
Pull request overview
Adds runtime validation to assess whether IMU-based state prediction is outperforming a simple constant-velocity (no-IMU) baseline, helping diagnose issues such as misconfigured T_lidar_imu or poor bias estimates.
Changes:
- Introduces a new
IMUValidationutility that tracks and periodically logs prediction/bias quality statistics. - Wires IMU validation into the IMU odometry pipeline and exposes a new
validate_imuconfig flag. - Updates default odometry configs and build system to include the new feature.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/glim/odometry/odometry_estimation_imu.cpp | Instantiates and calls the new IMU validation during frame insertion. |
| src/glim/common/imu_validation.cpp | Implements prediction-vs-baseline and bias validation logic + periodic logging. |
| include/glim/odometry/odometry_estimation_imu.hpp | Adds validate_imu param and IMUValidation member. |
| include/glim/common/imu_validation.hpp | Declares the IMUValidation helper class. |
| config/config_odometry_gpu.json | Documents and enables the validate_imu option. |
| config/config_odometry_cpu.json | Enables validate_imu option (but with inconsistent section labeling). |
| CMakeLists.txt | Adds imu_validation.cpp to the glim library build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| imu_validation->validate( | ||
| Eigen::Isometry3d(last_T_world_imu.matrix()), | ||
| last_v_world_imu, | ||
| Eigen::Isometry3d(predicted_T_world_imu.matrix()), | ||
| predicted_v_world_imu, | ||
| new_frame->T_world_imu, | ||
| new_frame->v_world_imu, | ||
| new_frame->stamp - last_stamp); | ||
| imu_validation->validate(new_frame->imu_bias); |
There was a problem hiding this comment.
IMU validation is executed unconditionally, but when num_imu_integrated < 2 the code overwrites predicted_T_world_imu/predicted_v_world_imu with a non-IMU-based fallback (or may have an underconstrained IMU factor). That makes the validation results misleading and can trigger incorrect warnings about T_lidar_imu/bias. Consider skipping imu_validation->validate(...) when there isn't sufficient IMU data (e.g., num_imu_integrated < 2), or pass a flag indicating whether the prediction truly came from IMU integration.
| imu_validation->validate( | |
| Eigen::Isometry3d(last_T_world_imu.matrix()), | |
| last_v_world_imu, | |
| Eigen::Isometry3d(predicted_T_world_imu.matrix()), | |
| predicted_v_world_imu, | |
| new_frame->T_world_imu, | |
| new_frame->v_world_imu, | |
| new_frame->stamp - last_stamp); | |
| imu_validation->validate(new_frame->imu_bias); | |
| // Only run IMU validation when the prediction is actually based on IMU integration. | |
| // For example, when num_imu_integrated < 2, predicted_T_world_imu/predicted_v_world_imu | |
| // may come from a non-IMU fallback or an underconstrained factor, which would make | |
| // the validation misleading. | |
| if (num_imu_integrated >= 2) { | |
| imu_validation->validate( | |
| Eigen::Isometry3d(last_T_world_imu.matrix()), | |
| last_v_world_imu, | |
| Eigen::Isometry3d(predicted_T_world_imu.matrix()), | |
| predicted_v_world_imu, | |
| new_frame->T_world_imu, | |
| new_frame->v_world_imu, | |
| new_frame->stamp - last_stamp); | |
| imu_validation->validate(new_frame->imu_bias); | |
| } |
| // Optimizer params | ||
| "validate_imu": true, | ||
| "save_imu_rate_trajectory": true, | ||
| "num_threads": 2 |
There was a problem hiding this comment.
config/config_odometry_cpu.json places the new validate_imu setting under a repeated // Optimizer params section, but the parameter is described as a logging/misc flag in the GPU config and in code (// Logging params). This inconsistency makes the config harder to understand/search. Consider moving validate_imu (and save_imu_rate_trajectory / num_threads if intended) under a consistent // MISC/// Logging section and/or updating the header comment block to document it like the GPU config does.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Validate if IMU-based state prediction is good or not.
This would be useful to find a mis-configured T_lidar_imu.