MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / gridMapCallback

Method gridMapCallback

grid_map_demos/src/GridmapToImageDemo.cpp:32–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void GridMapToImageDemo::gridMapCallback(const grid_map_msgs::GridMap& msg)
33{
34 ROS_INFO("Saving map received from: %s to file %s.", nodeHandle_.resolveName(gridMapTopic_).c_str(), filePath_.c_str());
35 grid_map::GridMap map;
36 cv_bridge::CvImage image;
37 grid_map::GridMapRosConverter::fromMessage(msg, map, {"elevation"});
38 grid_map::GridMapRosConverter::toCvImage(map,"elevation", sensor_msgs::image_encodings::MONO8, image);
39 bool success = cv::imwrite(filePath_.c_str(),image.image, {cv::IMWRITE_PNG_STRATEGY_DEFAULT});
40 ROS_INFO("Success writing image: %s", success?"true":"false");
41 ros::shutdown();
42}
43
44} /* namespace */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected