Go to the documentation of this file.
9 #ifndef PF_implementations_data_H
10 #define PF_implementations_data_H
27 template <
class PARTICLETYPE,
class BINTYPE>
29 BINTYPE& outBin,
const TKLDParams& opts,
30 const PARTICLETYPE* currentParticleValue =
nullptr,
38 class PARTICLE_TYPE,
class MYSELF,
69 mutable std::vector<mrpt::math::TPose3D>
79 template <
class BINTYPE>
84 const void* action,
const void* observation);
86 template <
class BINTYPE>
91 const void* action,
const void* observation);
117 template <
class BINTYPE>
139 template <
class BINTYPE>
153 template <
class BINTYPE>
170 const size_t i,
bool& is_valid_pose)
const = 0;
173 PARTICLE_TYPE* particleData,
187 PARTICLE_TYPE, STORAGE>::CParticleList& old_particles,
188 const std::vector<mrpt::math::TPose3D>& newParticles,
189 const std::vector<double>& newParticlesWeight,
190 const std::vector<size_t>& newParticlesDerivedFromIdx)
const
198 const size_t N = newParticles.size();
199 std::remove_reference_t<decltype(old_particles)> newParticlesArray(N);
204 const auto N_old = old_particles.size();
205 std::vector<bool> oldParticleAlreadyCopied(N_old,
false);
206 std::vector<PARTICLE_TYPE*> oldParticleFirstCopies(N_old,
nullptr);
208 auto newPartIt = newParticlesArray.begin();
209 for (
size_t i = 0; newPartIt != newParticlesArray.end();
213 newPartIt->log_w = newParticlesWeight[i];
216 PARTICLE_TYPE* newPartData;
217 const size_t i_in_old = newParticlesDerivedFromIdx[i];
218 if (!oldParticleAlreadyCopied[i_in_old])
221 newPartData = old_particles[i_in_old].d.release();
222 oldParticleAlreadyCopied[i_in_old] =
true;
223 oldParticleFirstCopies[i_in_old] = newPartData;
228 ASSERT_(oldParticleFirstCopies[i_in_old]);
230 new PARTICLE_TYPE(*oldParticleFirstCopies[i_in_old]);
233 newPartIt->d.reset(newPartData);
240 newPartIt = newParticlesArray.begin();
241 for (
size_t i = 0; i < N;
244 newPartIt->d.get(), newParticles[i]);
250 auto newPartIt = newParticlesArray.begin();
251 for (
size_t i = 0; newPartIt != newParticlesArray.end();
254 newPartIt->log_w = newParticlesWeight[i];
255 const size_t i_in_old = newParticlesDerivedFromIdx[i];
256 newPartIt->d = old_particles[i_in_old].d;
260 newPartIt = newParticlesArray.begin();
261 for (
size_t i = 0; i < N; ++newPartIt, ++i)
263 &newPartIt->d, newParticles[i]);
266 old_particles = std::move(newParticlesArray);
271 PARTICLE_TYPE,STORAGE>::CParticleList& particles,
289 const size_t particleIndexForMap,
304 template <
class BINTYPE>
313 template <
class BINTYPE>
318 const TKLDParams& KLD_options,
const bool USE_OPTIMAL_SAMPLING);
320 template <
class BINTYPE>
322 const bool USE_OPTIMAL_SAMPLING,
const bool doResample,
323 const double maxMeanLik,
mrpt::math::CVectorDouble m_pfAuxiliaryPFStandard_estimatedProb
Auxiliary variable used in the "pfAuxiliaryPFStandard" algorithm.
Declares a class that represents a Probability Density function (PDF) of a 3D pose .
void PF_SLAM_implementation_pfAuxiliaryPFStandard(const mrpt::obs::CActionCollection *actions, const mrpt::obs::CSensoryFrame *sf, const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const TKLDParams &KLD_options)
A generic implementation of the PF method "prediction_and_update_pfAuxiliaryPFStandard" (Auxiliary pa...
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
Option set for KLD algorithm.
virtual double PF_SLAM_computeObservationLikelihoodForParticle(const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const size_t particleIndexForMap, const mrpt::obs::CSensoryFrame &observation, const mrpt::poses::CPose3D &x) const =0
Evaluate the observation likelihood for one particle at a given location.
virtual void PF_SLAM_implementation_replaceByNewParticleSet(typename mrpt::bayes::CParticleFilterData< PARTICLE_TYPE, STORAGE >::CParticleList &old_particles, const std::vector< mrpt::math::TPose3D > &newParticles, const std::vector< double > &newParticlesWeight, const std::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
GLsizei GLsizei GLuint * obj
particle_storage_mode
use for CProbabilityParticle
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
Declares a class for storing a collection of robot actions.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::poses::CPoseRandomSampler m_movementDrawer
Used in al PF implementations.
static double PF_SLAM_particlesEvaluator_AuxPFStandard(const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const mrpt::bayes::CParticleFilterCapable *obj, size_t index, const void *action, const void *observation)
Compute w[i]*p(z_t | mu_t^i), with mu_t^i being the mean of the new robot pose.
Represents a probabilistic 2D movement of the robot mobile base.
#define ASSERT_(f)
Defines an assertion mechanism.
bool m_accumRobotMovement2DIsValid
static double PF_SLAM_particlesEvaluator_AuxPFOptimal(const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const mrpt::bayes::CParticleFilterCapable *obj, size_t index, const void *action, const void *observation)
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
mrpt::obs::CActionRobotMovement2D m_accumRobotMovement2D
This virtual class defines the interface that any particles based PDF class must implement in order t...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
A set of common data shared by PF implementations for both SLAM and localization.
This template class declares the array of particles and its internal data, managing some memory-relat...
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
bool PF_SLAM_implementation_gatherActionsCheckBothActObs(const mrpt::obs::CActionCollection *actions, const mrpt::obs::CSensoryFrame *sf)
Auxiliary method called by PF implementations: return true if we have both action & observation,...
Versatile class for consistent logging and management of output messages.
An efficient generator of random samples drawn from a given 2D (CPosePDF) or 3D (CPose3DPDF) pose pro...
virtual bool PF_SLAM_implementation_doWeHaveValidObservations(const typename mrpt::bayes::CParticleFilterData< PARTICLE_TYPE, STORAGE >::CParticleList &particles, const mrpt::obs::CSensoryFrame *sf) const
void PF_SLAM_implementation_pfAuxiliaryPFOptimal(const mrpt::obs::CActionCollection *actions, const mrpt::obs::CSensoryFrame *sf, const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const TKLDParams &KLD_options)
A generic implementation of the PF method "prediction_and_update_pfAuxiliaryPFOptimal" (optimal sampl...
virtual bool PF_SLAM_implementation_skipRobotMovement() const
Make a specialization if needed, eg.
virtual void PF_SLAM_implementation_custom_update_particle_with_new_pose(PARTICLE_TYPE *particleData, const mrpt::math::TPose3D &newPose) const =0
mrpt::math::CVectorDouble m_pfAuxiliaryPFOptimal_estimatedProb
Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.
void KLF_loadBinFromParticle(BINTYPE &outBin, const TKLDParams &opts, const PARTICLETYPE *currentParticleValue=nullptr, const mrpt::math::TPose3D *newPoseToBeInserted=nullptr)
void PF_SLAM_implementation_pfAuxiliaryPFStandardAndOptimal(const mrpt::obs::CActionCollection *actions, const mrpt::obs::CSensoryFrame *sf, const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const TKLDParams &KLD_options, const bool USE_OPTIMAL_SAMPLING)
The shared implementation body of two PF methods: APF and Optimal-APF, depending on USE_OPTIMAL_SAMPL...
std::vector< mrpt::math::TPose3D > m_pfAuxiliaryPFOptimal_maxLikDrawnMovement
Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.
virtual mrpt::math::TPose3D getLastPose(const size_t i, bool &is_valid_pose) const =0
Return the last robot pose in the i'th particle; is_valid_pose will be false if there is no such last...
bool m_accumRobotMovement3DIsValid
mrpt::math::CVectorDouble m_pfAuxiliaryPFOptimal_maxLikelihood
Auxiliary variable used in the "pfAuxiliaryPFOptimal" algorithm.
void PF_SLAM_aux_perform_one_rejection_sampling_step(const bool USE_OPTIMAL_SAMPLING, const bool doResample, const double maxMeanLik, size_t k, const mrpt::obs::CSensoryFrame *sf, const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, mrpt::poses::CPose3D &out_newPose, double &out_newParticleLogWeight)
The configuration of a particle filter.
void PF_SLAM_implementation_pfStandardProposal(const mrpt::obs::CActionCollection *actions, const mrpt::obs::CSensoryFrame *sf, const mrpt::bayes::CParticleFilter::TParticleFilterOptions &PF_options, const TKLDParams &KLD_options)
A generic implementation of the PF method "pfStandardProposal" (standard proposal distribution,...
COutputLogger()
Default class constructor.
mrpt::poses::CPose3DPDFGaussian m_accumRobotMovement3D
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |