From 58f557309ec428b279e25931e48f48cb10ce488f Mon Sep 17 00:00:00 2001 From: Mathieu Labbe Date: Mon, 23 Feb 2015 16:09:02 -0500 Subject: [PATCH] increased map marging to 10*cellSize to make sure all poses are in the map --- corelib/src/util3d.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/corelib/src/util3d.cpp b/corelib/src/util3d.cpp index 668c2b88..95338d35 100644 --- a/corelib/src/util3d.cpp +++ b/corelib/src/util3d.cpp @@ -2183,7 +2183,7 @@ cv::Mat create2DMapFromOccupancyLocalMaps( if(minX != maxX && minY != maxY) { //Get map size - float margin = cellSize; + float margin = cellSize*10.0f; xMin = minX-margin; yMin = minY-margin; float xMax = maxX+margin; @@ -2211,6 +2211,7 @@ cv::Mat create2DMapFromOccupancyLocalMaps( map.at(pt.y, pt.x) = 100; // obstacles } } + //UDEBUG("empty=%d occupied=%d", empty, occupied); } @@ -2314,10 +2315,11 @@ cv::Mat create2DMap(const std::map & poses, pcl::getMinMax3D(minMax, min, max); // Added X2 to make sure that all points are inside the map (when rounded to integer) - xMin = min.x-cellSize*2.0f; - yMin = min.y-cellSize*2.0f; - float xMax = max.x+cellSize*2.0f; - float yMax = max.y+cellSize*2.0f; + float marging = cellSize*10.0f; + xMin = min.x-marging; + yMin = min.y-marging; + float xMax = max.x+marging; + float yMax = max.y+marging; UDEBUG("map min=(%f, %f) max=(%f,%f)", xMin, yMin, xMax, yMax);