Skip to content

IMU prediction validation#294

Merged
koide3 merged 3 commits into
masterfrom
imuval
Feb 15, 2026
Merged

IMU prediction validation#294
koide3 merged 3 commits into
masterfrom
imuval

Conversation

@koide3

@koide3 koide3 commented Feb 15, 2026

Copy link
Copy Markdown
Owner

Validate if IMU-based state prediction is good or not.
This would be useful to find a mis-configured T_lidar_imu.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IMUValidation utility that tracks and periodically logs prediction/bias quality statistics.
  • Wires IMU validation into the IMU odometry pipeline and exposes a new validate_imu config 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.

Comment on lines +352 to +360
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);

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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);
}

Copilot uses AI. Check for mistakes.
Comment on lines 32 to 35
// Optimizer params
"validate_imu": true,
"save_imu_rate_trajectory": true,
"num_threads": 2

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread include/glim/common/imu_validation.hpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@koide3
koide3 merged commit aaddee4 into master Feb 15, 2026
6 checks passed
@koide3
koide3 deleted the imuval branch February 15, 2026 13:33
TokyoWarfare pushed a commit to TokyoWarfare/glim-extended that referenced this pull request Apr 15, 2026
* IMU prediction validation

* validate IMU and skip if vel is too small

* Update include/glim/common/imu_validation.hpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants