Point Cloud Library (PCL)
1.7.0
|
00001 #ifndef PCL_TRACKING_KLD_ADAPTIVE_PARTICLE_FILTER_OMP_H_ 00002 #define PCL_TRACKING_KLD_ADAPTIVE_PARTICLE_FILTER_OMP_H_ 00003 00004 #include <pcl/tracking/tracking.h> 00005 #include <pcl/tracking/kld_adaptive_particle_filter.h> 00006 #include <pcl/tracking/coherence.h> 00007 00008 namespace pcl 00009 { 00010 namespace tracking 00011 { 00012 /** \brief @b KLDAdaptiveParticleFilterOMPTracker tracks the PointCloud which is given by 00013 setReferenceCloud within the measured PointCloud using particle filter method. 00014 The number of the particles changes adaptively based on KLD sampling [D. Fox, NIPS-01], [D.Fox, IJRR03]. 00015 and the computation of the weights of the particles is parallelized using OpenMP. 00016 * \author Ryohei Ueda 00017 * \ingroup tracking 00018 */ 00019 template <typename PointInT, typename StateT> 00020 class KLDAdaptiveParticleFilterOMPTracker: public KLDAdaptiveParticleFilterTracker<PointInT, StateT> 00021 { 00022 public: 00023 using Tracker<PointInT, StateT>::tracker_name_; 00024 using Tracker<PointInT, StateT>::search_; 00025 using Tracker<PointInT, StateT>::input_; 00026 using Tracker<PointInT, StateT>::indices_; 00027 using Tracker<PointInT, StateT>::getClassName; 00028 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::particles_; 00029 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::change_detector_; 00030 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::change_counter_; 00031 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::change_detector_interval_; 00032 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::use_change_detector_; 00033 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::pass_x_; 00034 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::pass_y_; 00035 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::pass_z_; 00036 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::alpha_; 00037 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::changed_; 00038 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::coherence_; 00039 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::use_normal_; 00040 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::particle_num_; 00041 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::change_detector_filter_; 00042 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::transed_reference_vector_; 00043 //using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::calcLikelihood; 00044 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::normalizeWeight; 00045 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::normalizeParticleWeight; 00046 using KLDAdaptiveParticleFilterTracker<PointInT, StateT>::calcBoundingBox; 00047 00048 typedef Tracker<PointInT, StateT> BaseClass; 00049 00050 typedef typename Tracker<PointInT, StateT>::PointCloudIn PointCloudIn; 00051 typedef typename PointCloudIn::Ptr PointCloudInPtr; 00052 typedef typename PointCloudIn::ConstPtr PointCloudInConstPtr; 00053 00054 typedef typename Tracker<PointInT, StateT>::PointCloudState PointCloudState; 00055 typedef typename PointCloudState::Ptr PointCloudStatePtr; 00056 typedef typename PointCloudState::ConstPtr PointCloudStateConstPtr; 00057 00058 typedef PointCoherence<PointInT> Coherence; 00059 typedef boost::shared_ptr< Coherence > CoherencePtr; 00060 typedef boost::shared_ptr< const Coherence > CoherenceConstPtr; 00061 00062 typedef PointCloudCoherence<PointInT> CloudCoherence; 00063 typedef boost::shared_ptr< CloudCoherence > CloudCoherencePtr; 00064 typedef boost::shared_ptr< const CloudCoherence > CloudCoherenceConstPtr; 00065 00066 /** \brief Initialize the scheduler and set the number of threads to use. 00067 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic) 00068 */ 00069 KLDAdaptiveParticleFilterOMPTracker (unsigned int nr_threads = 0) 00070 : KLDAdaptiveParticleFilterTracker<PointInT, StateT> () 00071 , threads_ (nr_threads) 00072 { 00073 tracker_name_ = "KLDAdaptiveParticleFilterOMPTracker"; 00074 } 00075 00076 /** \brief Initialize the scheduler and set the number of threads to use. 00077 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic) 00078 */ 00079 inline void 00080 setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; } 00081 00082 protected: 00083 /** \brief The number of threads the scheduler should use. */ 00084 unsigned int threads_; 00085 00086 /** \brief weighting phase of particle filter method. 00087 calculate the likelihood of all of the particles and set the weights. 00088 */ 00089 virtual void weight (); 00090 00091 }; 00092 } 00093 } 00094 00095 //#include <pcl/tracking/impl/particle_filter_omp.hpp> 00096 #ifdef PCL_NO_PRECOMPILE 00097 #include <pcl/tracking/impl/kld_adaptive_particle_filter_omp.hpp> 00098 #endif 00099 00100 #endif