mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Fixed holes in 2d occupancy grids created from scans. Fixed grid map in 3D view not updated.
This commit is contained in:
@@ -88,10 +88,10 @@ void occupancy2DFromLaserScan(
|
|||||||
int i=0;
|
int i=0;
|
||||||
for(std::list<int>::iterator iter=groundIndices.begin();iter!=groundIndices.end(); ++iter)
|
for(std::list<int>::iterator iter=groundIndices.begin();iter!=groundIndices.end(); ++iter)
|
||||||
{
|
{
|
||||||
int x = *iter / map8S.cols;
|
int y = *iter / map8S.cols;
|
||||||
int y = *iter - x*map8S.cols;
|
int x = *iter - y*map8S.cols;
|
||||||
ground.at<cv::Vec2f>(i)[0] = (float(y)+0.5)*cellSize + xMin;
|
ground.at<cv::Vec2f>(i)[0] = (float(x))*cellSize + xMin;
|
||||||
ground.at<cv::Vec2f>(i)[1] = (float(x)+0.5)*cellSize + yMin;
|
ground.at<cv::Vec2f>(i)[1] = (float(y))*cellSize + yMin;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1148,9 +1148,9 @@ bool CloudViewer::addOccupancyGridMap(
|
|||||||
float ySize = float(map8U.rows) * resolution;
|
float ySize = float(map8U.rows) * resolution;
|
||||||
|
|
||||||
UDEBUG("resolution=%f, xSize=%f, ySize=%f, xMin=%f, yMin=%f", resolution, xSize, ySize, xMin, yMin);
|
UDEBUG("resolution=%f, xSize=%f, ySize=%f, xMin=%f, yMin=%f", resolution, xSize, ySize, xMin, yMin);
|
||||||
if(_visualizer->getCloudActorMap()->find("map") == _visualizer->getCloudActorMap()->end())
|
if(_visualizer->getCloudActorMap()->find("map") != _visualizer->getCloudActorMap()->end())
|
||||||
{
|
{
|
||||||
_visualizer->removeShape("map");
|
_visualizer->removePointCloud("map");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xSize > 0.0f && ySize > 0.0f)
|
if(xSize > 0.0f && ySize > 0.0f)
|
||||||
|
|||||||
Reference in New Issue
Block a user