Class CMetricMapBuilderRBPF

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class CMetricMapBuilderRBPF : public mrpt::slam::CMetricMapBuilder

This class implements a Rao-Blackwelized Particle Filter (RBPF) approach to map building (SLAM). Internally, the list of particles, each containing a hypothesis for the robot path plus its associated metric map, is stored in an object of class CMultiMetricMapPDF.

This class processes robot actions and observations sequentially (through the method CMetricMapBuilderRBPF::processActionObservation) and exploits the generic design of metric map classes in MRPT to deal with any number and combination of maps simultaneously: the likelihood of observations is the product of the likelihood in the different maps, etc.

A number of particle filter methods are implemented as well, by selecting the appropriate values in TConstructionOptions::PF_options. Not all the PF algorithms are implemented for all kinds of maps.

For an example of usage, check the application “rbpf-slam”, in “apps/RBPF-SLAM”. See also the wiki page.

See also

CMetricMap

Note

Since MRPT 0.7.2, the new variables “localizeLinDistance,localizeAngDistance” are introduced to provide a way to update the robot pose at a different rate than the map is updated.

Note

Since MRPT 0.7.1 the semantics of the parameters “insertionLinDistance” and “insertionAngDistance” changes: the entire RBFP is now NOT updated unless odometry increments surpass the threshold (previously, only the map was NOT updated). This is done to gain efficiency.

Note

Since MRPT 0.6.2 this class implements full 6D SLAM. Previous versions worked in 2D + heading only.

Public Functions

CMetricMapBuilderRBPF(const TConstructionOptions &initializationOptions)

Constructor.

CMetricMapBuilderRBPF()

This second constructor is created for the situation where a class member needs to be of type CMetricMapBuilderRBPF

CMetricMapBuilderRBPF &operator=(const CMetricMapBuilderRBPF &src)

Copy Operator.

~CMetricMapBuilderRBPF() override

Destructor.

virtual void initialize(const mrpt::maps::CSimpleMap &initialMap = mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF *x0 = nullptr) override

Initialize the method, starting with a known location PDF “x0”(if supplied, set to nullptr to left unmodified) and a given fixed, past map.

void clear()

Clear all elements of the maps.

virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const override

Returns a copy of the current best pose estimation as a pose PDF.

void getCurrentMostLikelyPath(std::deque<mrpt::math::TPose3D> &outPath) const

Returns the current most-likely path estimation (the path associated to the most likely particle).

virtual void processActionObservation(mrpt::obs::CActionCollection &action, mrpt::obs::CSensoryFrame &observations) override

Appends a new action and observations to update this map: See the description of the class at the top of this page to see a more complete description.

Parameters:
  • action – The incremental 2D pose change in the robot pose. This value is deterministic.

  • observations – The set of observations that robot senses at the new pose. Statistics will be saved to statsLastIteration

virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap &out_map) const override

Fills “out_map” with the set of “poses”-“sensory-frames”, thus the so far built map.

virtual const mrpt::maps::CMultiMetricMap &getCurrentlyBuiltMetricMap() const override

Returns the map built so far. NOTE that for efficiency a pointer to the internal object is passed, DO NOT delete nor modify the object in any way, if desired, make a copy of ir with “clone()”.

virtual unsigned int getCurrentlyBuiltMapSize() override

Returns just how many sensory-frames are stored in the currently build map.

virtual void saveCurrentEstimationToImage(const std::string &file, bool formatEMF_BMP = true) override

A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.

Parameters:
  • file – The output file name

  • formatEMF_BMP – Output format = true:EMF, false:BMP

void drawCurrentEstimationToImage(mrpt::img::CCanvas *img)

A useful method for debugging: draws the current map and path hypotheses to a CCanvas

void saveCurrentPathEstimationToTextFile(const std::string &fil)

A logging utility: saves the current path estimation for each particle in a text file (a row per particle, each 3-column-entry is a set [x,y,phi], respectively).

double getCurrentJointEntropy()

Public Members

mrpt::maps::CMultiMetricMapPDF mapPDF

The map PDF: It includes a path and associated map for each particle.

TStats m_statsLastIteration

This structure will hold stats after each execution of processActionObservation

Protected Attributes

bayes::CParticleFilter::TParticleFilterOptions m_PF_options

The configuration of the particle filter

float insertionLinDistance

Distances (linear and angular) for inserting a new observation into the map.

float insertionAngDistance
float localizeLinDistance

Distances (linear and angular) for updating the robot pose estimate (and particles weighs, if applicable).

float localizeAngDistance
mrpt::poses::CPose3DPDFGaussian odoIncrementSinceLastLocalization

Traveled distance since last localization update

mrpt::poses::CPose3D odoIncrementSinceLastMapUpdate

Traveled distance since last map update

struct TConstructionOptions : public mrpt::config::CLoadableOptions

Options for building a CMetricMapBuilderRBPF object, passed to the constructor.

Public Functions

TConstructionOptions()

Constructor

void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
void dumpToTextStream(std::ostream &out) const override

Public Members

float insertionLinDistance = {1.0f}
float insertionAngDistance
float localizeLinDistance = {0.4f}
float localizeAngDistance
bayes::CParticleFilter::TParticleFilterOptions PF_options
mrpt::maps::TSetOfMetricMapInitializers mapsInitializers
mrpt::maps::CMultiMetricMapPDF::TPredictionParams predictionOptions
mrpt::system::VerbosityLevel verbosity_level = {mrpt::system::LVL_INFO}
struct TStats

This structure will hold stats after each execution of processActionObservation

Public Functions

TStats() = default

Public Members

bool observationsInserted = {false}

Whether the SF has been inserted in the metric maps.