00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00033 #include <pointcloud_segmentation/laser_to_pc.h>
00034
00035 int main (int argc, char **argv)
00036 {
00037 ROS_INFO("Started laser_to_pc_nodelet");
00038 ros::init(argc,argv,"laser_to_pc_nodelet");
00039
00040 ros::NodeHandle n;
00041
00042
00043 string laser_input;
00044 string pointcloud_output;
00045 string frame_id;
00046
00047 double min_x,min_y,max_x,max_y;
00048
00049
00050 laser_to_pc * las_to_pointcloud = new laser_to_pc;
00051
00052
00053 ros::NodeHandle private_node_handle_("~");
00054 private_node_handle_.param("laser_input", laser_input, string("laser_input"));
00055 private_node_handle_.param("pointcloud_output", pointcloud_output, string("pointcloud_output"));
00056 private_node_handle_.param("frame_id", frame_id, string("frame_id"));
00057 private_node_handle_.param("min_x", min_x, double(min_x));
00058 private_node_handle_.param("min_y", min_y, double(min_y));
00059 private_node_handle_.param("max_x", max_x, double(max_x));
00060 private_node_handle_.param("max_y", max_y, double(max_y));
00061 private_node_handle_.param("min_z", las_to_pointcloud->min_z, double(las_to_pointcloud->min_z));
00062 private_node_handle_.param("max_z", las_to_pointcloud->max_z, double(las_to_pointcloud->max_z));
00063
00064
00065 ros::Subscriber sub_cloud = n.subscribe(laser_input.c_str(), 1000, &laser_to_pc::filter, las_to_pointcloud);
00066
00067
00068 ros::Publisher pub_message = n.advertise<sensor_msgs::PointCloud2>(pointcloud_output.c_str(), 10);
00069
00070 las_to_pointcloud->pub_ptr=&pub_message;
00071
00072
00073 tf::TransformListener listener;
00074 las_to_pointcloud->listener_ptr=&listener;
00075 las_to_pointcloud->frame_id=frame_id;
00076
00077
00078 PointXYZ point; point.z=0.0;
00079 point.x=min_x; point.y=max_y;
00080 las_to_pointcloud->convex_hull.points.push_back(point);
00081 point.x=max_x; point.y=max_y;
00082 las_to_pointcloud->convex_hull.points.push_back(point);
00083 point.x=max_x; point.y=min_y;
00084 las_to_pointcloud->convex_hull.points.push_back(point);
00085 point.x=min_x; point.y=min_y;
00086 las_to_pointcloud->convex_hull.points.push_back(point);
00087 las_to_pointcloud->convex_hull.header.frame_id=frame_id;
00088
00089
00090
00091 while (n.ok())
00092 {
00093 ros::spinOnce();
00094 }
00095
00096 return 1;
00097 }