class mrpt::slam::CMetricMapBuilder

Overview

This virtual class is the base for SLAM implementations.

See derived classes for more information.

See also:

CMetricMap

#include <mrpt/slam/CMetricMapBuilder.h>

class CMetricMapBuilder: public mrpt::system::COutputLogger
{
public:
    // structs

    struct TOptions;

    // construction

    CMetricMapBuilder();

    // methods

    virtual void initialize(const mrpt::maps::CSimpleMap& initialMap = mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF* x0 = nullptr) = 0;
    virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const = 0;
    virtual void processActionObservation(mrpt::obs::CActionCollection& action, mrpt::obs::CSensoryFrame& observations) = 0;
    virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap& out_map) const = 0;
    virtual unsigned int getCurrentlyBuiltMapSize() = 0;
    virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const = 0;
    virtual void saveCurrentEstimationToImage(const std::string& file, bool formatEMF_BMP = true) = 0;
    void clear();
    void enableMapUpdating(bool enable);
    void loadCurrentMapFromFile(const std::string& fileName);
    void saveCurrentMapToFile(const std::string& fileName, bool compressGZ = true) const;
};

// direct descendants

class CMetricMapBuilderICP;
class CMetricMapBuilderRBPF;

Inherited Members

public:
    // structs

    struct TMsg;

Construction

CMetricMapBuilder()

Constructor.

Methods

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

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

virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const = 0

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

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

Process a new action and observations pair 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 estimation of the incremental pose change in the robot pose.

observations

The set of observations that robot senses at the new pose.

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

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

virtual unsigned int getCurrentlyBuiltMapSize() = 0

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

virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const = 0

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 void saveCurrentEstimationToImage(
    const std::string& file,
    bool formatEMF_BMP = true
    ) = 0

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 clear()

Clear all elements of the maps, and reset localization to (0,0,0deg).

void enableMapUpdating(bool enable)

Enables or disables the map updating (default state is enabled)

void loadCurrentMapFromFile(const std::string& fileName)

Load map (mrpt::maps::CSimpleMap) from a “.simplemap” file.

void saveCurrentMapToFile(const std::string& fileName, bool compressGZ = true) const

Save map (mrpt::maps::CSimpleMap) to a “.simplemap” file.