MRPT
2.0.4
|
Definition at line 195 of file vision_stereo_rectify/test.cpp.
Public Types | |
using | CParticleDataContent = CParticleVehicleData |
This is the type inside the corresponding CParticleData class. More... | |
using | CParticleData = CProbabilityParticle< CParticleVehicleData, particle_storage_mode::POINTER > |
Use this to refer to each element in the m_particles array. More... | |
using | CParticleList = std::deque< CParticleData > |
Use this type to refer to the list of particles m_particles. More... | |
using | TParticleProbabilityEvaluator = double(*)(const bayes::CParticleFilter::TParticleFilterOptions &PF_options, const CParticleFilterCapable *obj, size_t index, const void *action, const void *observation) |
A callback function type for evaluating the probability of m_particles of being selected, used in "fastDrawSample". More... | |
Public Member Functions | |
void | prediction_and_update_pfStandardProposal (const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options) override |
Update the m_particles, predicting the posterior of robot pose and map after a movement command. More... | |
void | initializeParticles (size_t numParticles) |
void | getMean (float &x, float &y, float &vx, float &vy) |
Computes the average velocity & position. More... | |
void | clearParticles () |
Free the memory of all the particles and reset the array "m_particles" to length zero. More... | |
void | writeParticlesToStream (STREAM &out) const |
Dumps the sequence of particles and their weights to a stream (requires T implementing CSerializable). More... | |
void | readParticlesFromStream (STREAM &in) |
Reads the sequence of particles and their weights from a stream (requires T implementing CSerializable). More... | |
void | getWeights (std::vector< double > &out_logWeights) const |
Returns a vector with the sequence of the logaritmic weights of all the samples. More... | |
const CParticleData * | getMostLikelyParticle () const |
Returns the particle with the highest weight. More... | |
const CRangeBearingParticleFilter & | derived () const |
CRTP helper method. More... | |
CRangeBearingParticleFilter & | derived () |
CRTP helper method. More... | |
double | getW (size_t i) const override |
Access to i'th particle (logarithm) weight, where first one is index 0. More... | |
void | setW (size_t i, double w) override |
Modifies i'th particle (logarithm) weight, where first one is index 0. More... | |
size_t | particlesCount () const override |
Get the m_particles count. More... | |
double | normalizeWeights (double *out_max_log_w=nullptr) override |
Normalize the (logarithmic) weights, such as the maximum weight is zero. More... | |
double | ESS () const override |
Returns the normalized ESS (Estimated Sample Size), in the range [0,1]. More... | |
void | performSubstitution (const std::vector< size_t > &indx) override |
Replaces the old particles by copies determined by the indexes in "indx", performing an efficient copy of the necesary particles only and allowing the number of particles to change. More... | |
void | prepareFastDrawSample (const bayes::CParticleFilter::TParticleFilterOptions &PF_options, TParticleProbabilityEvaluator partEvaluator=defaultEvaluator, const void *action=nullptr, const void *observation=nullptr) const |
Prepares data structures for calling fastDrawSample method next. More... | |
size_t | fastDrawSample (const bayes::CParticleFilter::TParticleFilterOptions &PF_options) const |
Draws a random sample from the particle filter, in such a way that each particle has a probability proportional to its weight (in the standard PF algorithm). More... | |
void | prediction_and_update (const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options) |
Performs the prediction stage of the Particle Filter. More... | |
void | performResampling (const bayes::CParticleFilter::TParticleFilterOptions &PF_options, size_t out_particle_count=0) |
Performs a resample of the m_particles, using the method selected in the constructor. More... | |
Static Public Member Functions | |
static double | defaultEvaluator ([[maybe_unused]] const bayes::CParticleFilter::TParticleFilterOptions &PF_options, [[maybe_unused]] const CParticleFilterCapable *obj, size_t index, [[maybe_unused]] const void *action, [[maybe_unused]] const void *observation) |
The default evaluator function, which simply returns the particle weight. More... | |
static void | computeResampling (CParticleFilter::TParticleResamplingAlgorithm method, const std::vector< double > &in_logWeights, std::vector< size_t > &out_indexes, size_t out_particle_count=0) |
A static method to perform the computation of the samples resulting from resampling a given set of particles, given their logarithmic weights, and a resampling method. More... | |
static void | log2linearWeights (const std::vector< double > &in_logWeights, std::vector< double > &out_linWeights) |
A static method to compute the linear, normalized (the sum the unity) weights from log-weights. More... | |
Public Attributes | |
CParticleList | m_particles |
The array of particles. More... | |
Static Public Attributes | |
static const particle_storage_mode | PARTICLE_STORAGE |
Protected Member Functions | |
virtual void | prediction_and_update_pfAuxiliaryPFStandard (const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options) |
Performs the particle filter prediction/update stages for the algorithm "pfAuxiliaryPFStandard" (if not implemented in heritated class, it will raise a 'non-implemented' exception). More... | |
virtual void | prediction_and_update_pfOptimalProposal (const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options) |
Performs the particle filter prediction/update stages for the algorithm "pfOptimalProposal" (if not implemented in heritated class, it will raise a 'non-implemented' exception). More... | |
virtual void | prediction_and_update_pfAuxiliaryPFOptimal (const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options) |
Performs the particle filter prediction/update stages for the algorithm "pfAuxiliaryPFOptimal" (if not implemented in heritated class, it will raise a 'non-implemented' exception). More... | |
Protected Attributes | |
TFastDrawAuxVars | m_fastDrawAuxiliary |
Auxiliary vectors, see CParticleFilterCapable::prepareFastDrawSample for more information. More... | |
|
inherited |
Use this to refer to each element in the m_particles array.
Definition at line 190 of file CParticleFilterData.h.
|
inherited |
This is the type inside the corresponding CParticleData class.
Definition at line 188 of file CParticleFilterData.h.
|
inherited |
Use this type to refer to the list of particles m_particles.
Definition at line 192 of file CParticleFilterData.h.
|
inherited |
A callback function type for evaluating the probability of m_particles of being selected, used in "fastDrawSample".
The default evaluator function "defaultEvaluator" simply returns the particle weight.
index | This is the index of the particle its probability is being computed. |
action | The value of this is the parameter passed to "prepareFastDrawSample" |
observation | The value of this is the parameter passed to "prepareFastDrawSample" The action and the observation are declared as "void*" for a greater flexibility. |
Definition at line 60 of file CParticleFilterCapable.h.
|
inlineinherited |
Free the memory of all the particles and reset the array "m_particles" to length zero.
Definition at line 202 of file CParticleFilterData.h.
|
staticinherited |
A static method to perform the computation of the samples resulting from resampling a given set of particles, given their logarithmic weights, and a resampling method.
It returns the sequence of indexes from the resampling. The number of output samples is the same than the input population. This generic method just computes these indexes, to actually perform a resampling in a particle filter object, call performResampling
[in] | out_particle_count | The desired number of output particles after resampling; 0 means don't modify the current number. |
Definition at line 61 of file CParticleFilterCapable.cpp.
References ASSERT_, mrpt::random::CRandomGenerator::drawUniform(), mrpt::random::CRandomGenerator::drawUniformVector(), mrpt::format(), mrpt::random::getRandomGenerator(), mrpt::math::maximum(), MRPT_END, MRPT_START, mrpt::bayes::CParticleFilter::prMultinomial, mrpt::bayes::CParticleFilter::prResidual, mrpt::bayes::CParticleFilter::prStratified, mrpt::bayes::CParticleFilter::prSystematic, R, and THROW_EXCEPTION.
|
inlinestaticinherited |
The default evaluator function, which simply returns the particle weight.
The action and the observation are declared as "void*" for a greater flexibility.
Definition at line 68 of file CParticleFilterCapable.h.
|
inlineinherited |
CRTP helper method.
Definition at line 35 of file CParticleFilterData.h.
|
inlineinherited |
CRTP helper method.
Definition at line 40 of file CParticleFilterData.h.
|
inlineoverridevirtualinherited |
Returns the normalized ESS (Estimated Sample Size), in the range [0,1].
Note that you do NOT need to normalize the weights before calling this.
Implements mrpt::bayes::CParticleFilterCapable.
Definition at line 85 of file CParticleFilterData.h.
|
inherited |
Draws a random sample from the particle filter, in such a way that each particle has a probability proportional to its weight (in the standard PF algorithm).
This method can be used to generate a variable number of m_particles when resampling: to vary the number of m_particles in the filter. See prepareFastDrawSample for more information, or the Particle Filter tutorial.
NOTES:
Definition at line 478 of file CParticleFilterCapable.cpp.
References mrpt::bayes::CParticleFilter::TParticleFilterOptions::adaptiveSampleSize, mrpt::random::CRandomGenerator::drawUniform(), mrpt::random::getRandomGenerator(), MRPT_END, MRPT_END_WITH_CLEAN_UP, MRPT_START, mrpt::bayes::CParticleFilter::prMultinomial, mrpt::bayes::CParticleFilter::TParticleFilterOptions::resamplingMethod, and THROW_EXCEPTION.
Referenced by mrpt::hmtslam::CLSLAM_RBPF_2DLASER::prediction_and_update_pfAuxiliaryPFOptimal().
void CRangeBearingParticleFilter::getMean | ( | float & | x, |
float & | y, | ||
float & | vx, | ||
float & | vy | ||
) |
Computes the average velocity & position.
Computes the average velocity.
Definition at line 677 of file vision_stereo_rectify/test.cpp.
|
inlineinherited |
Returns the particle with the highest weight.
Definition at line 271 of file CParticleFilterData.h.
|
inlineoverridevirtualinherited |
Access to i'th particle (logarithm) weight, where first one is index 0.
Implements mrpt::bayes::CParticleFilterCapable.
Definition at line 41 of file CParticleFilterData.h.
|
inlineinherited |
Returns a vector with the sequence of the logaritmic weights of all the samples.
Definition at line 257 of file CParticleFilterData.h.
void CRangeBearingParticleFilter::initializeParticles | ( | size_t | numParticles | ) |
Definition at line 651 of file vision_stereo_rectify/test.cpp.
|
staticinherited |
A static method to compute the linear, normalized (the sum the unity) weights from log-weights.
Definition at line 544 of file CParticleFilterCapable.cpp.
References ASSERT_, MRPT_END, and MRPT_START.
|
inlineoverridevirtualinherited |
Normalize the (logarithmic) weights, such as the maximum weight is zero.
out_max_log_w | If provided, will return with the maximum log_w before normalizing, such as new_weights = old_weights - max_log_w. |
Implements mrpt::bayes::CParticleFilterCapable.
Definition at line 60 of file CParticleFilterData.h.
|
inlineoverridevirtualinherited |
Get the m_particles count.
Implements mrpt::bayes::CParticleFilterCapable.
Definition at line 55 of file CParticleFilterData.h.
|
inherited |
Performs a resample of the m_particles, using the method selected in the constructor.
After computing the surviving samples, this method internally calls "performSubstitution" to actually perform the particle replacement. This method is called automatically by CParticleFilter::execute, andshould not be invoked manually normally. To just obtaining the sequence of resampled indexes from a sequence of weights, use "resample"
[in] | out_particle_count | The desired number of output particles after resampling; 0 means don't modify the current number. |
Definition at line 29 of file CParticleFilterCapable.cpp.
References ASSERT_, MRPT_END, MRPT_START, and mrpt::bayes::CParticleFilter::TParticleFilterOptions::resamplingMethod.
Referenced by mrpt::bayes::CParticleFilter::executeOn().
|
inlineoverridevirtualinherited |
Replaces the old particles by copies determined by the indexes in "indx", performing an efficient copy of the necesary particles only and allowing the number of particles to change.
Implements mrpt::bayes::CParticleFilterCapable.
Definition at line 110 of file CParticleFilterData.h.
|
inherited |
Performs the prediction stage of the Particle Filter.
This method simply selects the appropiate protected method according to the particle filter algorithm to run.
Definition at line 273 of file CParticleFilterCapable.cpp.
References mrpt::bayes::CParticleFilter::TParticleFilterOptions::PF_algorithm, mrpt::bayes::CParticleFilter::pfAuxiliaryPFOptimal, mrpt::bayes::CParticleFilter::pfAuxiliaryPFStandard, mrpt::bayes::CParticleFilter::pfOptimalProposal, mrpt::bayes::CParticleFilter::pfStandardProposal, and THROW_EXCEPTION.
Referenced by mrpt::bayes::CParticleFilter::executeOn().
|
protectedvirtualinherited |
Performs the particle filter prediction/update stages for the algorithm "pfAuxiliaryPFOptimal" (if not implemented in heritated class, it will raise a 'non-implemented' exception).
Reimplemented in mrpt::hmtslam::CLocalMetricHypothesis, mrpt::slam::CMonteCarloLocalization2D, mrpt::slam::CMonteCarloLocalization3D, and mrpt::maps::CMultiMetricMapPDF.
Definition at line 345 of file CParticleFilterCapable.cpp.
References THROW_EXCEPTION.
|
protectedvirtualinherited |
Performs the particle filter prediction/update stages for the algorithm "pfAuxiliaryPFStandard" (if not implemented in heritated class, it will raise a 'non-implemented' exception).
Reimplemented in mrpt::slam::CMonteCarloLocalization2D, mrpt::maps::CMultiMetricMapPDF, and mrpt::slam::CMonteCarloLocalization3D.
Definition at line 320 of file CParticleFilterCapable.cpp.
References THROW_EXCEPTION.
|
protectedvirtualinherited |
Performs the particle filter prediction/update stages for the algorithm "pfOptimalProposal" (if not implemented in heritated class, it will raise a 'non-implemented' exception).
Reimplemented in mrpt::hmtslam::CLocalMetricHypothesis, and mrpt::maps::CMultiMetricMapPDF.
Definition at line 333 of file CParticleFilterCapable.cpp.
References THROW_EXCEPTION.
|
overridevirtual |
Update the m_particles, predicting the posterior of robot pose and map after a movement command.
This method has additional configuration parameters in "options". Performs the update stage of the RBPF, using the sensed Sensorial Frame:
action | This is a pointer to CActionCollection, containing the pose change the robot has been commanded. |
observation | This must be a pointer to a CSensoryFrame object, with robot sensed observations. |
Reimplemented from mrpt::bayes::CParticleFilterCapable.
Definition at line 598 of file vision_stereo_rectify/test.cpp.
|
inherited |
Prepares data structures for calling fastDrawSample method next.
This method must be called once before using "fastDrawSample" (calling this more than once has no effect, but it takes time for nothing!) The behavior depends on the configuration of the PF (see CParticleFilter::TParticleFilterOptions):
The function pointed by "partEvaluator" should take into account the particle filter algorithm selected in "m_PFAlgorithm". If called without arguments (defaultEvaluator), the default behavior is to draw samples with a probability proportional to their current weights. The action and the observation are declared as "void*" for a greater flexibility. For a more detailed information see the Particle Filter tutorial. Custom supplied "partEvaluator" functions must take into account the previous particle weight, i.e. multiplying the current observation likelihood by the weights.
Definition at line 359 of file CParticleFilterCapable.cpp.
References mrpt::bayes::CParticleFilter::TParticleFilterOptions::adaptiveSampleSize, ASSERT_, mrpt::math::maximum(), MRPT_CHECK_NORMAL_NUMBER, MRPT_END, MRPT_END_WITH_CLEAN_UP, MRPT_START, mrpt::bayes::CParticleFilter::prMultinomial, mrpt::bayes::CParticleFilter::TParticleFilterOptions::resamplingMethod, and THROW_EXCEPTION.
Referenced by mrpt::hmtslam::CLSLAM_RBPF_2DLASER::prediction_and_update_pfAuxiliaryPFOptimal().
|
inlineinherited |
Reads the sequence of particles and their weights from a stream (requires T implementing CSerializable).
Definition at line 230 of file CParticleFilterData.h.
|
inlineoverridevirtualinherited |
Modifies i'th particle (logarithm) weight, where first one is index 0.
Implements mrpt::bayes::CParticleFilterCapable.
Definition at line 48 of file CParticleFilterData.h.
|
inlineinherited |
Dumps the sequence of particles and their weights to a stream (requires T implementing CSerializable).
Definition at line 208 of file CParticleFilterData.h.
|
mutableprotectedinherited |
Auxiliary vectors, see CParticleFilterCapable::prepareFastDrawSample for more information.
Definition at line 282 of file CParticleFilterCapable.h.
|
inherited |
The array of particles.
Definition at line 196 of file CParticleFilterData.h.
|
staticinherited |
Definition at line 193 of file CParticleFilterData.h.
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |