mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
Fixed occupancy grid not reconstructed if it was not saved in previous run
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user