$search
00001 /* 00002 * Copyright (c) 2011, Jeannette Bohg and Mårten Björkman 00003 * ({bohg,celle}@csc.kth.se) 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are 00008 * met: 00009 * 00010 * 1.Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2.Redistributions in binary form must reproduce the above 00013 * copyright notice, this list of conditions and the following 00014 * disclaimer in the documentation and/or other materials provided 00015 * with the distribution. 00016 * 3.The name of Jeannette Bohg or Mårten Björkman may not be used to 00017 * endorse or promote products derived from this software without 00018 * specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00023 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00024 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 #ifndef PLANE_TRANSFORM 00034 #define PLANE_TRANSFORM 00035 00036 #include <sensor_msgs/CameraInfo.h> 00037 #include <sensor_msgs/PointCloud.h> 00038 00039 //#include <pcl/ModelCoefficients.h> 00040 #include "fast_plane_detection/Plane.h" 00041 00042 #include <tf/transform_listener.h> 00043 00044 namespace fast_plane_detection { 00045 00046 typedef geometry_msgs::Point32 Point; 00047 00048 class PlaneTransform { 00049 00050 public: 00051 PlaneTransform(const sensor_msgs::CameraInfo &camera_info, 00052 float baseline, float up_direction); 00053 00054 ~PlaneTransform(); 00055 00056 void setParameters( float alpha, 00057 float beta, 00058 float d, 00059 int min_x, int max_x, 00060 int min_y, int max_y, 00061 std_msgs::Header header); 00062 00063 bool getPlane( fast_plane_detection::Plane &plane ); 00064 00065 private: 00066 00067 std::vector<double> convertTo3DPlane(const sensor_msgs::CameraInfo &camera_info, 00068 float alpha, 00069 float beta, 00070 float d ); 00071 00072 tf::Transform getPlaneTransform (const std::vector<double> &coeffs, 00073 //const pcl::ModelCoefficients &coeffs, 00074 double up_direction); 00075 00076 bool transformPlanePoints ( const tf::Transform& plane_trans, 00077 sensor_msgs::PointCloud &plane_limits ); 00078 00079 fast_plane_detection::Plane 00080 constructPlaneMsg(const sensor_msgs::PointCloud &plane_limits, 00081 const std::vector<double> &coeffs,//const pcl::ModelCoefficients &coeffs, 00082 const tf::Transform &plane_trans); 00083 00084 void get3DTableLimits(sensor_msgs::PointCloud &plane_limits); 00085 00086 void get3DPlanePoint( int u, int v, Point &p); 00087 00088 sensor_msgs::CameraInfo camera_info_; 00089 00090 float baseline_; 00091 float up_direction_; 00092 00093 float alpha_, beta_, d_; 00094 00095 int min_x_, max_x_; 00096 int min_y_, max_y_; 00097 00098 std_msgs::Header header_; 00099 00100 tf::TransformListener listener; 00101 00102 }; 00103 00104 } // fast_plane_detection 00105 00106 #endif