9 #ifndef PF_implementations_data_H
10 #define PF_implementations_data_H
34 template <
class PARTICLETYPE,
class BINTYPE>
37 const TKLDParams &opts,
38 const PARTICLETYPE *currentParticleValue = NULL,
39 const TPose3D *newPoseToBeInserted = NULL );
45 template <
class PARTICLE_TYPE,
class MY
SELF>
50 m_accumRobotMovement2DIsValid(false),
51 m_accumRobotMovement3DIsValid(false)
76 template <
class BINTYPE>
77 static double PF_SLAM_particlesEvaluator_AuxPFStandard(
82 const void * observation );
84 template <
class BINTYPE>
85 static double PF_SLAM_particlesEvaluator_AuxPFOptimal(
90 const void *observation );
110 template <
class BINTYPE>
111 void PF_SLAM_implementation_pfAuxiliaryPFOptimal(
127 template <
class BINTYPE>
128 void PF_SLAM_implementation_pfAuxiliaryPFStandard(
140 template <
class BINTYPE>
141 void PF_SLAM_implementation_pfStandardProposal(
155 virtual const TPose3D * getLastPose(
const size_t i)
const = 0;
157 virtual void PF_SLAM_implementation_custom_update_particle_with_new_pose(
158 PARTICLE_TYPE *particleData,
159 const TPose3D &newPose)
const = 0;
169 const vector<TPose3D> &newParticles,
170 const vector<double> &newParticlesWeight,
171 const vector<size_t> &newParticlesDerivedFromIdx )
const
178 const size_t N = newParticles.size();
179 typename MYSELF::CParticleList newParticlesArray(N);
183 std::vector<bool> oldParticleAlreadyCopied(old_particles.size(),
false);
187 for (newPartIt=newParticlesArray.begin(),i=0;newPartIt!=newParticlesArray.end();newPartIt++,i++)
190 newPartIt->log_w = newParticlesWeight[i];
193 PARTICLE_TYPE *newPartData;
194 if (!oldParticleAlreadyCopied[newParticlesDerivedFromIdx[i]])
197 newPartData = old_particles[ newParticlesDerivedFromIdx[i] ].d;
198 oldParticleAlreadyCopied[newParticlesDerivedFromIdx[i]] =
true;
203 newPartData =
new PARTICLE_TYPE( *old_particles[ newParticlesDerivedFromIdx[i] ].d );
206 newPartIt->d = newPartData;
212 for (newPartIt=newParticlesArray.begin(),i=0;i<N;++newPartIt,++i)
213 PF_SLAM_implementation_custom_update_particle_with_new_pose( newPartIt->d, newParticles[i] );
216 for (
size_t i=0;i<old_particles.size();i++)
217 if (!oldParticleAlreadyCopied[i])
221 old_particles.resize( newParticlesArray.size() );
223 for (newPartIt=newParticlesArray.begin(),trgPartIt=old_particles.begin(); newPartIt!=newParticlesArray.end(); ++newPartIt, ++trgPartIt )
225 trgPartIt->log_w = newPartIt->log_w;
226 trgPartIt->d = newPartIt->d;
247 virtual double PF_SLAM_computeObservationLikelihoodForParticle(
249 const size_t particleIndexForMap,
261 template <
class BINTYPE>
262 bool PF_SLAM_implementation_gatherActionsCheckBothActObs(
268 template <
class BINTYPE>
269 void PF_SLAM_implementation_pfAuxiliaryPFStandardAndOptimal(
274 const bool USE_OPTIMAL_SAMPLING );
276 template <
class BINTYPE>
277 void PF_SLAM_aux_perform_one_rejection_sampling_step(
278 const bool USE_OPTIMAL_SAMPLING,
279 const bool doResample,
280 const double maxMeanLik,
285 double & out_newParticleLogWeight);
bool m_accumRobotMovement3DIsValid
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
std::vector< TPose3D > m_pfAuxiliaryPFOptimal_maxLikDrawnMovement
Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.
Option set for KLD algorithm.
CVectorDouble m_pfAuxiliaryPFStandard_estimatedProb
Auxiliary variable used in the "pfAuxiliaryPFStandard" algorithm.
CVectorDouble m_pfAuxiliaryPFOptimal_estimatedProb
Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.
CPoseRandomSampler m_movementDrawer
Used in al PF implementations.
Declares a class for storing a collection of robot actions.
A set of common data shared by PF implementations for both SLAM and localization. ...
This base provides a set of functions for maths stuff.
CPose3DPDFGaussian m_accumRobotMovement3D
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This virtual class defines the interface that any particles based PDF class must implement in order t...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
CActionRobotMovement2D m_accumRobotMovement2D
virtual bool PF_SLAM_implementation_skipRobotMovement() const
Make a specialization if needed, eg.
CVectorDouble m_pfAuxiliaryPFOptimal_maxLikelihood
Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.
bool m_accumRobotMovement2DIsValid
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void delete_safe(T *&ptr)
Calls "delete" to free an object only if the pointer is not NULL, then set the pointer to NULL...
Represents a probabilistic 2D movement of the robot mobile base.
void KLF_loadBinFromParticle(BINTYPE &outBin, const TKLDParams &opts, const PARTICLETYPE *currentParticleValue=NULL, const TPose3D *newPoseToBeInserted=NULL)
std::deque< CParticleData > CParticleList
Use this type to refer to the list of particles m_particles.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The configuration of a particle filter.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
dynamic_vector< double > CVectorDouble
Column vector, like Eigen::MatrixXd, but automatically initialized to zeros since construction...
virtual bool PF_SLAM_implementation_doWeHaveValidObservations(const typename CParticleFilterData< PARTICLE_TYPE >::CParticleList &particles, const CSensoryFrame *sf) const
An efficient generator of random samples drawn from a given 2D (CPosePDF) or 3D (CPose3DPDF) pose pro...
virtual void PF_SLAM_implementation_replaceByNewParticleSet(typename CParticleFilterData< PARTICLE_TYPE >::CParticleList &old_particles, const vector< TPose3D > &newParticles, const vector< double > &newParticlesWeight, const vector< size_t > &newParticlesDerivedFromIdx) const
This is the default algorithm to efficiently replace one old set of samples by another new set...
std::vector< bool > m_pfAuxiliaryPFOptimal_maxLikMovementDrawHasBeenUsed