FIX: georeferencing yaml serialization missed orientation fields#47
FIX: georeferencing yaml serialization missed orientation fields#47
Conversation
📝 WalkthroughWalkthroughThis PR refactors the georeferencing YAML serialization in mp2p_icp by renaming the parameter from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test-georef-yaml.cpp (1)
83-92: Covariance matrix is not symmetric.The generated covariance matrix uses
(r+1)*(c+1)*0.001which produces a symmetric matrix (since(r+1)*(c+1) == (c+1)*(r+1)), so this is actually correct. However, for covariance matrices to be valid, they must also be positive semi-definite. This particular pattern may not satisfy that property.For test purposes this likely doesn't matter since you're just verifying round-trip fidelity, but if MRPT ever validates covariance matrices, the tests could fail unexpectedly.
💡 Optional: Use a guaranteed positive-definite covariance
// Non-zero, non-diagonal covariance - g.T_enu_to_map.cov.setZero(); - for (int r = 0; r < 6; ++r) - { - for (int c = 0; c < 6; ++c) - { - // Use a recognisable pattern: (r+1)*(c+1)*0.001, symmetric - g.T_enu_to_map.cov(r, c) = static_cast<double>((r + 1) * (c + 1)) * 0.001; - } - } + // Build a positive-definite covariance: C = A * A^T where A has distinct values + mrpt::math::CMatrixDouble66 A; + for (int r = 0; r < 6; ++r) + for (int c = 0; c < 6; ++c) + A(r, c) = (r == c) ? (r + 1) * 0.1 : (r + c) * 0.01; + g.T_enu_to_map.cov = A * A.transpose();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test-georef-yaml.cpp` around lines 83 - 92, The covariance assigned to g.T_enu_to_map.cov uses a patterned fill that may not be positive-definite; replace the current element-wise fill (the loop writing g.T_enu_to_map.cov(r, c)) with a construction that guarantees positive-definiteness, e.g. build a small full-rank matrix M and set g.T_enu_to_map.cov = M * M.transpose() or create a diagonal-dominant symmetric matrix by initializing diagonal entries to sufficiently large positive values and mirroring off-diagonals so the resulting matrix is symmetric and positive-definite; update the code around g.T_enu_to_map.cov.setZero() and the following loop to use one of these approaches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/test-georef-yaml.cpp`:
- Around line 83-92: The covariance assigned to g.T_enu_to_map.cov uses a
patterned fill that may not be positive-definite; replace the current
element-wise fill (the loop writing g.T_enu_to_map.cov(r, c)) with a
construction that guarantees positive-definiteness, e.g. build a small full-rank
matrix M and set g.T_enu_to_map.cov = M * M.transpose() or create a
diagonal-dominant symmetric matrix by initializing diagonal entries to
sufficiently large positive values and mirroring off-diagonals so the resulting
matrix is symmetric and positive-definite; update the code around
g.T_enu_to_map.cov.setZero() and the following loop to use one of these
approaches.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4585b4c5-13ac-4961-9007-5b0a921d9221
📒 Files selected for processing (4)
mp2p_icp_map/include/mp2p_icp/metricmap.hmp2p_icp_map/src/metricmap.cpptests/CMakeLists.txttests/test-georef-yaml.cpp
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #47 +/- ##
===========================================
+ Coverage 78.17% 78.60% +0.43%
===========================================
Files 189 190 +1
Lines 10305 10564 +259
Branches 968 979 +11
===========================================
+ Hits 8056 8304 +248
- Misses 2249 2260 +11
🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Tests
Refactor