Skip to content

Fix/stereo default config - #1959

Open
JakubFara wants to merge 2 commits into
developfrom
fix/Stereo_default_config
Open

Fix/stereo default config#1959
JakubFara wants to merge 2 commits into
developfrom
fix/Stereo_default_config

Conversation

@JakubFara

@JakubFara JakubFara commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Purpose

On RVC4, in StereoDepth, the DEFAULT mode was not set if build() had not been called.

Tests

New test added validating the fix

Summary by CodeRabbit

  • New Features

    • Added support for creating Stereo Depth nodes with an associated device.
    • Stereo Depth nodes now apply the default profile preset when initialized.
  • Bug Fixes

    • Preset changes now reliably reset depth configuration before applying new settings.
    • Improved handling of post-processing hardware resources for RVC2 devices.

@JakubFara
JakubFara requested a review from aljazkonec1 August 25, 2026 11:09
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 53612ce9-f45e-4a54-b357-0b8762ff8d89

📥 Commits

Reviewing files that changed from the base of the PR and between 48cc12d and e6846ee.

📒 Files selected for processing (3)
  • include/depthai/pipeline/node/StereoDepth.hpp
  • src/pipeline/node/StereoDepth.cpp
  • tests/src/ondevice_tests/stereo_depth_node_test.cpp

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.

📜 Recent review details
🧰 Additional context used
🪛 Cppcheck (2.21.0)
tests/src/ondevice_tests/stereo_depth_node_test.cpp

[error] 18-18: There is an unknown macro here somewhere. Configuration is required. If DEPTHAI_NLOHMANN_DEFINE_TYPE_INTRUSIVE is a macro then please configure it.

(unknownMacro)

🔇 Additional comments (3)
include/depthai/pipeline/node/StereoDepth.hpp (1)

20-20: LGTM!

src/pipeline/node/StereoDepth.cpp (1)

44-46: LGTM!

Also applies to: 213-215, 414-415

tests/src/ondevice_tests/stereo_depth_node_test.cpp (1)

3-22: LGTM!

Also applies to: 60-77, 144-144


📝 Walkthrough

Walkthrough

The change adds a shared-device StereoDepth constructor, applies the DEFAULT profile during construction, resets configuration before RVC2 and RVC4 presets, and adds tests that compare profile signatures.

Changes

StereoDepth preset initialization

Layer / File(s) Summary
Shared-device constructor and default profile
include/depthai/pipeline/node/StereoDepth.hpp, src/pipeline/node/StereoDepth.cpp
Adds a public constructor that accepts a shared Device pointer and applies PresetMode::DEFAULT.
Preset resets and profile validation
src/pipeline/node/StereoDepth.cpp, tests/src/ondevice_tests/stereo_depth_node_test.cpp
Resets initialConfig before RVC2 and RVC4 presets. The RVC2 preset also sets post-processing hardware resources to AUTO. Tests compare configuration signatures for default and accuracy profiles.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e6846

This localized change fixes StereoDepth DEFAULT configuration when build() has not been called and adds a validating test; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant StereoDepth
  participant setDefaultProfilePreset
  Application->>StereoDepth: Construct with shared Device
  StereoDepth->>setDefaultProfilePreset: Apply PresetMode::DEFAULT
  setDefaultProfilePreset->>StereoDepth: Initialize profile configuration
Loading

Suggested reviewers: aljazkonec1

Poem

A rabbit checks the depth array,
Defaults bloom with careful care,
Old settings hop out of sight,
New profiles line up just right,
“Stereo’s ready!” twitches my ear.

🚥 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 9 functions across 3 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 identifies the main change: fixing the default StereoDepth configuration. It is concise and related to the pull request objectives.
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.
✨ 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 fix/Stereo_default_config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@aljazkonec1 aljazkonec1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

using DEFAULT preset will completely change the behavior of stereo depth when the node is initialized without the build() function. To me the presets that are default constructed in initialConfig look better than when using the DEFAULT preset. Are we sure we want to do that?

initialConfig(std::make_shared<decltype(properties.initialConfig)>(properties.initialConfig)) {}

StereoDepth::StereoDepth(const std::shared_ptr<Device>& device) : DeviceNodeCRTP<DeviceNode, StereoDepth, StereoDepthProperties>(device) {
setDefaultProfilePreset(PresetMode::DEFAULT);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This makes "constructor only stereo" use DEFAULT presets instead of making the DEFAULT presets equal to the constructor version of the presets. This will completely change behavior in all stereo examples. It also sets DEFAULT preset for RVC2. Is that the same as not setting any preset?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This unifies setting DEFAULT as default everywhere, seems intended to me.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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


void StereoDepth::setRvc2ProfilePreset(PresetMode mode) {
*initialConfig = StereoDepthConfig{};
setPostProcessingHardwareResources(Properties::AUTO, Properties::AUTO);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this needed? Is this PR not ment to adjust only RVC4?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The config does not need to set all the parameters so we "reset" the parameters at first

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