Skip to content

Commit

Permalink
Merge pull request #205 from SpriteLin-ZJU/master
Browse files Browse the repository at this point in the history
Fix keyframe indices downsample bug
  • Loading branch information
TixiaoShan authored Feb 23, 2021
2 parents 944cda4 + 9b8c3e9 commit 2d6e50d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mapOptmization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ class mapOptimization : public ParamServer
downSizeFilterGlobalMapKeyPoses.setLeafSize(globalMapVisualizationPoseDensity, globalMapVisualizationPoseDensity, globalMapVisualizationPoseDensity); // for global map visualization
downSizeFilterGlobalMapKeyPoses.setInputCloud(globalMapKeyPoses);
downSizeFilterGlobalMapKeyPoses.filter(*globalMapKeyPosesDS);
for(auto& pt : globalMapKeyPosesDS->points)
{
kdtreeGlobalMap->nearestKSearch(pt, 1, pointSearchIndGlobalMap, pointSearchSqDisGlobalMap);
pt.intensity = cloudKeyPoses3D->points[pointSearchIndGlobalMap[0]].intensity;
}

// extract visualized and downsampled key frames
for (int i = 0; i < (int)globalMapKeyPosesDS->size(); ++i){
Expand Down Expand Up @@ -868,6 +873,11 @@ class mapOptimization : public ParamServer

downSizeFilterSurroundingKeyPoses.setInputCloud(surroundingKeyPoses);
downSizeFilterSurroundingKeyPoses.filter(*surroundingKeyPosesDS);
for(auto& pt : surroundingKeyPosesDS->points)
{
kdtreeSurroundingKeyPoses->nearestKSearch(pt, 1, pointSearchInd, pointSearchSqDis);
pt.intensity = cloudKeyPoses3D->points[pointSearchInd[0]].intensity;
}

// also extract some latest key frames in case the robot rotates in one position
int numPoses = cloudKeyPoses3D->size();
Expand Down

0 comments on commit 2d6e50d

Please sign in to comment.