| 30 | } |
| 31 | |
| 32 | void 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 */ |
nothing calls this directly
no outgoing calls
no test coverage detected