class mola::BackEndBase

Overview

Virtual interface for SLAM back-ends. All calls to onXXX() methods are enqueued and executed in a separate thread.

#include <BackEndBase.h>

class BackEndBase: public mola::ExecutableBase
{
public:
    // structs

    struct AddFactor_Output;
    struct AdvertiseUpdatedLocalization_Input;
    struct ProposeKF_Input;
    struct ProposeKF_Output;

    // fields

    std::function<Ptr(const std::string&)> nameServer_;
    std::optional<ProfilerSaverAtDtor> profiler_dtor_save_stats_;
    Profiler profiler_ {false};

    // methods

    std::future<ProposeKF_Output> addKeyFrame(const ProposeKF_Input& i);
    std::future<AddFactor_Output> addFactor(Factor& f);
    std::future<void> advertiseUpdatedLocalization(const AdvertiseUpdatedLocalization_Input& l);
    virtual ProposeKF_Output doAddKeyFrame(const ProposeKF_Input& i) = 0;
    virtual AddFactor_Output doAddFactor(Factor& f) = 0;
    virtual void doAdvertiseUpdatedLocalization(const AdvertiseUpdatedLocalization_Input& l) = 0;
    virtual void spinOnce() = 0;
    virtual int launchOrderPriority() const;
    virtual void onQuit();

    template <class Interface>
    std::vector<Ptr> findService() const;

    virtual void initialize(const Yaml& cfg);

    virtual void onSmartFactorChanged(
        ] mola::fid_t id,
        ] const mola::FactorBase* f
        );

    virtual mola::id_t temp_createStereoCamera(
        ] const mrpt::img::TCamera& left,
        ] const mrpt::img::TCamera& right,
        ] const double baseline
        );

    virtual mola::id_t temp_createLandmark(] const mrpt::math::TPoint3D& init_value);
    virtual void lock_slam();
    virtual void unlock_slam();
    Ptr getAsPtr();
    static Ptr Factory(const std::string& classname);
};

Inherited Members

public:
    // methods

    virtual void initialize(const Yaml& cfg) = 0;

Fields

std::function<Ptr(const std::string&)> nameServer_

A name server function to search for other ExecutableBase objects in my running system. Empty during ctor, should be usable from initialize_common() and initialize(). In a standard system, this is implemented by MolaLauncherApp::nameServerImpl()

See also:

findService()

std::optional<ProfilerSaverAtDtor> profiler_dtor_save_stats_

Enabled from mola-cli with --profiler-whole to save full profile stats to .m files at program end.

Profiler profiler_ {false}

Time profiler (disabled by default). All profilers can be globally enabled from MolaLauncherApp.

Methods

std::future<ProposeKF_Output> addKeyFrame(const ProposeKF_Input& i)

Creates a new KeyFrame in the world model.

std::future<AddFactor_Output> addFactor(Factor& f)

Adds a new constraint factor to the world model. Note that the object is moved, so it will not hold a valid value upon return.

virtual void spinOnce() = 0

Runs any required action on a timely manner

virtual int launchOrderPriority() const

Modules will be initialized in the order determined by:

  • First: the “order priority”, which is the number returned here.

  • Second: modules with the same “priority”, will be sorted by ascending lexicographical order or their “instance names”.

virtual void onQuit()

Called while destroying the SLAM system. A perfect placeholder for saving data to filesystem, clean up, etc. before any module destructor has been actually beeing invoked.

template <class Interface>
std::vector<Ptr> findService() const

Finds (an)other ExecutableBase(s) by its expected Interface, that is, a virtual base class.

See also:

nameServer_

virtual void initialize(const Yaml& cfg)

Loads common parameters for all back-ends.

virtual mola::id_t temp_createStereoCamera(
    ] const mrpt::img::TCamera& left,
    ] const mrpt::img::TCamera& right,
    ] const double baseline
    )

TODO: Refactor this!!

Ptr getAsPtr()

Get as shared_ptr via enable_shared_from_this<>

static Ptr Factory(const std::string& classname)

Class factory. Register using MOLA_REGISTER_MODULE()