pcd_io.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2009, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * $Id: pcd_io.h 35054 2011-01-03 21:16:49Z rusu $
00035  *
00036  */
00037 
00038 #ifndef PCL_ROS_IO_PCD_IO_H_
00039 #define PCL_ROS_IO_PCD_IO_H_
00040 
00041 #include <pcl/io/pcd_io.h>
00042 #include "pcl_ros/pcl_nodelet.h"
00043 
00044 namespace pcl_ros
00045 {
00047 
00050   class PCDReader : public PCLNodelet
00051   {
00052     public:
00053       typedef sensor_msgs::PointCloud2 PointCloud2;
00054       typedef PointCloud2::Ptr PointCloud2Ptr;
00055       typedef PointCloud2::ConstPtr PointCloud2ConstPtr;
00056 
00058       PCDReader () : publish_rate_ (0), tf_frame_ ("/base_link") {};
00059 
00060       virtual void onInit ();
00061 
00065       inline void setPublishRate (double publish_rate) { publish_rate_ = publish_rate; }
00066 
00068       inline double getPublishRate () { return (publish_rate_); }
00069 
00073       inline void setTFframe (std::string tf_frame) { tf_frame_ = tf_frame; }
00074 
00076       inline std::string getTFframe () { return (tf_frame_); }
00077 
00078     protected:
00080       double publish_rate_;
00081 
00083       std::string tf_frame_;
00084 
00086       std::string file_name_;
00087 
00089       PointCloud2Ptr output_;
00090 
00091     private:
00093       pcl::PCDReader impl_;
00094     public:
00095       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00096   };
00097 
00099 
00102   class PCDWriter : public PCLNodelet
00103   {
00104     public:
00105       PCDWriter () : file_name_ (""), binary_mode_ (true) {}
00106 
00107       typedef sensor_msgs::PointCloud2 PointCloud2;
00108       typedef PointCloud2::Ptr PointCloud2Ptr;
00109       typedef PointCloud2::ConstPtr PointCloud2ConstPtr;
00110 
00111       virtual void onInit ();
00112       void input_callback (const PointCloud2ConstPtr &cloud);
00113 
00115       ros::Subscriber sub_input_;
00116 
00117     protected:
00119       std::string file_name_;
00120 
00122       bool binary_mode_;
00123 
00124     private:
00126       pcl::PCDWriter impl_;
00127     public:
00128       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00129   };
00130 }
00131 
00132 #endif  //#ifndef PCL_ROS_IO_PCD_IO_H_


pcl_ros
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:22:23