class mola::ASLAM_gtsam

Overview

Reference implementation of absolute-coordinates SLAM with GTSAM factor graphs. More…

#include <ASLAM_gtsam.h>

class ASLAM_gtsam: public mola::BackEndBase
{
public:
    // enums

    enum StateVectorType;

    // structs

    struct DisplayInfo;
    struct DisplayState;
    struct Parameters;
    struct SLAM_state;
    struct whole_path_t;

    // fields

    std::function<Ptr(const std::string&)> nameServer_;
    Parameters params_;
    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);
    virtual int launchOrderPriority() const;

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

    virtual void initialize(const Yaml& cfg);
    virtual void spinOnce();
    virtual void onQuit();
    virtual ProposeKF_Output doAddKeyFrame(const ProposeKF_Input& i);
    virtual AddFactor_Output doAddFactor(Factor& newF);
    void doAdvertiseUpdatedLocalization(const AdvertiseUpdatedLocalization_Input& l);

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

    virtual void lock_slam();
    virtual void unlock_slam();

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

    mola::id_t temp_createLandmark(const mrpt::math::TPoint3D& init_value);
    virtual void initialize_common(const Yaml& cfg);

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

    Ptr getAsPtr();
    static Ptr Factory(const std::string& classname);
};

Inherited Members

public:
    // structs

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

    // methods

    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 initialize(const Yaml& cfg);
    virtual void onQuit();

Detailed Documentation

Reference implementation of absolute-coordinates SLAM with GTSAM factor graphs. See docs in: mola-slam-gtsam

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 int launchOrderPriority() const

Modules will be initialized in the order determined by:

  • First: the “oder priority”, which is the number returned here.
  • Second: modules with the same “priority”, will be sorted by ascending lexicographical order or their “instance names”.
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)

This should be reimplemented to read all the required parameters

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.

virtual void initialize_common(const Yaml& cfg)

Loads common parameters for all back-ends. Called by launcher just before initialize().

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