mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-11 03:59:53 +08:00
ros-pkg: added minimum grid map size parameters ("occupancy_map_size" for map_assembler and "map_size" for grid_map_assembler)
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/ros-pkg@1963 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -44,18 +44,21 @@ class GridMapAssembler
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GridMapAssembler() :
|
GridMapAssembler() :
|
||||||
gridCellSize_(0.05),
|
gridCellSize_(0.05), // meters
|
||||||
|
mapSize_(0), // meters
|
||||||
gridUnknownSpaceFilled_(true),
|
gridUnknownSpaceFilled_(true),
|
||||||
filterRadius_(0.5),
|
filterRadius_(0.5),
|
||||||
filterAngle_(30.0) // degrees
|
filterAngle_(30.0) // degrees
|
||||||
{
|
{
|
||||||
ros::NodeHandle pnh("~");
|
ros::NodeHandle pnh("~");
|
||||||
pnh.param("cell_size", gridCellSize_, gridCellSize_);
|
pnh.param("cell_size", gridCellSize_, gridCellSize_); // m
|
||||||
|
pnh.param("map_size", mapSize_, mapSize_); // m
|
||||||
pnh.param("unknown_space_filled", gridUnknownSpaceFilled_, gridUnknownSpaceFilled_);
|
pnh.param("unknown_space_filled", gridUnknownSpaceFilled_, gridUnknownSpaceFilled_);
|
||||||
pnh.param("filter_radius", filterRadius_, filterRadius_);
|
pnh.param("filter_radius", filterRadius_, filterRadius_);
|
||||||
pnh.param("filter_angle", filterAngle_, filterAngle_);
|
pnh.param("filter_angle", filterAngle_, filterAngle_);
|
||||||
|
|
||||||
UASSERT(gridCellSize_ > 0.0);
|
UASSERT(gridCellSize_ > 0.0);
|
||||||
|
UASSERT(mapSize_ >= 0.0);
|
||||||
|
|
||||||
ros::NodeHandle nh;
|
ros::NodeHandle nh;
|
||||||
mapDataTopic_ = nh.subscribe("mapData", 1, &GridMapAssembler::mapDataReceivedCallback, this);
|
mapDataTopic_ = nh.subscribe("mapData", 1, &GridMapAssembler::mapDataReceivedCallback, this);
|
||||||
@@ -97,7 +100,7 @@ public:
|
|||||||
{
|
{
|
||||||
// create the map
|
// create the map
|
||||||
float xMin=0.0f, yMin=0.0f;
|
float xMin=0.0f, yMin=0.0f;
|
||||||
cv::Mat pixels = util3d::create2DMap(poses, scans_, gridCellSize_, gridUnknownSpaceFilled_, xMin, yMin);
|
cv::Mat pixels = util3d::create2DMap(poses, scans_, gridCellSize_, gridUnknownSpaceFilled_, xMin, yMin, mapSize_);
|
||||||
|
|
||||||
if(!pixels.empty())
|
if(!pixels.empty())
|
||||||
{
|
{
|
||||||
@@ -147,6 +150,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
double gridCellSize_;
|
double gridCellSize_;
|
||||||
|
double mapSize_;
|
||||||
bool gridUnknownSpaceFilled_;
|
bool gridUnknownSpaceFilled_;
|
||||||
double filterRadius_;
|
double filterRadius_;
|
||||||
double filterAngle_;
|
double filterAngle_;
|
||||||
|
|||||||
@@ -71,10 +71,12 @@ public:
|
|||||||
pnh.param("occupancy_cluster_min_size", clusterMinSize_, clusterMinSize_);
|
pnh.param("occupancy_cluster_min_size", clusterMinSize_, clusterMinSize_);
|
||||||
pnh.param("occupancy_empty_filling_radius", emptyCellFillingRadius_, emptyCellFillingRadius_);
|
pnh.param("occupancy_empty_filling_radius", emptyCellFillingRadius_, emptyCellFillingRadius_);
|
||||||
pnh.param("occupancy_max_height", maxHeight_, maxHeight_);
|
pnh.param("occupancy_max_height", maxHeight_, maxHeight_);
|
||||||
|
pnh.param("occupancy_map_size", occupancyMapSize_, occupancyMapSize_);
|
||||||
|
|
||||||
UASSERT(gridCellSize_ > 0);
|
UASSERT(gridCellSize_ > 0);
|
||||||
UASSERT(emptyCellFillingRadius_ >= 0);
|
UASSERT(emptyCellFillingRadius_ >= 0);
|
||||||
UASSERT(maxHeight_ >= 0);
|
UASSERT(maxHeight_ >= 0);
|
||||||
|
UASSERT(occupancyMapSize_ >=0.0);
|
||||||
|
|
||||||
ros::NodeHandle nh;
|
ros::NodeHandle nh;
|
||||||
mapDataTopic_ = nh.subscribe("mapData", 1, &MapAssembler::mapDataReceivedCallback, this);
|
mapDataTopic_ = nh.subscribe("mapData", 1, &MapAssembler::mapDataReceivedCallback, this);
|
||||||
@@ -253,7 +255,7 @@ public:
|
|||||||
{
|
{
|
||||||
// create the map
|
// create the map
|
||||||
float xMin=0.0f, yMin=0.0f;
|
float xMin=0.0f, yMin=0.0f;
|
||||||
cv::Mat pixels = util3d::create2DMapFromOccupancyLocalMaps(poses, occupancyLocalMaps_, gridCellSize_, xMin, yMin, emptyCellFillingRadius_);
|
cv::Mat pixels = util3d::create2DMapFromOccupancyLocalMaps(poses, occupancyLocalMaps_, gridCellSize_, xMin, yMin, emptyCellFillingRadius_, occupancyMapSize_);
|
||||||
|
|
||||||
if(!pixels.empty())
|
if(!pixels.empty())
|
||||||
{
|
{
|
||||||
@@ -308,6 +310,7 @@ private:
|
|||||||
int clusterMinSize_;
|
int clusterMinSize_;
|
||||||
int emptyCellFillingRadius_;
|
int emptyCellFillingRadius_;
|
||||||
double maxHeight_;
|
double maxHeight_;
|
||||||
|
double occupancyMapSize_;
|
||||||
|
|
||||||
std::map<int, std::pair<cv::Mat, cv::Mat> > occupancyLocalMaps_; // <ground, obstacles>
|
std::map<int, std::pair<cv::Mat, cv::Mat> > occupancyLocalMaps_; // <ground, obstacles>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user