Go to the documentation of this file.00001
00060
00061
00062
00063
00064 #include <ros/ros.h>
00065
00066
00067 #include <cob_3d_mapping_msgs/GetPointMap.h>
00068
00069
00070 #include <pcl/io/pcd_io.h>
00071 #include <pcl/point_types.h>
00072 #include <pcl/conversions.h>
00073 #include <pcl_conversions/pcl_conversions.h>
00074
00075 int main (int argc, char **argv)
00076 {
00077 if(argc<1) {
00078 ROS_ERROR("Please specify output file\nrosrun cob_3d_mapping_point_map get_map_client myfile.pcd");
00079 return -1;
00080 }
00081 ros::init(argc, argv, "get_point_map");
00082
00083 ros::NodeHandle nh;
00084
00085 ROS_INFO("Waiting for service server to start.");
00086 ros::service::waitForService("/point_map/get_map");
00087
00088 ROS_INFO("Server started, polling map.");
00089
00090
00091 cob_3d_mapping_msgs::GetPointMapRequest req;
00092 cob_3d_mapping_msgs::GetPointMapResponse resp;
00093
00094 if (ros::service::call("/point_map/get_map", req,resp))
00095 {
00096 ROS_INFO("Service call finished.");
00097 }
00098 else
00099 {
00100 ROS_INFO("[get point map]: Service call failed.");
00101 return 0;
00102 }
00103
00104 pcl::PointCloud<pcl::PointXYZRGB> map;
00105 pcl::PCLPointCloud2 map2;
00106 pcl_conversions::toPCL(resp.map, map2);
00107 pcl::fromPCLPointCloud2(map2, map);
00108
00109 pcl::io::savePCDFile(argv[1],map,false);
00110
00111
00112 return 0;
00113 }
00114