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)
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);
This file contains the implementations of the template members declared in mrpt::slam::PF_implementat...
CParticleList m_particles
The array of particles.
This class acts as a common interface to the different interfaces (see CParticleFilter::TParticleFilt...
TParticleFilterAlgorithm
Defines different types of particle filter algorithms.
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.
Declares a virtual base class for all metric maps storage classes.
double computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom)
Computes the log-likelihood of a given observation given an arbitrary robot 3D pose.
Declares a class for storing a collection of robot actions.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
const_iterator end() const
Returns a constant iterator to the end of the list of observations: this is an example of usage:
const_iterator begin() const
Returns a constant iterator to the first observation: this is an example of usage:
std::deque< CObservation::Ptr >::const_iterator const_iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double pitch() const
Get the PITCH angle (in radians)
double roll() const
Get the ROLL angle (in radians)
double yaw() const
Get the YAW angle (in radians)
double x() const
Common members of all points & poses classes.
CMonteCarloLocalization3D(size_t M=1)
Constructor.
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.
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.
mrpt::poses::CPose3DPDFParticles::CParticleList CParticleList
void PF_SLAM_implementation_custom_update_particle_with_new_pose(CParticleDataContent *particleData, const mrpt::math::TPose3D &newPose) const
mrpt::poses::CPose3DPDFParticles m_poseParticles
virtual ~CMonteCarloLocalization3D()
Destructor.
TMonteCarloLocalizationParams options
MCL parameters.
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
mrpt::math::TPose3D getLastPose(const size_t i, bool &is_valid_pose) const override
Return the robot pose for the i'th particle.
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)
A generic implementation of the PF method "pfStandardProposal" (standard proposal distribution,...
Option set for KLD algorithm.
double KLD_binSize_XY
Parameters for the KLD adaptive sample size algorithm (see Dieter Fox's papers), which is used only i...
int round(const T value)
Returns the closer integer (int) to x.
for(ctr=DCTSIZE;ctr > 0;ctr--)
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
#define THROW_EXCEPTION(msg)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
This base provides a set of functions for maths stuff.
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
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...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The configuration of a particle filter.
Statistics for being returned from the "execute" method.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
double roll
Roll coordinate (rotation angle over X coordinate).
double pitch
Pitch coordinate (rotation angle over Y axis).
double yaw
Yaw coordinate (rotation angle over Z axis).
TKLDParams KLD_params
Parameters for dynamic sample size, KLD method.
mrpt::maps::TMetricMapList metricMaps
[update stage] Alternative way (if metricMap==nullptr): A metric map is supplied for each particle: T...
mrpt::maps::CMetricMap * metricMap
[update stage] Must be set to a metric map used to estimate the likelihood of observations
Auxiliary structure used in KLD-sampling in particle filters.