Skip to content

Housing calibration in CalibrationHandler + tests#1602

Merged
MaticTonin merged 5 commits intodevelopfrom
dev_tf_HousingHandler
Jan 8, 2026
Merged

Housing calibration in CalibrationHandler + tests#1602
MaticTonin merged 5 commits intodevelopfrom
dev_tf_HousingHandler

Conversation

@pheec
Copy link
Copy Markdown
Contributor

@pheec pheec commented Jan 5, 2026

Purpose

The housing calibration, which is stored in the eeprom, can now be handled using the CalibrationHandler.

Testing & Validation

The methods are tested in integration tests. We also conducted a successful experimental depth test on calibration rig.

@moratom moratom added the testable PR is ready to be tested label Jan 5, 2026
@moratom moratom requested a review from MaticTonin January 5, 2026 15:20
@pheec pheec force-pushed the dev_tf_HousingHandler branch from fb4b9ba to ad6111c Compare January 5, 2026 15:39
@pheec pheec force-pushed the dev_tf_HousingHandler branch 2 times, most recently from eb8935e to 4c150a0 Compare January 5, 2026 15:48
@pheec pheec removed the testable PR is ready to be tested label Jan 5, 2026
Copy link
Copy Markdown
Collaborator

@MaticTonin MaticTonin left a comment

Choose a reason for hiding this comment

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

Looks fine to me, some small nitpicks and comments regarding tests mostly,.

// Helper function to compare 4x4 transformation matrices
static void requireMatrixApproxEqual(const std::vector<std::vector<float>>& result,
const std::vector<std::vector<float>>& expected,
float margin = 1e-3) {
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.

Lets try higher margin, -4 or -5.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

}

// Helper to create calibration data with housing and product name
static CalibrationHandler loadHandlerWithHousing() {
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.

Handlers on top of the file, not in the middle of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done



// Helper to create calibration data directly in code
static CalibrationHandler loadHandlerWithHousingRotation() {
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.

Same nitpick, on top of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

return CalibrationHandler::fromJson(calibJson);
}

TEST_CASE("getHousingCalibration - T_CAM_C_to_housing with specTranslation", "[getHousingCalibration I]") {
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.

Combine I and II and III into one test. where there is one with regular translation and one with specTranslation.
In this case, rename to expected variable as needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

requireMatrixApproxEqual(camToHousing, expected, 1e-6);
}

TEST_CASE("getHousingCalibration - T_CAM_A_to_housing with regular translation", "[getHousingCalibration III-B]") {
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.

Please add a test, where this and this will happen.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@MaticTonin

This comment was marked as resolved.

@MaticTonin
Copy link
Copy Markdown
Collaborator

And as well check for line 495 in https://github.com/luxonis/depthai-core/actions/runs/20720798482/job/59485200316?pr=1602#step:3:496 and why would the test be failing.

@pheec
Copy link
Copy Markdown
Contributor Author

pheec commented Jan 6, 2026

Claude AI:

Actual Failure: SSH/Docker Connection
The failure occurred after tests completed, during the SSH disconnect/cleanup phase:

This is a CI infrastructure issue, not a code/test issue. The SSH connection to the HIL (Hardware-in-Loop) test runner at 10.12.143.133 failed during cleanup.

@MaticTonin
Copy link
Copy Markdown
Collaborator

style check failing due to the issue in develop branch, will be resolved #1603.

@pheec
Copy link
Copy Markdown
Contributor Author

pheec commented Jan 6, 2026

The test is failing because the compilation is missing the flag -DDEPTHAI_HAVE_HOUSING_COORDINATES=ON. This is actually expected behavior: the CalibrationHandler first checks whether the translation file exists, and if not, it falls back to values from the calib file. In this test, we want to verify that the translation values in the generated file are correct, but since the file is never generated, the test fails.

I suggest renaming this flag from DEPTHAI_HAVE_HOUSING_COORDINATES to DEPTHAI_GENERATE_HOUSING_COORDS, and setting it to ON by default. This would align the behavior with the test’s intention.

Comment thread CMakeLists.txt Outdated
@pheec pheec force-pushed the dev_tf_HousingHandler branch from eb46fcc to 8471935 Compare January 6, 2026 11:38
@pheec
Copy link
Copy Markdown
Contributor Author

pheec commented Jan 6, 2026

I did the discussed changes of the flag. Rdy for testing again

@pheec pheec added testable PR is ready to be tested labels Jan 6, 2026
@MaticTonin MaticTonin self-requested a review January 6, 2026 11:45
@MaticTonin MaticTonin dismissed their stale review January 6, 2026 11:45

Not relavant.

Copy link
Copy Markdown
Collaborator

@MaticTonin MaticTonin left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@MaticTonin MaticTonin added testable PR is ready to be tested and removed testable PR is ready to be tested labels Jan 6, 2026
@MaticTonin
Copy link
Copy Markdown
Collaborator

Before the merge, the depthai_boards must be updated to main, so that we do not have detached branch.

@MaticTonin MaticTonin removed the testable PR is ready to be tested label Jan 8, 2026
@MaticTonin MaticTonin merged commit a44e5a6 into develop Jan 8, 2026
149 of 223 checks passed
@MaticTonin MaticTonin deleted the dev_tf_HousingHandler branch January 8, 2026 11:15
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.

4 participants