filtering.hpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
32 #ifndef _FILTERING_HPP_
33 #define _FILTERING_HPP_
34 
35 #include "filtering.h"
36 
37 template <class T>
38 void filtering<T>::filter(const sensor_msgs::PointCloud2Ptr& msg)
39 {
40  ROS_ERROR("Voxel filtering dissabled, must correct for ROS::HYDRO");
41 // /// Pass through a square voxel grid
42 // sensor_msgs::PointCloud2 msg_filt;
43 // msg_filt = voxel_filter(msg,voxel_size);
44 //
45 // /// Transform to atc/center/bumper
46 // PointCloud<T> cloud_voxelized;
47 // fromROSMsg(msg_filt,cloud_voxelized);
48 //
49 // tf::StampedTransform transform;
50 // try
51 // {
52 // transform_listener_ptr->lookupTransform(frame_id, msg->header.frame_id, ros::Time(0), transform);
53 // }
54 // catch (tf::TransformException ex)
55 // {
56 // ROS_ERROR("%s",ex.what());
57 // }
58 //
59 // PointCloud<T> cloud_trans;
60 // pcl_ros::transformPointCloud (cloud_voxelized,cloud_trans,transform);
61 // cloud_trans.header.frame_id=frame_id;
62 //
63 // /// Cutting the point cloud
64 // points_from_volume<T> pfv;
65 // PointCloud<T> cloud_cut;
66 // cloud_cut.header.frame_id=frame_id;
67 // pfv.set_convex_hull(convex_hull);
68 // pfv.convexhull_function(cloud_trans, max_z,min_z, false);
69 // cloud_cut=pfv.get_pc_in_volume();
70 //
71 // toROSMsg(cloud_cut,msg_filt);
72 //
73 // /// Publish the result
74 // pub_ptr->publish(msg_filt);
75 };
77 
78 template <class T>
79 sensor_msgs::PointCloud2 filtering<T>::voxel_filter(const sensor_msgs::PointCloud2Ptr& msg_in, double voxel_size)
80 {
81  ROS_ERROR("Voxel filtering dissabled, must correct for ROS::HYDRO");
82 // sensor_msgs::PointCloud2 msg_out;
83 // VoxelGrid<sensor_msgs::PointCloud2> sor;
84 // // sensor_msgs::PointCloud2ConstPtr batatas (new sensor_msgs::PointCloud2 (msg_in));
85 // sor.setInputCloud(msg_in);
86 // sor.setLeafSize (voxel_size, voxel_size, voxel_size);
87 // sor.filter (msg_out);
88 // return msg_out;
89 };
91 
92 #endif
sensor_msgs::PointCloud2 voxel_filter(const sensor_msgs::PointCloud2Ptr &msg_in, double voxel_size)
aplies a voxel grid on a sensor msg
Definition: filtering.hpp:79
void filter(const sensor_msgs::PointCloud2Ptr &msg)
Callback function for subscriber.
Definition: filtering.hpp:38
filtering class declaration


pointcloud_segmentation
Author(s): Tiago Talhada
autogenerated on Mon Mar 2 2015 01:32:39