Fawkes API  Fawkes Development Version
pcl_frombuf_thread.h
00001 
00002 /***************************************************************************
00003  *  pointcloud_thread.h - OpenNI point cloud provider thread
00004  *
00005  *  Created: Fri Mar 25 23:48:05 2011
00006  *  Copyright  2006-2011  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_OPENNI_PCL_FROMBUF_THREAD_H_
00024 #define __PLUGINS_OPENNI_PCL_FROMBUF_THREAD_H_
00025 
00026 #include <core/threading/thread.h>
00027 #include <core/utils/lockptr.h>
00028 #include <aspect/logging.h>
00029 #include <aspect/configurable.h>
00030 #include <aspect/clock.h>
00031 #include <aspect/blocked_timing.h>
00032 #include <aspect/pointcloud.h>
00033 #include <pcl/point_cloud.h>
00034 #include <pcl/point_types.h>
00035 #include <fvutils/adapters/pcl.h>
00036 #include <plugins/openni/aspect/openni.h>
00037 #include <utils/time/time.h>
00038 
00039 #include <map>
00040 
00041 namespace firevision {
00042   class SharedMemoryImageBuffer;
00043 }
00044 
00045 class OpenNiPclOnlyThread
00046 : public fawkes::Thread,
00047   public fawkes::BlockedTimingAspect,
00048   public fawkes::LoggingAspect,
00049   public fawkes::ConfigurableAspect,
00050   public fawkes::ClockAspect,
00051   public fawkes::PointCloudAspect
00052 {
00053  public:
00054   OpenNiPclOnlyThread();
00055   virtual ~OpenNiPclOnlyThread();
00056 
00057   virtual void init();
00058   virtual void loop();
00059   virtual void finalize();
00060 
00061  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00062  protected: virtual void run() { Thread::run(); }
00063 
00064  private:
00065   firevision::SharedMemoryImageBuffer *__pcl_buf;
00066   fawkes::RefPtr<pcl::PointCloud<pcl::PointXYZ> > __pcl;
00067 
00068   fawkes::Time __last_capture_time;
00069   unsigned int __width;
00070   unsigned int __height;
00071 };
00072 
00073 #endif