plane_transform.h
Go to the documentation of this file.
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(float fx, float fy, 
00055                    float cx, float cy,  
00056                    float baseline, float up_direction);
00057     ~PlaneTransform();
00058 
00059     void setParameters( float alpha, 
00060                         float beta, 
00061                         float d,
00062                         int min_x, int max_x, 
00063                         int min_y, int max_y, 
00064                         std_msgs::Header header);
00065 
00066     bool getPlane( fast_plane_detection::Plane &plane );
00067 
00068   private:
00069     
00070     std::vector<double> convertTo3DPlane(float alpha, 
00071                                          float beta, 
00072                                          float d );
00073     
00074     tf::Transform getPlaneTransform (const std::vector<double> &coeffs,
00075                                      //const pcl::ModelCoefficients &coeffs, 
00076                                      double up_direction);
00077     
00078     bool transformPlanePoints ( const tf::Transform& plane_trans,
00079                                 sensor_msgs::PointCloud &plane_limits );
00080 
00081     fast_plane_detection::Plane 
00082       constructPlaneMsg(const sensor_msgs::PointCloud &plane_limits,
00083                         const std::vector<double> &coeffs,//const pcl::ModelCoefficients &coeffs, 
00084                         const tf::Transform &plane_trans);
00085     
00086     void get3DTableLimits(sensor_msgs::PointCloud &plane_limits);
00087 
00088     void get3DPlanePoint( int u, int v, Point &p);
00089 
00090     //sensor_msgs::CameraInfo camera_info_;
00091     
00092     float fx_, fy_;
00093     float cx_, cy_;
00094 
00095     float baseline_;
00096     float up_direction_;
00097     
00098     float alpha_, beta_, d_;
00099 
00100     int min_x_, max_x_;
00101     int min_y_, max_y_;
00102     
00103     std_msgs::Header header_;
00104     
00105     tf::TransformListener listener;
00106 
00107   };
00108   
00109 } // fast_plane_detection
00110 
00111 #endif


fast_plane_detection
Author(s): Jeannette Bohg
autogenerated on Fri Jan 3 2014 12:11:20