44 const TPose3D* newPoseToBeInserted)
47 if (newPoseToBeInserted)
77 CMonteCarloLocalization3D::CMonteCarloLocalization3D(
size_t M)
80 this->setLoggerName(
"CMonteCarloLocalization3D");
88 const size_t i,
bool& is_valid_pose)
const 102 template <
typename T>
118 T::template PF_SLAM_implementation<
132 const size_t particleIndexForMap,
const CSensoryFrame& observation,
146 it != observation.
end(); ++it)
147 ret += map->computeObservationLikelihood(
159 *particleData =
CPose3D(newPose);
163 CParticleList& old_particles,
const vector<TPose3D>& newParticles,
164 const vector<double>& newParticlesWeight,
165 const vector<size_t>& newParticlesDerivedFromIdx)
const 168 ASSERT_(
size_t(newParticlesWeight.size()) == newParticles.size())
179 const size_t N = newParticles.size();
180 old_particles.resize(N);
181 for (
size_t i = 0; i < N; i++)
183 old_particles[i].log_w = newParticlesWeight[i];
184 old_particles[i].d.reset(
new CPose3D(newParticles[i]));
194 switch (PF_algorithm)
196 case CParticleFilter::pfStandardProposal:
198 *
this, action, observation, stats);
200 case CParticleFilter::pfAuxiliaryPFStandard:
202 *
this, action, observation, stats);
204 case CParticleFilter::pfAuxiliaryPFOptimal:
206 *
this, action, observation, stats);
double x() const
Common members of all points & poses classes.
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
Evaluate the observation likelihood for one particle at a given location.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
double roll
Roll coordinate (rotation angle over X coordinate).
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
#define THROW_EXCEPTION(msg)
This file contains the implementations of the template members declared in mrpt::slam::PF_implementat...
void PF_SLAM_implementation_custom_update_particle_with_new_pose(CParticleDataContent *particleData, const mrpt::math::TPose3D &newPose) const
mrpt::poses::CPose3DPDFParticles::CParticleList CParticleList
double pitch() const
Get the PITCH angle (in radians)
double yaw() const
Get the YAW angle (in radians)
Option set for KLD algorithm.
mrpt::maps::TMetricMapList metricMaps
[update stage] Alternative way (if metricMap==nullptr): A metric map is supplied for each particle: T...
double yaw
Yaw coordinate (rotation angle over Z axis).
A generic implementation of the PF method "pfStandardProposal" (standard proposal distribution...
Statistics for being returned from the "execute" method.
mrpt::maps::CMetricMap * metricMap
[update stage] Must be set to a metric map used to estimate the likelihood of observations ...
Declares a class for storing a collection of robot actions.
void prediction_and_update(const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
Update the m_particles, predicting the posterior of robot pose and map after a movement command...
const_iterator begin() const
Returns a constant iterator to the first observation: this is an example of usage: ...
TMonteCarloLocalizationParams options
MCL parameters.
CParticleList m_particles
The array of particles.
This base provides a set of functions for maths stuff.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This namespace contains representation of robot actions and observations.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
CMonteCarloLocalization3D(size_t M=1)
Constructor.
double KLD_binSize_XY
Parameters for the KLD adaptive sample size algorithm (see Dieter Fox's papers), which is used only i...
This class acts as a common interface to the different interfaces (see CParticleFilter::TParticleFilt...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double roll() const
Get the ROLL angle (in radians)
double pitch
Pitch coordinate (rotation angle over Y axis).
virtual ~CMonteCarloLocalization3D()
Destructor.
Auxiliary structure used in KLD-sampling in particle filters.
void executeOn(PARTICLEFILTERCAPABLE &obj, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, TParticleFilterStats *stats=nullptr)
Executes a complete prediction + update step of the selected particle filtering algorithm.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
TParticleFilterAlgorithm
Defines different types of particle filter algorithms.
Declares a virtual base class for all metric maps storage classes.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::poses::CPose3DPDFParticles m_poseParticles
void executeOn(mrpt::bayes::CParticleFilter &pf, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, mrpt::bayes::CParticleFilter::TParticleFilterStats *stats, mrpt::bayes::CParticleFilter::TParticleFilterAlgorithm PF_algorithm)
The configuration of a particle filter.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
std::deque< CObservation::Ptr >::const_iterator const_iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
void PF_SLAM_implementation_replaceByNewParticleSet(CParticleList &old_particles, const std::vector< mrpt::math::TPose3D > &newParticles, const std::vector< double > &newParticlesWeight, const std::vector< size_t > &newParticlesDerivedFromIdx) const
int round(const T value)
Returns the closer integer (int) to x.
const_iterator end() const
Returns a constant iterator to the end of the list of observations: this is an example of usage: ...
mrpt::math::TPose3D getLastPose(const size_t i, bool &is_valid_pose) const override
Return the robot pose for the i'th particle.
TKLDParams KLD_params
Parameters for dynamic sample size, KLD method.
void KLF_loadBinFromParticle(mrpt::slam::detail::TPoseBin3D &outBin, const TKLDParams &opts, const CMonteCarloLocalization3D::CParticleDataContent *currentParticleValue, const TPose3D *newPoseToBeInserted)
Fills out a "TPoseBin3D" variable, given a path hypotesis and (if not set to nullptr) a new pose appe...