[Bug] Bypass SOF on blackout images - #80
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesVisual blackout tracking
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
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
libs/odometry/multi_visual_odometry_base.cpplibs/odometry/multi_visual_odometry_base.hlibs/odometry/stereo_inertial_odometry.cpplibs/odometry/stereo_inertial_odometry.hlibs/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; |
There was a problem hiding this comment.
📐 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
| if (!have_pose) { | ||
| ClearFrameStat(last_frame_stat_.get()); | ||
| delta = Isometry3T::Identity(); | ||
| static_info_exp.setZero(); | ||
| return false; |
There was a problem hiding this comment.
🗄️ 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.
| 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.
Test Results
cuVSLAM Evaluation KPIs
Artifacts |
Fix #47
Summary by CodeRabbit
New Features
Bug Fixes