class mrpt::hmtslam::CHMTSLAM

An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).

The main entry points for a user are pushAction() and pushObservations(). Several parameters can be modified through m_options.

The mathematical models of this approach have been reported in:

  • Blanco J.L., Fernandez-Madrigal J.A., and Gonzalez J., “Towards a Unified Bayesian Approach to Hybrid Metric-Topological SLAM”, in IEEE Transactions on Robotics (TRO), Vol. 24, No. 2, April 2008.

More information in the wiki page: https://www.mrpt.org/HMT-SLAM. A complete working application can be found in “MRPT/apps/hmt-slam”.

The complete state of the SLAM framework is serializable, so it can be saved and restore to/from a binary dump. This class implements mrpt::serialization::CSerializable, so it can be saved with “stream << slam_object;” and restored with “stream >> slam_object;”. Alternatively, the methods CHMTSLAM::saveState and CHMTSLAM::loadState can be invoked, which in turn call internally to the CSerializable interface.

See also:

CHierarchicalMHMap

#include <mrpt/hmtslam/CHMTSLAM.h>

class CHMTSLAM:
    public mrpt::system::COutputLogger,
    public mrpt::serialization::CSerializable
{
public:
    // enums

    enum TLSlamMethod;

    // structs

    struct TMessageLSLAMfromAA;
    struct TMessageLSLAMfromTBI;
    struct TMessageLSLAMtoTBI;
    struct TOptions;

    //
fields

    CHierarchicalMHMap m_map;
    std::map<THypothesisID, CLocalMetricHypothesis> m_LMHs;

    // construction

    CHMTSLAM();
    CHMTSLAM(const CHMTSLAM&);

    //
methods

    void clearInputQueue();
    bool isInputQueueEmpty();
    size_t inputQueueSize();
    void pushAction(const mrpt::obs::CActionCollection::Ptr& acts);
    void pushObservations(const mrpt::obs::CSensoryFrame::Ptr& sf);
    void pushObservation(const mrpt::obs::CObservation::Ptr& obs);
    void registerLoopClosureDetector(const std::string& name, CTopLCDetectorBase*(*)(CHMTSLAM*) ptrCreateObject);
    CTopLCDetectorBase* loopClosureDetector_factory(const std::string& name);
    void loadOptions(const std::string& configFile);
    void loadOptions(const mrpt::config::CConfigFileBase& cfgSource);
    void initializeEmptyMap();
    bool saveState(mrpt::serialization::CArchive& out) const;
    bool loadState(mrpt::serialization::CArchive& in);
    const CHMTSLAM& operator = (const CHMTSLAM&);
    bool abortedDueToErrors();
    void generateLogFiles(unsigned int nIteration);
    void getAs3DScene(mrpt::opengl::COpenGLScene& outScene);
};

Inherited Members

public:
    // structs

    struct TMsg;

Fields

CHierarchicalMHMap m_map

The hiearchical, multi-hypothesis graph-based map.

std::map<THypothesisID, CLocalMetricHypothesis> m_LMHs

The list of LMHs at each instant.

Construction

CHMTSLAM()

Default constructor.

Parameters:

debug_out_stream

If debug output messages should be redirected to any other stream apart from std::cout

Methods

void clearInputQueue()

Empty the input queue.

bool isInputQueueEmpty()

Returns true if the input queue is empty (Note that the queue must not be empty to the user to enqueue more actions/observaitions)

See also:

pushAction, pushObservations, inputQueueSize

size_t inputQueueSize()

Returns the number of objects waiting for processing in the input queue.

See also:

pushAction, pushObservations, isInputQueueEmpty

void pushAction(const mrpt::obs::CActionCollection::Ptr& acts)

Here the user can enter an action into the system (will go to the SLAM process).

This class will delete the passed object when required, so DO NOT DELETE the passed object after calling this.

See also:

pushObservations, pushObservation

void pushObservations(const mrpt::obs::CSensoryFrame::Ptr& sf)

Here the user can enter observations into the system (will go to the SLAM process).

This class will delete the passed object when required, so DO NOT DELETE the passed object after calling this.

See also:

pushAction, pushObservation

void pushObservation(const mrpt::obs::CObservation::Ptr& obs)

Here the user can enter an observation into the system (will go to the SLAM process).

This class will delete the passed object when required, so DO NOT DELETE the passed object after calling this.

See also:

pushAction, pushObservation

void registerLoopClosureDetector(
    const std::string& name,
    CTopLCDetectorBase*(*)(CHMTSLAM*) ptrCreateObject
    )

Must be invoked before calling initializeEmptyMap, so LC objects can be created.

CTopLCDetectorBase* loopClosureDetector_factory(const std::string& name)

The class factory for topological loop closure detectors.

Possible values are enumerated in TOptions::TLC_detectors

Parameters:

std::exception

On unknown name.

void loadOptions(const std::string& configFile)

Loads the options from a config file.

void loadOptions(const mrpt::config::CConfigFileBase& cfgSource)

Loads the options from a config source.

void initializeEmptyMap()

Initializes the whole HMT-SLAM framework, reseting to an empty map (It also clears the logs directory) - this must be called AFTER loading the options with CHMTSLAM::loadOptions.

bool saveState(mrpt::serialization::CArchive& out) const

Save the state of the whole HMT-SLAM framework to some binary stream (e.g.

a file).

Returns:

true if everything goes OK.

See also:

loadState

bool loadState(mrpt::serialization::CArchive& in)

Load the state of the whole HMT-SLAM framework from some binary stream (e.g.

a file).

Returns:

true if everything goes OK.

See also:

saveState

bool abortedDueToErrors()

Return true if an exception has been caught in any thread leading to the end of the mapping application: no more actions/observations will be processed from now on.

void generateLogFiles(unsigned int nIteration)

Called from LSLAM thread when log files must be created.

void getAs3DScene(mrpt::opengl::COpenGLScene& outScene)

Gets a 3D representation of the current state of the whole mapping framework.