Point Cloud Library (PCL)  1.11.1-dev
particle_filter.h
1 #pragma once
2 
3 #include <pcl/filters/passthrough.h>
4 #include <pcl/octree/octree_pointcloud_changedetector.h>
5 #include <pcl/tracking/coherence.h>
6 #include <pcl/tracking/tracker.h>
7 #include <pcl/tracking/tracking.h>
8 #include <pcl/memory.h>
9 
10 namespace pcl {
11 namespace tracking {
12 /** \brief @b ParticleFilterTracker tracks the PointCloud which is given by
13  * setReferenceCloud within the measured PointCloud using particle filter method.
14  * \author Ryohei Ueda
15  * \ingroup tracking
16  */
17 template <typename PointInT, typename StateT>
18 class ParticleFilterTracker : public Tracker<PointInT, StateT> {
19 protected:
21 
22 public:
28 
29  using Ptr = shared_ptr<ParticleFilterTracker<PointInT, StateT>>;
30  using ConstPtr = shared_ptr<const ParticleFilterTracker<PointInT, StateT>>;
31 
33 
35  using PointCloudInPtr = typename PointCloudIn::Ptr;
36  using PointCloudInConstPtr = typename PointCloudIn::ConstPtr;
37 
39  using PointCloudStatePtr = typename PointCloudState::Ptr;
40  using PointCloudStateConstPtr = typename PointCloudState::ConstPtr;
41 
43  using CoherencePtr = typename Coherence::Ptr;
45 
49 
50  /** \brief Empty constructor. */
52  : iteration_num_(1)
53  , particle_num_()
54  , min_indices_(1)
55  , ref_()
56  , particles_()
57  , coherence_()
59  , occlusion_angle_thr_(M_PI / 2.0)
60  , alpha_(15.0)
62  , use_normal_(false)
63  , motion_()
64  , motion_ratio_(0.25)
65  , pass_x_()
66  , pass_y_()
67  , pass_z_()
70  , changed_(false)
71  , change_counter_(0)
75  , use_change_detector_(false)
76  {
77  tracker_name_ = "ParticleFilterTracker";
84  }
85 
86  /** \brief Set the number of iteration.
87  * \param[in] iteration_num the number of iteration.
88  */
89  inline void
90  setIterationNum(const int iteration_num)
91  {
92  iteration_num_ = iteration_num;
93  }
94 
95  /** \brief Get the number of iteration. */
96  inline int
98  {
99  return iteration_num_;
100  }
101 
102  /** \brief Set the number of the particles.
103  * \param[in] particle_num the number of the particles.
104  */
105  inline void
106  setParticleNum(const int particle_num)
107  {
108  particle_num_ = particle_num;
109  }
110 
111  /** \brief Get the number of the particles. */
112  inline int
114  {
115  return particle_num_;
116  }
117 
118  /** \brief Set a pointer to a reference dataset to be tracked.
119  * \param[in] ref a pointer to a PointCloud message
120  */
121  inline void
123  {
124  ref_ = ref;
125  }
126 
127  /** \brief Get a pointer to a reference dataset to be tracked. */
128  inline PointCloudInConstPtr const
130  {
131  return ref_;
132  }
133 
134  /** \brief Set the PointCloudCoherence as likelihood.
135  * \param[in] coherence a pointer to PointCloudCoherence.
136  */
137  inline void
139  {
140  coherence_ = coherence;
141  }
142 
143  /** \brief Get the PointCloudCoherence to compute likelihood. */
144  inline CloudCoherencePtr
146  {
147  return coherence_;
148  }
149 
150  /** \brief Set the covariance of step noise.
151  * \param[in] step_noise_covariance the diagonal elements of covariance matrix
152  * of step noise.
153  */
154  inline void
155  setStepNoiseCovariance(const std::vector<double>& step_noise_covariance)
156  {
157  step_noise_covariance_ = step_noise_covariance;
158  }
159 
160  /** \brief Set the covariance of the initial noise. It will be used when
161  * initializing the particles.
162  * \param[in] initial_noise_covariance the diagonal elements of covariance matrix of
163  * initial noise.
164  */
165  inline void
166  setInitialNoiseCovariance(const std::vector<double>& initial_noise_covariance)
167  {
168  initial_noise_covariance_ = initial_noise_covariance;
169  }
170 
171  /** \brief Set the mean of the initial noise. It will be used when
172  * initializing the particles.
173  * \param[in] initial_noise_mean the mean values of initial noise.
174  */
175  inline void
176  setInitialNoiseMean(const std::vector<double>& initial_noise_mean)
177  {
178  initial_noise_mean_ = initial_noise_mean;
179  }
180 
181  /** \brief Set the threshold to re-initialize the particles.
182  * \param[in] resample_likelihood_thr threshold to re-initialize.
183  */
184  inline void
185  setResampleLikelihoodThr(const double resample_likelihood_thr)
186  {
187  resample_likelihood_thr_ = resample_likelihood_thr;
188  }
189 
190  /** \brief Set the threshold of angle to be considered occlusion (default:
191  * pi/2). ParticleFilterTracker does not take the occluded points into account
192  * according to the angle between the normal and the position.
193  * \param[in] occlusion_angle_thr threshold of angle to be considered occlusion.
194  */
195  inline void
196  setOcclusionAngleThe(const double occlusion_angle_thr)
197  {
198  occlusion_angle_thr_ = occlusion_angle_thr;
199  }
200 
201  /** \brief Set the minimum number of indices (default: 1).
202  * ParticleFilterTracker does not take into account the hypothesis
203  * whose the number of points is smaller than the minimum indices.
204  * \param[in] min_indices the minimum number of indices.
205  */
206  inline void
207  setMinIndices(const int min_indices)
208  {
209  min_indices_ = min_indices;
210  }
211 
212  /** \brief Set the transformation from the world coordinates to the frame of
213  * the particles.
214  * \param[in] trans Affine transformation from the worldcoordinates to the frame of
215  * the particles.
216  */
217  inline void
218  setTrans(const Eigen::Affine3f& trans)
219  {
220  trans_ = trans;
221  }
222 
223  /** \brief Get the transformation from the world coordinates to the frame of
224  * the particles. */
225  inline Eigen::Affine3f
226  getTrans() const
227  {
228  return trans_;
229  }
230 
231  /** \brief Get an instance of the result of tracking.
232  * This function returns the particle that represents the transform between
233  * the reference point cloud at the beginning and the best guess about its
234  * location in the most recent frame.
235  */
236  inline StateT
237  getResult() const override
238  {
239  return representative_state_;
240  }
241 
242  /** \brief Convert a state to affine transformation from the world coordinates
243  * frame.
244  * \param[in] particle an instance of StateT.
245  */
246  Eigen::Affine3f
247  toEigenMatrix(const StateT& particle)
248  {
249  return particle.toEigenMatrix();
250  }
251 
252  /** \brief Get a pointer to a pointcloud of the particles. */
253  inline PointCloudStatePtr
254  getParticles() const
255  {
256  return particles_;
257  }
258 
259  /** \brief Normalize the weight of a particle using \f$ std::exp(1- alpha ( w
260  * - w_{min}) / (w_max - w_min)) \f$
261  * \note This method is described in [P.Azad
262  * et. al, ICRA11].
263  * \param[in] w the weight to be normalized
264  * \param[in] w_min the minimum weight of the particles
265  * \param[in] w_max the maximum weight of the particles
266  */
267  inline double
268  normalizeParticleWeight(double w, double w_min, double w_max)
269  {
270  return std::exp(1.0 - alpha_ * (w - w_min) / (w_max - w_min));
271  }
272 
273  /** \brief Set the value of alpha.
274  * \param[in] alpha the value of alpha
275  */
276  inline void
277  setAlpha(double alpha)
278  {
279  alpha_ = alpha;
280  }
281 
282  /** \brief Get the value of alpha. */
283  inline double
285  {
286  return alpha_;
287  }
288 
289  /** \brief Set the value of use_normal_.
290  * \param[in] use_normal the value of use_normal_.
291  */
292  inline void
293  setUseNormal(bool use_normal)
294  {
295  use_normal_ = use_normal;
296  }
297 
298  /** \brief Get the value of use_normal_. */
299  inline bool
301  {
302  return use_normal_;
303  }
304 
305  /** \brief Set the value of use_change_detector_.
306  * \param[in] use_change_detector the value of use_change_detector_.
307  */
308  inline void
309  setUseChangeDetector(bool use_change_detector)
310  {
311  use_change_detector_ = use_change_detector;
312  }
313 
314  /** \brief Get the value of use_change_detector_. */
315  inline bool
317  {
318  return use_change_detector_;
319  }
320 
321  /** \brief Set the motion ratio
322  * \param[in] motion_ratio the ratio of hypothesis to use motion model.
323  */
324  inline void
325  setMotionRatio(double motion_ratio)
326  {
327  motion_ratio_ = motion_ratio;
328  }
329 
330  /** \brief Get the motion ratio. */
331  inline double
333  {
334  return motion_ratio_;
335  }
336 
337  /** \brief Set the number of interval frames to run change detection.
338  * \param[in] change_detector_interval the number of interval frames.
339  */
340  inline void
341  setIntervalOfChangeDetection(unsigned int change_detector_interval)
342  {
343  change_detector_interval_ = change_detector_interval;
344  }
345 
346  /** \brief Get the number of interval frames to run change detection. */
347  inline unsigned int
349  {
351  }
352 
353  /** \brief Set the minimum amount of points required within leaf node to
354  * become serialized in change detection
355  * \param[in] change_detector_filter the minimum amount of points required within leaf
356  * node
357  */
358  inline void
359  setMinPointsOfChangeDetection(unsigned int change_detector_filter)
360  {
361  change_detector_filter_ = change_detector_filter;
362  }
363 
364  /** \brief Set the resolution of change detection.
365  * \param[in] resolution resolution of change detection octree
366  */
367  inline void
369  {
370  change_detector_resolution_ = resolution;
371  }
372 
373  /** \brief Get the resolution of change detection. */
374  inline double
376  {
378  }
379 
380  /** \brief Get the minimum amount of points required within leaf node to
381  * become serialized in change detection. */
382  inline unsigned int
384  {
386  }
387 
388  /** \brief Get the adjustment ratio. */
389  inline double
390  getFitRatio() const
391  {
392  return fit_ratio_;
393  }
394 
395  /** \brief Reset the particles to restart tracking*/
396  virtual inline void
398  {
399  if (particles_)
400  particles_->points.clear();
401  }
402 
403 protected:
404  /** \brief Compute the parameters for the bounding box of hypothesis
405  * pointclouds.
406  * \param[out] x_min the minimum value of x axis.
407  * \param[out] x_max the maximum value of x axis.
408  * \param[out] y_min the minimum value of y axis.
409  * \param[out] y_max the maximum value of y axis.
410  * \param[out] z_min the minimum value of z axis.
411  * \param[out] z_max the maximum value of z axis.
412  */
413  void
414  calcBoundingBox(double& x_min,
415  double& x_max,
416  double& y_min,
417  double& y_max,
418  double& z_min,
419  double& z_max);
420 
421  /** \brief Crop the pointcloud by the bounding box calculated from hypothesis
422  * and the reference pointcloud.
423  * \param[in] cloud a pointer to pointcloud to be cropped.
424  * \param[out] output a pointer to be assigned the cropped pointcloud.
425  */
426  void
428 
429  /** \brief Compute a reference pointcloud transformed to the pose that hypothesis
430  represents.
431  * \param[in] hypothesis a particle which represents a hypothesis.
432  * \param[in] indices the indices which should be taken into account.
433  * \param[out] cloud the resultant point cloud model dataset which is transformed to
434  hypothesis.
435  **/
436  void
437  computeTransformedPointCloud(const StateT& hypothesis,
438  std::vector<int>& indices,
439  PointCloudIn& cloud);
440 
441  /** \brief Compute a reference pointcloud transformed to the pose that hypothesis
442  * represents and calculate indices taking occlusion into account.
443  * \param[in] hypothesis a particle which represents a hypothesis.
444  * \param[in] indices the indices which should be taken into account.
445  * \param[out] cloud the resultant point cloud model dataset which is transformed to
446  hypothesis.
447  **/
448  void
449  computeTransformedPointCloudWithNormal(const StateT& hypothesis,
450  std::vector<int>& indices,
451  PointCloudIn& cloud);
452 
453  /** \brief Compute a reference pointcloud transformed to the pose that hypothesis
454  * represents and calculate indices without taking occlusion into account.
455  * \param[in] hypothesis a particle which represents a hypothesis.
456  * \param[out] cloud the resultant point cloud model dataset which is transformed to
457  *hypothesis.
458  **/
459  void
460  computeTransformedPointCloudWithoutNormal(const StateT& hypothesis,
461  PointCloudIn& cloud);
462 
463  /** \brief This method should get called before starting the actua computation. */
464  bool
465  initCompute() override;
466 
467  /** \brief Weighting phase of particle filter method. Calculate the likelihood
468  * of all of the particles and set the weights. */
469  virtual void
470  weight();
471 
472  /** \brief Resampling phase of particle filter method. Sampling the particles
473  * according to the weights calculated in weight method. In particular,
474  * "sample with replacement" is archieved by walker's alias method.
475  */
476  virtual void
477  resample();
478 
479  /** \brief Calculate the weighted mean of the particles and set it as the result. */
480  virtual void
481  update();
482 
483  /** \brief Normalize the weights of all the particels. */
484  virtual void
485  normalizeWeight();
486 
487  /** \brief Initialize the particles. initial_noise_covariance_ and
488  * initial_noise_mean_ are used for Gaussian sampling. */
489  void
490  initParticles(bool reset);
491 
492  /** \brief Track the pointcloud using particle filter method. */
493  void
494  computeTracking() override;
495 
496  /** \brief Implementation of "sample with replacement" using Walker's alias method.
497  * about Walker's alias method, you can check the paper below: article{355749}, author
498  * = {Walker, Alastair J.}, title = {An Efficient Method for Generating Discrete
499  * Random Variables with General Distributions},
500  * journal = {ACM Trans. Math. Softw.},
501  * volume = {3},
502  * number = {3},
503  * year = {1977},
504  * issn = {0098-3500},
505  * pages = {253--256},
506  * doi = {http://doi.acm.org/10.1145/355744.355749},
507  * publisher = {ACM},
508  * address = {New York, NY, USA},
509  * }
510  * \param a an alias table, which generated by genAliasTable.
511  * \param q a table of weight, which generated by genAliasTable.
512  */
513  int
514  sampleWithReplacement(const std::vector<int>& a, const std::vector<double>& q);
515 
516  /** \brief Generate the tables for walker's alias method. */
517  void
518  genAliasTable(std::vector<int>& a,
519  std::vector<double>& q,
520  const PointCloudStateConstPtr& particles);
521 
522  /** \brief Resampling the particle with replacement. */
523  void
525 
526  /** \brief Resampling the particle in deterministic way. */
527  void
529 
530  /** \brief Run change detection and return true if there is a change.
531  * \param[in] input a pointer to the input pointcloud.
532  */
533  bool
535 
536  /** \brief The number of iteration of particlefilter. */
538 
539  /** \brief The number of the particles. */
541 
542  /** \brief The minimum number of points which the hypothesis should have. */
544 
545  /** \brief Adjustment of the particle filter. */
546  double fit_ratio_;
547 
548  /** \brief A pointer to reference point cloud. */
550 
551  /** \brief A pointer to the particles */
553 
554  /** \brief A pointer to PointCloudCoherence. */
556 
557  /** \brief The diagonal elements of covariance matrix of the step noise. the
558  * covariance matrix is used at every resample method.
559  */
560  std::vector<double> step_noise_covariance_;
561 
562  /** \brief The diagonal elements of covariance matrix of the initial noise.
563  * the covariance matrix is used when initialize the particles.
564  */
565  std::vector<double> initial_noise_covariance_;
566 
567  /** \brief The mean values of initial noise. */
568  std::vector<double> initial_noise_mean_;
569 
570  /** \brief The threshold for the particles to be re-initialized. */
572 
573  /** \brief The threshold for the points to be considered as occluded. */
575 
576  /** \brief The weight to be used in normalization of the weights of the
577  * particles. */
578  double alpha_;
579 
580  /** \brief The result of tracking. */
582 
583  /** \brief An affine transformation from the world coordinates frame to the
584  * origin of the particles. */
585  Eigen::Affine3f trans_;
586 
587  /** \brief A flag to use normal or not. defaults to false. */
589 
590  /** \brief Difference between the result in t and t-1. */
591  StateT motion_;
592 
593  /** \brief Ratio of hypothesis to use motion model. */
595 
596  /** \brief Pass through filter to crop the pointclouds within the hypothesis
597  * bounding box. */
599  /** \brief Pass through filter to crop the pointclouds within the hypothesis
600  * bounding box. */
602  /** \brief Pass through filter to crop the pointclouds within the hypothesis
603  * bounding box. */
605 
606  /** \brief A list of the pointers to pointclouds. */
607  std::vector<PointCloudInPtr> transed_reference_vector_;
608 
609  /** \brief Change detector used as a trigger to track. */
611 
612  /** \brief A flag to be true when change of pointclouds is detected. */
613  bool changed_;
614 
615  /** \brief A counter to skip change detection. */
616  unsigned int change_counter_;
617 
618  /** \brief Minimum points in a leaf when calling change detector. defaults
619  * to 10. */
621 
622  /** \brief The number of interval frame to run change detection. defaults
623  * to 10. */
625 
626  /** \brief Resolution of change detector. defaults to 0.01. */
628 
629  /** \brief The flag which will be true if using change detection. */
631 };
632 } // namespace tracking
633 } // namespace pcl
634 
635 // #include <pcl/tracking/impl/particle_filter.hpp>
636 #ifdef PCL_NO_PRECOMPILE
637 #include <pcl/tracking/impl/particle_filter.hpp>
638 #endif
pcl::tracking::ParticleFilterTracker::setOcclusionAngleThe
void setOcclusionAngleThe(const double occlusion_angle_thr)
Set the threshold of angle to be considered occlusion (default: pi/2).
Definition: particle_filter.h:196
pcl::tracking::ParticleFilterTracker::update
virtual void update()
Calculate the weighted mean of the particles and set it as the result.
Definition: particle_filter.hpp:375
pcl
Definition: convolution.h:46
pcl::tracking::ParticleFilterTracker::pass_z_
pcl::PassThrough< PointInT > pass_z_
Pass through filter to crop the pointclouds within the hypothesis bounding box.
Definition: particle_filter.h:604
pcl::tracking::ParticleFilterTracker::setResolutionOfChangeDetection
void setResolutionOfChangeDetection(double resolution)
Set the resolution of change detection.
Definition: particle_filter.h:368
pcl::tracking::ParticleFilterTracker::getUseNormal
bool getUseNormal()
Get the value of use_normal_.
Definition: particle_filter.h:300
pcl::tracking::ParticleFilterTracker
ParticleFilterTracker tracks the PointCloud which is given by setReferenceCloud within the measured P...
Definition: particle_filter.h:18
pcl::tracking::ParticleFilterTracker::getIterationNum
int getIterationNum() const
Get the number of iteration.
Definition: particle_filter.h:97
pcl::tracking::ParticleFilterTracker::setInitialNoiseCovariance
void setInitialNoiseCovariance(const std::vector< double > &initial_noise_covariance)
Set the covariance of the initial noise.
Definition: particle_filter.h:166
pcl::tracking::ParticleFilterTracker::resample_likelihood_thr_
double resample_likelihood_thr_
The threshold for the particles to be re-initialized.
Definition: particle_filter.h:571
pcl::PassThrough::setFilterFieldName
void setFilterFieldName(const std::string &field_name)
Provide the name of the field to be used for filtering data.
Definition: passthrough.h:112
pcl::tracking::ParticleFilterTracker::setMinPointsOfChangeDetection
void setMinPointsOfChangeDetection(unsigned int change_detector_filter)
Set the minimum amount of points required within leaf node to become serialized in change detection.
Definition: particle_filter.h:359
pcl::tracking::ParticleFilterTracker::ref_
PointCloudInConstPtr ref_
A pointer to reference point cloud.
Definition: particle_filter.h:549
pcl::tracking::ParticleFilterTracker::use_normal_
bool use_normal_
A flag to use normal or not.
Definition: particle_filter.h:588
pcl::tracking::PointCloudCoherence::ConstPtr
shared_ptr< const PointCloudCoherence< PointInT > > ConstPtr
Definition: coherence.h:62
pcl::tracking::ParticleFilterTracker::particles_
PointCloudStatePtr particles_
A pointer to the particles
Definition: particle_filter.h:552
pcl::tracking::ParticleFilterTracker::motion_ratio_
double motion_ratio_
Ratio of hypothesis to use motion model.
Definition: particle_filter.h:594
pcl::tracking::ParticleFilterTracker::computeTracking
void computeTracking() override
Track the pointcloud using particle filter method.
Definition: particle_filter.hpp:390
pcl::tracking::ParticleFilterTracker::setInitialNoiseMean
void setInitialNoiseMean(const std::vector< double > &initial_noise_mean)
Set the mean of the initial noise.
Definition: particle_filter.h:176
pcl::tracking::ParticleFilterTracker::setIterationNum
void setIterationNum(const int iteration_num)
Set the number of iteration.
Definition: particle_filter.h:90
pcl::tracking::ParticleFilterTracker::initial_noise_mean_
std::vector< double > initial_noise_mean_
The mean values of initial noise.
Definition: particle_filter.h:568
pcl::tracking::ParticleFilterTracker::pass_x_
pcl::PassThrough< PointInT > pass_x_
Pass through filter to crop the pointclouds within the hypothesis bounding box.
Definition: particle_filter.h:598
pcl::tracking::ParticleFilterTracker::CloudCoherenceConstPtr
typename CloudCoherence::ConstPtr CloudCoherenceConstPtr
Definition: particle_filter.h:48
pcl::tracking::ParticleFilterTracker::ParticleFilterTracker
ParticleFilterTracker()
Empty constructor.
Definition: particle_filter.h:51
pcl::tracking::ParticleFilterTracker::getMotionRatio
double getMotionRatio()
Get the motion ratio.
Definition: particle_filter.h:332
pcl::tracking::ParticleFilterTracker::setTrans
void setTrans(const Eigen::Affine3f &trans)
Set the transformation from the world coordinates to the frame of the particles.
Definition: particle_filter.h:218
pcl::tracking::ParticleFilterTracker::Ptr
shared_ptr< ParticleFilterTracker< PointInT, StateT > > Ptr
Definition: particle_filter.h:29
pcl::tracking::PointCoherence::Ptr
shared_ptr< PointCoherence< PointInT > > Ptr
Definition: coherence.h:17
pcl::tracking::ParticleFilterTracker::getIntervalOfChangeDetection
unsigned int getIntervalOfChangeDetection()
Get the number of interval frames to run change detection.
Definition: particle_filter.h:348
pcl::tracking::ParticleFilterTracker::computeTransformedPointCloud
void computeTransformedPointCloud(const StateT &hypothesis, std::vector< int > &indices, PointCloudIn &cloud)
Compute a reference pointcloud transformed to the pose that hypothesis represents.
Definition: particle_filter.hpp:275
pcl::PointCloud< PointInT >
pcl::tracking::ParticleFilterTracker::computeTransformedPointCloudWithNormal
void computeTransformedPointCloudWithNormal(const StateT &hypothesis, std::vector< int > &indices, PointCloudIn &cloud)
Compute a reference pointcloud transformed to the pose that hypothesis represents and calculate indic...
Definition: particle_filter.hpp:297
pcl::tracking::ParticleFilterTracker::change_counter_
unsigned int change_counter_
A counter to skip change detection.
Definition: particle_filter.h:616
pcl::octree::OctreePointCloudChangeDetector::Ptr
shared_ptr< OctreePointCloudChangeDetector< PointT, LeafContainerT, BranchContainerT > > Ptr
Definition: octree_pointcloud_changedetector.h:73
pcl::tracking::ParticleFilterTracker::resampleWithReplacement
void resampleWithReplacement()
Resampling the particle with replacement.
Definition: particle_filter.hpp:337
pcl::tracking::ParticleFilterTracker::getResult
StateT getResult() const override
Get an instance of the result of tracking.
Definition: particle_filter.h:237
pcl::tracking::ParticleFilterTracker::genAliasTable
void genAliasTable(std::vector< int > &a, std::vector< double > &q, const PointCloudStateConstPtr &particles)
Generate the tables for walker's alias method.
Definition: particle_filter.hpp:58
pcl::tracking::ParticleFilterTracker::getTrans
Eigen::Affine3f getTrans() const
Get the transformation from the world coordinates to the frame of the particles.
Definition: particle_filter.h:226
pcl::FilterIndices::setKeepOrganized
void setKeepOrganized(bool keep_organized)
Set whether the filtered points should be kept and set to the value given through setUserFilterValue ...
Definition: filter_indices.h:135
pcl::tracking::ParticleFilterTracker::toEigenMatrix
Eigen::Affine3f toEigenMatrix(const StateT &particle)
Convert a state to affine transformation from the world coordinates frame.
Definition: particle_filter.h:247
pcl::tracking::Tracker::tracker_name_
std::string tracker_name_
The tracker name.
Definition: tracker.h:90
pcl::tracking::ParticleFilterTracker::PointCloudIn
typename Tracker< PointInT, StateT >::PointCloudIn PointCloudIn
Definition: particle_filter.h:34
pcl::tracking::ParticleFilterTracker::getMinPointsOfChangeDetection
unsigned int getMinPointsOfChangeDetection()
Get the minimum amount of points required within leaf node to become serialized in change detection.
Definition: particle_filter.h:383
pcl::tracking::ParticleFilterTracker::ConstPtr
shared_ptr< const ParticleFilterTracker< PointInT, StateT > > ConstPtr
Definition: particle_filter.h:30
pcl::tracking::ParticleFilterTracker::setMinIndices
void setMinIndices(const int min_indices)
Set the minimum number of indices (default: 1).
Definition: particle_filter.h:207
pcl::tracking::ParticleFilterTracker::use_change_detector_
bool use_change_detector_
The flag which will be true if using change detection.
Definition: particle_filter.h:630
pcl::tracking::ParticleFilterTracker::getFitRatio
double getFitRatio() const
Get the adjustment ratio.
Definition: particle_filter.h:390
pcl::tracking::ParticleFilterTracker::getCloudCoherence
CloudCoherencePtr getCloudCoherence() const
Get the PointCloudCoherence to compute likelihood.
Definition: particle_filter.h:145
pcl::tracking::ParticleFilterTracker::coherence_
CloudCoherencePtr coherence_
A pointer to PointCloudCoherence.
Definition: particle_filter.h:555
pcl::tracking::ParticleFilterTracker::sampleWithReplacement
int sampleWithReplacement(const std::vector< int > &a, const std::vector< double > &q)
Implementation of "sample with replacement" using Walker's alias method.
Definition: particle_filter.hpp:42
pcl::tracking::ParticleFilterTracker::getReferenceCloud
const PointCloudInConstPtr getReferenceCloud()
Get a pointer to a reference dataset to be tracked.
Definition: particle_filter.h:129
pcl::tracking::ParticleFilterTracker::change_detector_resolution_
double change_detector_resolution_
Resolution of change detector.
Definition: particle_filter.h:627
pcl::tracking::ParticleFilterTracker::getResolutionOfChangeDetection
double getResolutionOfChangeDetection()
Get the resolution of change detection.
Definition: particle_filter.h:375
pcl::tracking::ParticleFilterTracker::setUseChangeDetector
void setUseChangeDetector(bool use_change_detector)
Set the value of use_change_detector_.
Definition: particle_filter.h:309
pcl::tracking::ParticleFilterTracker::occlusion_angle_thr_
double occlusion_angle_thr_
The threshold for the points to be considered as occluded.
Definition: particle_filter.h:574
pcl::tracking::ParticleFilterTracker::resetTracking
virtual void resetTracking()
Reset the particles to restart tracking.
Definition: particle_filter.h:397
pcl::tracking::ParticleFilterTracker::setParticleNum
void setParticleNum(const int particle_num)
Set the number of the particles.
Definition: particle_filter.h:106
pcl::tracking::ParticleFilterTracker::changed_
bool changed_
A flag to be true when change of pointclouds is detected.
Definition: particle_filter.h:613
pcl::tracking::ParticleFilterTracker::setStepNoiseCovariance
void setStepNoiseCovariance(const std::vector< double > &step_noise_covariance)
Set the covariance of step noise.
Definition: particle_filter.h:155
pcl::tracking::ParticleFilterTracker::getAlpha
double getAlpha()
Get the value of alpha.
Definition: particle_filter.h:284
pcl::tracking::ParticleFilterTracker::resample
virtual void resample()
Resampling phase of particle filter method.
Definition: particle_filter.hpp:330
M_PI
#define M_PI
Definition: pcl_macros.h:201
pcl::tracking::PointCoherence::ConstPtr
shared_ptr< const PointCoherence< PointInT > > ConstPtr
Definition: coherence.h:18
pcl::tracking::ParticleFilterTracker::transed_reference_vector_
std::vector< PointCloudInPtr > transed_reference_vector_
A list of the pointers to pointclouds.
Definition: particle_filter.h:607
pcl::tracking::ParticleFilterTracker::getUseChangeDetector
bool getUseChangeDetector()
Get the value of use_change_detector_.
Definition: particle_filter.h:316
pcl::tracking::ParticleFilterTracker::CloudCoherencePtr
typename CloudCoherence::Ptr CloudCoherencePtr
Definition: particle_filter.h:47
pcl::tracking::ParticleFilterTracker::min_indices_
int min_indices_
The minimum number of points which the hypothesis should have.
Definition: particle_filter.h:543
pcl::tracking::ParticleFilterTracker::particle_num_
int particle_num_
The number of the particles.
Definition: particle_filter.h:540
pcl::tracking::ParticleFilterTracker::change_detector_filter_
unsigned int change_detector_filter_
Minimum points in a leaf when calling change detector.
Definition: particle_filter.h:620
pcl::tracking::ParticleFilterTracker::testChangeDetection
bool testChangeDetection(const PointCloudInConstPtr &input)
Run change detection and return true if there is a change.
Definition: particle_filter.hpp:218
pcl::tracking::ParticleFilterTracker::cropInputPointCloud
void cropInputPointCloud(const PointCloudInConstPtr &cloud, PointCloudIn &output)
Crop the pointcloud by the bounding box calculated from hypothesis and the reference pointcloud.
Definition: particle_filter.hpp:162
pcl::tracking::ParticleFilterTracker::setCloudCoherence
void setCloudCoherence(const CloudCoherencePtr &coherence)
Set the PointCloudCoherence as likelihood.
Definition: particle_filter.h:138
pcl::tracking::ParticleFilterTracker::change_detector_
pcl::octree::OctreePointCloudChangeDetector< PointInT >::Ptr change_detector_
Change detector used as a trigger to track.
Definition: particle_filter.h:610
pcl::tracking::ParticleFilterTracker::resampleDeterministic
void resampleDeterministic()
Resampling the particle in deterministic way.
pcl::tracking::ParticleFilterTracker::fit_ratio_
double fit_ratio_
Adjustment of the particle filter.
Definition: particle_filter.h:546
pcl::PassThrough< PointInT >
pcl::tracking::ParticleFilterTracker::setAlpha
void setAlpha(double alpha)
Set the value of alpha.
Definition: particle_filter.h:277
pcl::tracking::ParticleFilterTracker::weight
virtual void weight()
Weighting phase of particle filter method.
Definition: particle_filter.hpp:232
pcl::tracking::ParticleFilterTracker::initParticles
void initParticles(bool reset)
Initialize the particles.
Definition: particle_filter.hpp:94
pcl::tracking::ParticleFilterTracker::PointCloudInConstPtr
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: particle_filter.h:36
pcl::tracking::ParticleFilterTracker::alpha_
double alpha_
The weight to be used in normalization of the weights of the particles.
Definition: particle_filter.h:578
pcl::tracking::ParticleFilterTracker::PointCloudState
typename Tracker< PointInT, StateT >::PointCloudState PointCloudState
Definition: particle_filter.h:38
pcl::tracking::ParticleFilterTracker::PointCloudInPtr
typename PointCloudIn::Ptr PointCloudInPtr
Definition: particle_filter.h:35
pcl::tracking::ParticleFilterTracker::CoherencePtr
typename Coherence::Ptr CoherencePtr
Definition: particle_filter.h:43
pcl::tracking::ParticleFilterTracker::motion_
StateT motion_
Difference between the result in t and t-1.
Definition: particle_filter.h:591
pcl::tracking::ParticleFilterTracker::change_detector_interval_
unsigned int change_detector_interval_
The number of interval frame to run change detection.
Definition: particle_filter.h:624
pcl::tracking::ParticleFilterTracker::normalizeWeight
virtual void normalizeWeight()
Normalize the weights of all the particels.
Definition: particle_filter.hpp:117
pcl::tracking::PointCloudCoherence
PointCloudCoherence is a base class to compute coherence between the two PointClouds.
Definition: coherence.h:59
pcl::tracking::PointCoherence
PointCoherence is a base class to compute coherence between the two points.
Definition: coherence.h:15
pcl::tracking::ParticleFilterTracker::initial_noise_covariance_
std::vector< double > initial_noise_covariance_
The diagonal elements of covariance matrix of the initial noise.
Definition: particle_filter.h:565
pcl::tracking::ParticleFilterTracker::getParticleNum
int getParticleNum() const
Get the number of the particles.
Definition: particle_filter.h:113
pcl::tracking::ParticleFilterTracker::setResampleLikelihoodThr
void setResampleLikelihoodThr(const double resample_likelihood_thr)
Set the threshold to re-initialize the particles.
Definition: particle_filter.h:185
pcl::tracking::ParticleFilterTracker::CoherenceConstPtr
typename Coherence::ConstPtr CoherenceConstPtr
Definition: particle_filter.h:44
pcl::tracking::ParticleFilterTracker::setMotionRatio
void setMotionRatio(double motion_ratio)
Set the motion ratio.
Definition: particle_filter.h:325
pcl::tracking::ParticleFilterTracker::computeTransformedPointCloudWithoutNormal
void computeTransformedPointCloudWithoutNormal(const StateT &hypothesis, PointCloudIn &cloud)
Compute a reference pointcloud transformed to the pose that hypothesis represents and calculate indic...
Definition: particle_filter.hpp:286
pcl::tracking::ParticleFilterTracker::iteration_num_
int iteration_num_
The number of iteration of particlefilter.
Definition: particle_filter.h:537
pcl::tracking::PointCloudCoherence::Ptr
shared_ptr< PointCloudCoherence< PointInT > > Ptr
Definition: coherence.h:61
pcl::tracking::ParticleFilterTracker::normalizeParticleWeight
double normalizeParticleWeight(double w, double w_min, double w_max)
Normalize the weight of a particle using .
Definition: particle_filter.h:268
pcl::tracking::ParticleFilterTracker::getParticles
PointCloudStatePtr getParticles() const
Get a pointer to a pointcloud of the particles.
Definition: particle_filter.h:254
pcl::tracking::ParticleFilterTracker::trans_
Eigen::Affine3f trans_
An affine transformation from the world coordinates frame to the origin of the particles.
Definition: particle_filter.h:585
pcl::tracking::ParticleFilterTracker::calcBoundingBox
void calcBoundingBox(double &x_min, double &x_max, double &y_min, double &y_max, double &z_min, double &z_max)
Compute the parameters for the bounding box of hypothesis pointclouds.
Definition: particle_filter.hpp:187
pcl::tracking::ParticleFilterTracker::PointCloudStatePtr
typename PointCloudState::Ptr PointCloudStatePtr
Definition: particle_filter.h:39
pcl::tracking::ParticleFilterTracker::PointCloudStateConstPtr
typename PointCloudState::ConstPtr PointCloudStateConstPtr
Definition: particle_filter.h:40
pcl::tracking::ParticleFilterTracker::representative_state_
StateT representative_state_
The result of tracking.
Definition: particle_filter.h:581
pcl::tracking::ParticleFilterTracker::setIntervalOfChangeDetection
void setIntervalOfChangeDetection(unsigned int change_detector_interval)
Set the number of interval frames to run change detection.
Definition: particle_filter.h:341
pcl::tracking::ParticleFilterTracker::step_noise_covariance_
std::vector< double > step_noise_covariance_
The diagonal elements of covariance matrix of the step noise.
Definition: particle_filter.h:560
pcl::tracking::Tracker
Tracker represents the base tracker class.
Definition: tracker.h:55
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::tracking::ParticleFilterTracker::setUseNormal
void setUseNormal(bool use_normal)
Set the value of use_normal_.
Definition: particle_filter.h:293
pcl::tracking::ParticleFilterTracker::initCompute
bool initCompute() override
This method should get called before starting the actua computation.
Definition: particle_filter.hpp:14
pcl::tracking::ParticleFilterTracker::setReferenceCloud
void setReferenceCloud(const PointCloudInConstPtr &ref)
Set a pointer to a reference dataset to be tracked.
Definition: particle_filter.h:122
pcl::tracking::ParticleFilterTracker::pass_y_
pcl::PassThrough< PointInT > pass_y_
Pass through filter to crop the pointclouds within the hypothesis bounding box.
Definition: particle_filter.h:601