Skip to content

separate scan alignment#3

Open
sevahul wants to merge 1 commit into
developmentfrom
alignment_separation
Open

separate scan alignment#3
sevahul wants to merge 1 commit into
developmentfrom
alignment_separation

Conversation

@sevahul
Copy link
Copy Markdown
Collaborator

@sevahul sevahul commented May 25, 2026

Scan alignment into a separate object

@sevahul sevahul requested a review from Copilot May 25, 2026 17:14
@sevahul sevahul self-assigned this May 25, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 mapOptimization to 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.

Comment thread include/scanAlignment/ScanAligner.hpp Outdated

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)
@sevahul sevahul force-pushed the alignment_separation branch from dfcdc9d to b19e197 Compare May 25, 2026 17:31
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