00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2012-, Open Perception, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of the copyright holder(s) nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 */ 00037 00038 #include <pcl/pcl_config.h> 00039 #define HAVE_PXCAPI 00040 #ifdef HAVE_PXCAPI 00041 00042 #ifndef __PCL_IO_PXC_GRABBER__ 00043 #define __PCL_IO_PXC_GRABBER__ 00044 00045 #include <pcl/io/eigen.h> 00046 #include <pcl/io/boost.h> 00047 #include <pcl/io/grabber.h> 00048 #include <pcl/common/synchronizer.h> 00049 00050 #include <boost/thread.hpp> 00051 00052 #include "pxcsmartptr.h" 00053 #include "pxcsession.h" 00054 #include "util_capture.h" 00055 #include "util_pipeline.h" 00056 //#include "util_pipeline_raw.h" 00057 #include "util_render.h" 00058 #include <util_capture.h> 00059 #include <pxcprojection.h> 00060 #include <pxcmetadata.h> 00061 00062 #include <string> 00063 #include <deque> 00064 00065 namespace pcl 00066 { 00067 struct PointXYZ; 00068 struct PointXYZRGB; 00069 struct PointXYZRGBA; 00070 struct PointXYZI; 00071 template <typename T> class PointCloud; 00072 00073 00074 /** \brief Grabber for PXC devices 00075 * \author Stefan Holzer <holzers@in.tum.de> 00076 * \ingroup io 00077 */ 00078 class PCL_EXPORTS PXCGrabber : public Grabber 00079 { 00080 public: 00081 00082 /** \brief Supported modes for grabbing from a PXC device. */ 00083 typedef enum 00084 { 00085 PXC_Default_Mode = 0, 00086 } Mode; 00087 00088 //define callback signature typedefs 00089 typedef void (sig_cb_pxc_point_cloud) (const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZ> >&); 00090 typedef void (sig_cb_pxc_point_cloud_rgb) (const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&); 00091 typedef void (sig_cb_pxc_point_cloud_rgba) (const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGBA> >&); 00092 typedef void (sig_cb_pxc_point_cloud_i) (const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZI> >&); 00093 00094 public: 00095 /** \brief Constructor */ 00096 PXCGrabber (); 00097 00098 /** \brief virtual Destructor inherited from the Grabber interface. It never throws. */ 00099 virtual ~PXCGrabber () throw (); 00100 00101 /** \brief Start the data acquisition. */ 00102 virtual void 00103 start (); 00104 00105 /** \brief Stop the data acquisition. */ 00106 virtual void 00107 stop (); 00108 00109 /** \brief Check if the data acquisition is still running. */ 00110 virtual bool 00111 isRunning () const; 00112 00113 /** \brief Returns the name of the grabber. */ 00114 virtual std::string 00115 getName () const; 00116 00117 /** \brief Obtain the number of frames per second (FPS). */ 00118 virtual float 00119 getFramesPerSecond () const; 00120 00121 protected: 00122 00123 /** \brief Initializes the PXC grabber and the grabbing pipeline. */ 00124 bool 00125 init (); 00126 00127 /** \brief Closes the grabbing pipeline. */ 00128 void 00129 close (); 00130 00131 /** \brief Continously asks for data from the device and publishes it if available. */ 00132 void 00133 processGrabbing (); 00134 00135 // signals to indicate whether new clouds are available 00136 boost::signals2::signal<sig_cb_pxc_point_cloud>* point_cloud_signal_; 00137 //boost::signals2::signal<sig_cb_fotonic_point_cloud_i>* point_cloud_i_signal_; 00138 boost::signals2::signal<sig_cb_pxc_point_cloud_rgb>* point_cloud_rgb_signal_; 00139 boost::signals2::signal<sig_cb_pxc_point_cloud_rgba>* point_cloud_rgba_signal_; 00140 00141 protected: 00142 // utiliy object for accessing PXC camera 00143 UtilPipeline pp_; 00144 // indicates whether grabbing is running 00145 bool running_; 00146 00147 // FPS computation 00148 mutable float fps_; 00149 mutable boost::mutex fps_mutex_; 00150 00151 // thread where the grabbing takes place 00152 boost::thread grabber_thread_; 00153 00154 public: 00155 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00156 }; 00157 00158 } // namespace pcl 00159 #endif // __PCL_IO_PXC_GRABBER__ 00160 #endif // HAVE_PXCAPI
Except where otherwise noted, the PointClouds.org web pages are licensed under Creative Commons Attribution 3.0.
Pages generated on Wed Mar 25 00:24:30 2015