Fixed occupancy grid not reconstructed if it was not saved in previous run

This commit is contained in:
matlabbe
2018-04-30 13:06:25 -04:00
parent a92748167d
commit 6c10d9fecf
3 changed files with 8 additions and 5 deletions
+5 -4
View File
@@ -44,10 +44,11 @@
<param name="Reg/Strategy" type="string" value="1"/> <!-- 0=Visual, 1=ICP, 2=Visual+ICP -->
<param name="Vis/InlierDistance" type="string" value="0.1"/> <!-- 3D visual words correspondence distance -->
<param name="RGBD/OptimizeFromGraphEnd" type="string" value="false"/> <!-- Optimize graph from initial node so /map -> /odom transform will be generated -->
<param name="Reg/Force3DoF" type="string" value="true"/>
<param name="Grid/FromDepth" type="string" value="false"/>
<param name="Mem/STMSize" type="string" value="30"/> <!--increased to 30 to avoid adding too many loop closures on just seen locations -->
<param name="RGBD/LocalRadius" type="string" value="5"/> <!--limit length of proximity detections -->
<param name="RGBD/OptimizeMaxError" type="string" value="2.0"/> <!-- Reject any loop closure causing large errors (>2x link's covariance) in the map -->
<param name="Reg/Force3DoF" type="string" value="true"/> <!-- 2D SLAM -->
<param name="Grid/FromDepth" type="string" value="false"/> <!-- Create 2D occupancy grid from laser scan -->
<param name="Mem/STMSize" type="string" value="30"/> <!-- increased to 30 to avoid adding too many loop closures on just seen locations -->
<param name="RGBD/LocalRadius" type="string" value="5"/> <!-- limit length of proximity detections -->
<!-- localization mode -->
<param if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
+2
View File
@@ -478,6 +478,7 @@ void CoreWrapper::onInit()
cv::Mat map = rtabmap_.getMemory()->load2DMap(xMin, yMin, gridCellSize);
if(!map.empty())
{
NODELET_INFO("rtabmap: 2D occupancy grid map loaded.\n");
mapsManager_.set2DMap(map, xMin, yMin, gridCellSize, rtabmap_.getLocalOptimizedPoses());
}
}
@@ -647,6 +648,7 @@ CoreWrapper::~CoreWrapper()
cv::Mat pixels = mapsManager_.getGridMap(xMin, yMin, gridCellSize);
if(!pixels.empty())
{
printf("rtabmap: 2D occupancy grid map saved.\n");
rtabmap_.getMemory()->save2DMap(pixels, xMin, yMin, gridCellSize);
}
}
+1 -1
View File
@@ -495,7 +495,7 @@ std::map<int, rtabmap::Transform> MapsManager::updateMapCaches(
"save them back in the database for next sessions. This warning is only shown once.",
data.id(), Parameters::kRGBDCreateOccupancyGrid().c_str());
}
if(memory && occupancySavedInDB)
if(memory && occupancySavedInDB && generateGrid)
{
// if we are here, it is because we loaded a database with old nodes not having occupancy grid set
// try reload again