separate scan alignment#3
Open
sevahul wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors scan-to-map alignment logic out of mapOptimization into a dedicated ScanAligner object, aiming to separate responsibilities and centralize alignment diagnostics/metrics.
Changes:
- Introduces
ScanAligner(+AlignmentMetrics) to encapsulate surf correspondence building and LM optimization. - Updates
mapOptimizationto delegate scan2map alignment and expose alignment debug outputs via the new object. - Registers the new implementation file in the build.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/scanAlignment/ScanAligner.cpp | New implementation of scan alignment (surf optimization + LM) with metrics reporting. |
| include/scanAlignment/ScanAligner.hpp | New public interface + metrics struct + debug code flags for visualization. |
| src/mapOptimization/mapOptimization_scan.cpp | Replaces inline alignment loop with scanAligner->setMap() + scanAligner->align(). |
| src/mapOptimization/mapOptimization_publish.cpp | Switches surf debug coloring and matched-feature publishing to use scanAligner outputs. |
| src/mapOptimization/mapOptimization_core.cpp | Allocates scanAligner and removes now-relocated alignment state. |
| include/mapOptimization/mapOptimization.hpp | Adds scanAligner member and removes alignment-related members/method declarations. |
| CMakeLists.txt | Adds src/scanAlignment/ScanAligner.cpp to the mapOptimization target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| std::vector<PointType> laserCloudOriSurfVec; | ||
| std::vector<PointType> coeffSelSurfVec; | ||
| std::vector<bool> laserCloudOriSurfFlag; |
Comment on lines
+121
to
+133
| #pragma omp parallel for num_threads(numberOfCores) reduction(+:knnPassCount,planeValidCount,matchedCount) | ||
| for (int i = 0; i < scanSize; i++) | ||
| { | ||
| PointType pointOri, pointSel, coeff; | ||
| std::vector<int> pointSearchInd; | ||
| std::vector<float> pointSearchSqDis; | ||
|
|
||
| pointOri = scan->points[i]; | ||
| pointAssociateToMap(&pointOri, &pointSel); | ||
|
|
||
| laserCloudSurfDebugCode[i] = SURF_DEBUG_REJECTED_NEIGHBOR_COUNT; | ||
| const int foundNeighbors = kdtreeMap->nearestKSearch(pointSel, 5, pointSearchInd, pointSearchSqDis); | ||
| if (foundNeighbors < 5) |
dfcdc9d to
b19e197
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scan alignment into a separate object