00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00032 #ifndef _PLANE_ROAD_EXTRACTION_H_ 00033 #define _PLANE_ROAD_EXTRACTION_H_ 00034 00035 // ROS includes. 00036 #include <ros/ros.h> 00037 #include <sensor_msgs/PointCloud2.h> 00038 #include <tf/transform_listener.h> 00039 #include <pcl_ros/transforms.h> 00040 00041 // PCL includes 00042 #include <pcl/point_types.h> 00043 #include <pcl/ros/conversions.h> 00044 #include <pcl/surface/convex_hull.h> 00045 00046 // LAR includes 00047 #include <points_from_volume/points_from_volume.h> 00048 #include <plane_model_road_segmentation/plane_model_road_segmentation.h> 00049 00050 using namespace std; 00051 using namespace pcl; 00052 00053 template<class T> 00054 class plane_road_extraction 00055 { 00056 public: 00057 00059 plane_road_extraction() 00060 { 00061 }; 00062 00064 ~plane_road_extraction() 00065 { 00066 }; 00067 00068 // VARIABLES 00069 00071 PointCloud<T> pc_in; 00072 00074 PointCloud<T> pc_road; 00075 00077 PointCloud<T> pc_clusters; 00078 00080 plane_model_road<T> pms; 00081 00083 ros::Publisher * pub_road_ptr; 00084 00086 ros::Publisher * pub_clusters_ptr; 00087 00089 ros::Publisher * pub_road_perimeter_ptr; 00090 00092 double z_min,z_max; 00093 00094 // FUNCTIONS 00095 00097 void filter (const sensor_msgs::PointCloud2Ptr& msg); 00098 00106 PointCloud<T> project_cloud_on_plane(PointCloud<T> cloud_in, ModelCoefficients::Ptr coefficients); 00107 00116 T transform_pcl_point(string frame1, tf::Transform transform, T pt_origin); 00117 00118 }; 00119 00120 #include "plane_road_extraction.hpp" 00121 00122 #endif