How to use GetMap-Service by gmapping
I'm using gmapping to create a map. To this point everything works fine.
Now I want to call the GetMap-Service to receive the map for further investigation:
#include <nav_msgs/GetMap.h>
ros::ServiceClient client = n.serviceClient<nav_msgs::GetMap>("map");
nav_msgs::GetMap srv;
if (client.call(srv))
{
ROS_INFO("Service GetMap succeeded.");
}
else
{
ROS_ERROR("Service GetMap failed.");
return 1;
}
But when running this node I always get "Service GetMap failed." I added gmapping to "find packages" in CMakefile and to build & runtime dependencies in package xml.
What's my fault?