ROS::对costmap_2d的某一层地图做操作
std::vector<boost::shared_ptr<costmap_2d::Layer> >* plugins = global_costmap_->getLayeredCostmap()->getPlugins();
for (std::vector<boost::shared_ptr<costmap_2d::Layer> >::iterator pluginp = plugins->begin(); pluginp != plugins->end(); ++pluginp)
{
boost::shared_ptr<costmap_2d::Layer> plugin = *pluginp;
if(plugin->getName().find("obstacles")!=std::string::npos)
{
boost::shared_ptr<costmap_2d::ObstacleLayer> costmap;
costmap = boost::static_pointer_cast<costmap_2d::ObstacleLayer>(plugin);
costmap->setConvexPolygonCost(global_poly, costmap_2d::FREE_SPACE);
}
}