Go to the documentation of this file.00001
00060
00061
00062
00063
00064 #include <ros/ros.h>
00065 #include <rosbag/bag.h>
00066
00067
00068 #include <cob_3d_mapping_msgs/GetGeometryMap.h>
00069 #include <cob_3d_mapping_msgs/ShapeArray.h>
00070
00071
00072
00073
00074
00075
00076 int main (int argc, char **argv)
00077 {
00078 if(argc<1) {
00079 ROS_ERROR("Please specify output file\nrosrun cob_3d_mapping_geometry_map get_map_client myfile.bag");
00080 return -1;
00081 }
00082 ros::init(argc, argv, "get_geometry_map");
00083
00084 ros::NodeHandle nh;
00085
00086 ROS_INFO("Waiting for service server to start.");
00087 ros::service::waitForService("/geometry_map/get_map");
00088
00089 ROS_INFO("Server started, polling map.");
00090
00091
00092 cob_3d_mapping_msgs::GetGeometryMapRequest req;
00093 cob_3d_mapping_msgs::GetGeometryMapResponse resp;
00094
00095 if (ros::service::call("/geometry_map/get_map", req,resp))
00096 {
00097 ROS_INFO("Service call finished.");
00098 }
00099 else
00100 {
00101 ROS_INFO("Service call failed.");
00102 return 0;
00103 }
00104
00105 rosbag::Bag bag;
00106 bag.open(argv[1], rosbag::bagmode::Write);
00107 bag.write("/geometry_map/map_array", resp.map.header.stamp, resp.map);
00108
00109 bag.close();
00110
00111
00112 return 0;
00113 }
00114