Skip to content

[fix] validate RGBDSettings::depth_camera_id against the rig - #154

Open
slepichev wants to merge 1 commit into
mainfrom
slepichev/fix-rgbd-depth-camera-id-validation
Open

[fix] validate RGBDSettings::depth_camera_id against the rig#154
slepichev wants to merge 1 commit into
mainfrom
slepichev/fix-rgbd-depth-camera-id-validation

Conversation

@slepichev

@slepichev slepichev commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

The RGBD branch of the Odometry constructor pushed depth_camera_id into the frustum graph without checking it. The default -1 means "not set", and static_cast turns it into a huge unsigned id; FrustumIntersectionGraph then registers it as a primary camera, so is_valid() passes and a camera index that names no camera reaches the odometry.

Check the id the way the Multisensor branch right below already does - rejecting negatives and anything past the end of the rig - and name the offending value in the message.

RgbdModeRequiresCudaBuild constructed with the default config, so in a USE_CUDA=OFF build it now hits this check before the mode switch and never sees the USE_CUDA message it asserts on. Give it a valid depth camera id, the same way MultisensorModeRequiresCunlsBuild already sets depth_camera_ids.

Summary by CodeRabbit

  • Bug Fixes

    • RGBD odometry now rejects invalid depth-camera IDs, including unset, negative, or out-of-range values, instead of accepting them.
    • Invalid RGBD tracker configurations now fail during construction with an appropriate error.
    • Valid depth-camera selections continue to work as expected.
  • Tests

    • Added coverage for unset, invalid, and valid depth-camera ID scenarios.

The RGBD branch of the Odometry constructor pushed depth_camera_id into
the frustum graph without checking it. The default -1 means "not set",
and static_cast<CameraId> turns it into a huge unsigned id;
FrustumIntersectionGraph then registers it as a primary camera, so
is_valid() passes and a camera index that names no camera reaches the
odometry.

Check the id the way the Multisensor branch right below already does -
rejecting negatives and anything past the end of the rig - and name the
offending value in the message.

RgbdModeRequiresCudaBuild constructed with the default config, so in a
USE_CUDA=OFF build it now hits this check before the mode switch and
never sees the USE_CUDA message it asserts on. Give it a valid depth
camera id, the same way MultisensorModeRequiresCunlsBuild already sets
depth_camera_ids.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 93f73772-6d21-4411-afbc-573e6ee9996b

📥 Commits

Reviewing files that changed from the base of the PR and between 8134ef5 and 3850ade.

📒 Files selected for processing (2)
  • libs/cuvslam/cuvslam2.cpp
  • libs/cuvslam/test/tracker_test.cpp

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

RGBD initialization now validates depth_camera_id before registration. Tests cover unset, negative, and out-of-range IDs, and configure a valid ID for the non-CUDA availability test.

Changes

RGBD validation

Layer / File(s) Summary
Validate depth camera IDs
libs/cuvslam/cuvslam2.cpp, libs/cuvslam/test/tracker_test.cpp
RGBD initialization rejects negative and out-of-range camera IDs with std::invalid_argument. Tests cover invalid IDs and set ID 0 for the non-CUDA availability check.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 3850a

RGBD tracker construction now rejects invalid depth-camera IDs before registration and retains the expected CUDA-disabled behavior. Invalid-ID and non-CUDA coverage is included, with no active merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. 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 main change: validating RGBDSettings::depth_camera_id against the rig.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ 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 slepichev/fix-rgbd-depth-camera-id-validation

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

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results

Status Platform Language Total Passed Failed Errors Skipped
Orin C++ 17 17 0 0 0
Orin Python 74 73 0 0 1
Thor C++ 17 17 0 0 0
Thor Python 74 73 0 0 1
x86_64 C++ 17 17 0 0 0
x86_64 Python 74 73 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 EUROC-VIO_ODOM 1.6516 0.1497 0.0943 0 -0.0002 -0.0000 -0.0001 0 122.9
x86_64-cuda12.6.3-ubuntu24.04 EUROC-VIO_SLAM 1.7849 0.1928 0.0595 0 -0.0000 0.0001 -0.0000 0 101.5
x86_64-cuda12.6.3-ubuntu24.04 KITTI-STEREO_ODOM 0.8207 0.0024 2.8532 0 -0.0004 -0.0000 0.0629 0 246.2
x86_64-cuda12.6.3-ubuntu24.04 KITTI-STEREO_SLAM 0.7298 0.0020 1.9889 0 0.0051 0.0000 0.0414 0 175.5

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.

2 participants