Skip to content

[Bug] Bypass SOF on blackout images - #80

Open
zwdoescode wants to merge 1 commit into
mainfrom
zheng/bypass-blackout-images
Open

[Bug] Bypass SOF on blackout images#80
zwdoescode wants to merge 1 commit into
mainfrom
zheng/bypass-blackout-images

Conversation

@zwdoescode

@zwdoescode zwdoescode commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Fix #47

Summary by CodeRabbit

  • New Features

    • Improved visual-inertial tracking during short visual blackouts when sufficient motion information is available.
    • Continues pose prediction using inertial data when camera observations are temporarily unavailable.
  • Bug Fixes

    • Prevented blackout frames from corrupting ongoing visual tracking.
    • Improved pose output acceptance when visual or inertial tracking succeeds.
    • Reset affected frame statistics and observations after visual blackout frames.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change detects visual blackout frames, processes them without observations, and uses inertial propagation when gravity is available. Failed blackout solves reset outputs. Online tracking accepts successful PnP or inertial integration results.

Changes

Visual blackout tracking

Layer / File(s) Summary
Blackout capability contract
libs/odometry/multi_visual_odometry_base.h, libs/odometry/stereo_inertial_odometry.h, libs/odometry/stereo_inertial_odometry.cpp
The odometry base adds a blackout capability hook. Stereo-inertial odometry enables the hook when a gravity estimate exists.
Blackout frame processing
libs/odometry/multi_visual_odometry_base.cpp
The odometry detects all-zero host U8 images, clears observations, solves without observations, discards current images, and resets frame statistics.
Inertial blackout propagation
libs/pipelines/track_online_inertial.cpp
Observation-free post-initialization blackout frames use prev_pose preintegration. Other integration paths use integ_kf. Pose output is accepted after successful PnP or integration.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CameraFrame
  participant MultiVisualOdometryBase
  participant StereoInertialOdometry
  participant OnlineInertialTracker

  CameraFrame->>MultiVisualOdometryBase: provide image frame
  MultiVisualOdometryBase->>StereoInertialOdometry: check blackout capability
  StereoInertialOdometry-->>MultiVisualOdometryBase: return gravity availability
  MultiVisualOdometryBase->>MultiVisualOdometryBase: detect blackout and solve without observations
  MultiVisualOdometryBase->>OnlineInertialTracker: return blackout tracking result
  OnlineInertialTracker->>OnlineInertialTracker: propagate pose from prev_pose
Loading

Suggested reviewers: hrabeti-nvidia, vikuznetsov-nvidia

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the bug fix for visual blackout images, which is the main purpose of the changes.
Linked Issues check ✅ Passed The changes detect blackout frames and use IMU-based propagation to maintain smooth tracking during short visual blackouts as required by issue #47.
Out of Scope Changes check ✅ Passed All changes support blackout handling in inertial odometry and align with the objectives in issue #47.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zheng/bypass-blackout-images

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/odometry/multi_visual_odometry_base.cpp`:
- Line 121: Replace the Isometry3T type of the world_from_rig declaration with
the Pose type from cuvslam2.h, keeping the variable name and initialization
behavior unchanged.
- Around line 139-143: Update the !have_pose failure path to call reset() before
returning false, ensuring SolverSfMInertial state is cleared after a failed
blackout solve while preserving the existing frame-stat, delta, and static-info
resets.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: f701c779-f122-4379-904e-e34adedb37e2

📥 Commits

Reviewing files that changed from the base of the PR and between 7d2463f and fa60d71.

📒 Files selected for processing (5)
  • libs/odometry/multi_visual_odometry_base.cpp
  • libs/odometry/multi_visual_odometry_base.h
  • libs/odometry/stereo_inertial_odometry.cpp
  • libs/odometry/stereo_inertial_odometry.h
  • libs/pipelines/track_online_inertial.cpp

TRACE_EVENT ev = profiler_domain_.trace_event("MultiVisualOdometryBase::track()", profiler_color_);
const int64_t timestamp = (*first_image)->get_image_meta().timestamp; // current frame timestamp
Isometry3T predicted_world_from_rig = prev_world_from_rig_;
Isometry3T world_from_rig;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use Pose for the new SE(3) variable.

world_from_rig stores an SE(3) transform. Replace the new Isometry3T declaration with the Pose type from cuvslam2.h.

As per coding guidelines, “Use the Pose type from cuvslam2.h for all SE(3) transforms.”

🧰 Tools
🪛 Clang (14.0.6)

[warning] 121-121: variable 'world_from_rig' is not initialized

(cppcoreguidelines-init-variables)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/odometry/multi_visual_odometry_base.cpp` at line 121, Replace the
Isometry3T type of the world_from_rig declaration with the Pose type from
cuvslam2.h, keeping the variable name and initialization behavior unchanged.

Source: Coding guidelines

Comment on lines +139 to +143
if (!have_pose) {
ClearFrameStat(last_frame_stat_.get());
delta = Isometry3T::Identity();
static_info_exp.setZero();
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reset solver state after a failed blackout solve.

The normal PnP failure path resets state, but this path returns directly. SolverSfMInertial::solveNextFrame advances prev_pose_ts_ns at Line 616 and replaces last_frame_preint_ at Line 698 before it returns false. The next frame can therefore use a pose from before the blackout with IMU state from after it.

Call reset() before returning false.

Proposed fix
     DropCurrentImages(curr_images);
     if (!have_pose) {
+      reset();
       ClearFrameStat(last_frame_stat_.get());
       delta = Isometry3T::Identity();
       static_info_exp.setZero();
       return false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!have_pose) {
ClearFrameStat(last_frame_stat_.get());
delta = Isometry3T::Identity();
static_info_exp.setZero();
return false;
if (!have_pose) {
reset();
ClearFrameStat(last_frame_stat_.get());
delta = Isometry3T::Identity();
static_info_exp.setZero();
return false;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/odometry/multi_visual_odometry_base.cpp` around lines 139 - 143, Update
the !have_pose failure path to call reset() before returning false, ensuring
SolverSfMInertial state is cleared after a failed blackout solve while
preserving the existing frame-stat, delta, and static-info resets.

@github-actions

Copy link
Copy Markdown

Test Results

Status Platform Language Total Passed Failed Errors Skipped
Orin C++ 16 16 0 0 0
Orin Python 71 70 0 0 1
Thor C++ 16 16 0 0 0
Thor Python 71 70 0 0 1
x86_64 C++ 16 16 0 0 0
x86_64 Python 71 70 0 0 1

cuVSLAM Evaluation KPIs

Config Dataset ATE,% ARE,º/m Kabsch, Losts, diff ATE,% diff ARE,º/m diff Kabsch, diff Losts, FPS,Hz
x86_64-cuda12.6.3-ubuntu24.04 KITTI-STEREO_ODOM 0.8377 0.0023 2.8693 0 NA NA NA NA 317.6
x86_64-cuda12.6.3-ubuntu24.04 KITTI-STEREO_SLAM 0.751 0.002 1.8584 0 NA NA NA NA 181.4

Artifacts

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.

Inertial mode produces sudden pose jumps on short visual blackout

1 participant