00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Robot Operating System code by the University of Osnabrück 00005 * Copyright (c) 2015, University of Osnabrück 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above 00013 * copyright notice, this list of conditions and the following 00014 * disclaimer. 00015 * 00016 * 2. Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * 00021 * 3. Neither the name of the copyright holder nor the names of its 00022 * contributors may be used to endorse or promote products derived 00023 * from this software without specific prior written permission. 00024 * 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00027 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00028 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00029 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00030 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00031 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00032 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00033 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00034 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00035 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00036 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * 00039 * 00040 * box_filter.h 00041 * 00042 * author: Sebastian Pütz <spuetz@uni-osnabrueck.de> 00043 */ 00044 00045 00046 00047 #ifndef BOXFILTER_H 00048 #define BOXFILTER_H 00049 00050 #include <filters/filter_base.h> 00051 00052 #include <sensor_msgs/LaserScan.h> 00053 #include <sensor_msgs/point_cloud_conversion.h> 00054 #include <laser_geometry/laser_geometry.h> 00055 00056 #include <tf/transform_datatypes.h> 00057 #include <tf/transform_listener.h> 00058 00059 00060 namespace laser_filters 00061 { 00065 class LaserScanBoxFilter : public filters::FilterBase<sensor_msgs::LaserScan> 00066 { 00067 public: 00068 LaserScanBoxFilter(); 00069 bool configure(); 00070 00071 bool update( 00072 const sensor_msgs::LaserScan& input_scan, 00073 sensor_msgs::LaserScan& filtered_scan); 00074 00075 private: 00076 bool inBox(tf::Point &point); 00077 std::string box_frame_; 00078 laser_geometry::LaserProjection projector_; 00079 00080 // tf listener to transform scans into the box_frame 00081 tf::TransformListener tf_; 00082 00083 // defines two opposite corners of the box 00084 tf::Point min_, max_; 00085 bool up_and_running_; 00086 }; 00087 00088 } 00089 00090 00091 #endif /* box_filter.h */