particle_filter.h
#pragma once
#include <pcl/pcl_macros.h>
#include <pcl/gpu/containers/device_array.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/PointIndices.h>
#include <pcl/pcl_macros.h>
#include <pcl/gpu/kinfu/pixel_rgb.h>
#include <pcl/tracking/particle_filter.h>
#include <Eigen/Dense>
#include "internal.h"
namespace pcl
{
namespace gpu
{
class ParticleFilterGPUTracker
{
public:
/** \brief Point type supported */
using PointType = pcl::PointXYZ;
//using NormalType = pcl::Normal;
using PixelRGB = pcl::RGB;
using StateXYZ = pcl::PointXYZ;
using StateRPY = pcl::PointXYZ;
using StateType = pcl::tracking::ParticleXYZRPY;
/** \brief Empty constructor. */
ParticleFilterGPUTracker ()
//: ParticleFilterTracker<PointInT, StateT> ()
{
tracker_name_ = "ParticleFilterGPUTracker";
}
/** \brief set the number of the particles.
* \param particle_num the number of the particles.
*/
inline void
setParticleNum (const int particle_num) { particle_num_ = particle_num; }
/** \brief get the number of the particles. */
inline int
getParticleNum () const { return particle_num_; }
/** \brief set a pointer to a reference dataset to be tracked.
* \param ref a pointer to a PointCloud message
*/
inline void
setReferenceCloud (const DeviceArray2D<PointType> &ref) { ref_ = ref; }
/** \brief get a pointer to a reference dataset to be tracked. */
inline DeviceArray2D<PointType> const
getReferenceCloud () { return ref_; }
int
cols ();
int
rows ();
virtual bool
operator() (const DeviceArray2D<PointType>& input, const DeviceArray2D<PixelRGB>& input_colors)
{
}
virtual void
setMotion (StateType motion)
{ motion_ = motion; }
virtual StateType
getResult();
protected:
std::string tracker_name_;
virtual bool
initCompute()
{
//pcl::device::initParticles(particle_num_, particle_xyz_, particle_rpy_, particle_weight_ );
}
virtual void
computeTracking()
{
}
virtual void
allocateBuffers()
{
particles_.create( particle_num_ );
random_number_generator_.create( particle_num_ );
}
// reference point cloud
DeviceArray2D<PointType> ref_;
DeviceArray2D<PixelRGB> ref_colors_;
//DeviceArray2D<NormalType> ref_normals_;
// input point cloud
DeviceArray2D<PointType> input_;
DeviceArray2D<PixelRGB> input_colors_;
//DeviceArray2D<NormalType> input_normals_;
//StateCloud particles_;
DeviceArray<StateType> particles_;
// random number generate state
DeviceArray<curandState> rng_states;
int particle_num_;
std::vector<float> step_noise_covariance_;
std::vector<float> initial_noise_covariance_;
std::vector<float> initial_noise_mean_;
StateType motion_;
float motion_ratio_;
bool use_colors_;
StateType representative_state_;
/** \brief Height of input depth image. */
int rows_;
/** \brief Width of input depth image. */
int cols_;
};
}
}
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
point_types.h
pcl::gpu::ParticleFilterGPUTracker::motion_
StateType motion_
Definition: particle_filter.h:134
pcl::gpu::ParticleFilterGPUTracker::operator()
virtual bool operator()(const DeviceArray2D< PointType > &input, const DeviceArray2D< PixelRGB > &input_colors)
Definition: particle_filter.h:69
pcl::gpu::ParticleFilterGPUTracker::motion_ratio_
float motion_ratio_
Definition: particle_filter.h:136
pcl::gpu::ParticleFilterGPUTracker::ParticleFilterGPUTracker
ParticleFilterGPUTracker()
Empty constructor.
Definition: particle_filter.h:36
pcl::gpu::ParticleFilterGPUTracker::input_
DeviceArray2D< PointType > input_
Definition: particle_filter.h:114
pcl::gpu::ParticleFilterGPUTracker::allocateBuffers
virtual void allocateBuffers()
Definition: particle_filter.h:98
pcl::gpu::ParticleFilterGPUTracker::cols_
int cols_
Width of input depth image.
Definition: particle_filter.h:145
pcl::gpu::ParticleFilterGPUTracker::getResult
virtual StateType getResult()
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition: device_array.h:153
pcl::tracking::ParticleXYZRPY
Definition: tracking.hpp:30
pcl::gpu::ParticleFilterGPUTracker::ref_colors_
DeviceArray2D< PixelRGB > ref_colors_
Definition: particle_filter.h:109
pcl::gpu::ParticleFilterGPUTracker::rng_states
DeviceArray< curandState > rng_states
Definition: particle_filter.h:124
pcl::gpu::ParticleFilterGPUTracker::setMotion
virtual void setMotion(StateType motion)
Definition: particle_filter.h:75
pcl::gpu::ParticleFilterGPUTracker::representative_state_
StateType representative_state_
Definition: particle_filter.h:140
pcl::gpu::ParticleFilterGPUTracker::initial_noise_covariance_
std::vector< float > initial_noise_covariance_
Definition: particle_filter.h:130
pcl::gpu::ParticleFilterGPUTracker::use_colors_
bool use_colors_
Definition: particle_filter.h:138
pcl::gpu::ParticleFilterGPUTracker::initial_noise_mean_
std::vector< float > initial_noise_mean_
Definition: particle_filter.h:132
pcl::gpu::ParticleFilterGPUTracker::input_colors_
DeviceArray2D< PixelRGB > input_colors_
Definition: particle_filter.h:116
pcl::PointXYZ
A point structure representing Euclidean xyz coordinates.
Definition: point_types.hpp:291
pcl::gpu::ParticleFilterGPUTracker::cols
int cols()
pcl::gpu::DeviceArray
DeviceArray class
Definition: device_array.h:56
pcl::RGB
A structure representing RGB color information.
Definition: point_types.hpp:343
pcl::gpu::ParticleFilterGPUTracker::getReferenceCloud
const DeviceArray2D< PointType > getReferenceCloud()
get a pointer to a reference dataset to be tracked.
Definition: particle_filter.h:60
pcl::gpu::ParticleFilterGPUTracker::setParticleNum
void setParticleNum(const int particle_num)
set the number of the particles.
Definition: particle_filter.h:46
pcl::gpu::ParticleFilterGPUTracker::step_noise_covariance_
std::vector< float > step_noise_covariance_
Definition: particle_filter.h:128
pcl::gpu::ParticleFilterGPUTracker::particle_num_
int particle_num_
Definition: particle_filter.h:126
pcl::gpu::ParticleFilterGPUTracker::StateType
pcl::tracking::ParticleXYZRPY StateType
Definition: particle_filter.h:33
pcl::gpu::ParticleFilterGPUTracker::rows_
int rows_
Height of input depth image.
Definition: particle_filter.h:143
pcl::gpu::ParticleFilterGPUTracker::rows
int rows()
pcl::gpu::ParticleFilterGPUTracker
Definition: particle_filter.h:22
pcl::gpu::ParticleFilterGPUTracker::ref_
DeviceArray2D< PointType > ref_
Definition: particle_filter.h:107
pcl::gpu::ParticleFilterGPUTracker::setReferenceCloud
void setReferenceCloud(const DeviceArray2D< PointType > &ref)
set a pointer to a reference dataset to be tracked.
Definition: particle_filter.h:56
pcl::gpu::ParticleFilterGPUTracker::computeTracking
virtual void computeTracking()
Definition: particle_filter.h:92
pcl::gpu::ParticleFilterGPUTracker::getParticleNum
int getParticleNum() const
get the number of the particles.
Definition: particle_filter.h:50
pcl::gpu::ParticleFilterGPUTracker::initCompute
virtual bool initCompute()
Definition: particle_filter.h:85
pcl::gpu::ParticleFilterGPUTracker::tracker_name_
std::string tracker_name_
Definition: particle_filter.h:82
pcl::gpu::ParticleFilterGPUTracker::particles_
DeviceArray< StateType > particles_
Definition: particle_filter.h:121