class mola::WorldModel


The main class for a “map” or “world model”. More…

#include <WorldModel.h>

class WorldModel: public mola::ExecutableBase
    // structs

    struct Parameters;

    // fields

    Parameters params_;

    // methods

    void setModuleInstanceName(const std::string& s);
    std::string getModuleInstanceName() const;
    void map_load_from(mrpt::serialization::CArchive& in);
    void map_load_from(const std::string& fileName);
    void map_save_to(mrpt::serialization::CArchive& out) const;
    void map_save_to(const std::string& fileName) const;
    std::string map_base_directory() const;
    void entities_lock_for_read();
    void entities_unlock_for_read();
    void entities_lock_for_write();
    void entities_unlock_for_write();
    void factors_lock_for_read();
    void factors_unlock_for_read();
    void factors_lock_for_write();
    void factors_unlock_for_write();
    const Entity& entity_by_id(const id_t id) const;
    Entity& entity_by_id(const id_t id);
    const Factor& factor_by_id(const fid_t id) const;
    Factor& factor_by_id(const fid_t id);
    id_t entity_emplace_back(Entity&& e);
    fid_t factor_emplace_back(Factor&& f);
    id_t entity_push_back(const Entity& e);
    fid_t factor_push_back(const Factor& f);
    std::vector<id_t> entity_all_ids() const;
    std::vector<fid_t> factor_all_ids() const;
    annotations_data_t& entity_annotations_by_id(const id_t id);
    const annotations_data_t& entity_annotations_by_id(const id_t id) const;
    std::set<id_t> entity_neighbors(const id_t id) const;
    virtual void initialize_common(const Yaml&);
    virtual void initialize(const Yaml& cfg);
    virtual void spinOnce();
    virtual int launchOrderPriority() const;

Detailed Documentation

The main class for a “map” or “world model”.

This class cannot be factored out into its independent module due to its tight connection to “mola-kernel/interfaces”.


void map_load_from(mrpt::serialization::CArchive& in)

Loads the map from a given source.


std::runtime_error in case of any I/O error.
void map_load_from(const std::string& fileName)


void map_save_to(mrpt::serialization::CArchive& out) const

Saves the map to the given data sink.


std::runtime_error in case of any I/O error.
std::string map_base_directory() const

Returns the directory where entities will be swapped-off to disk when unloaded, i.e. the map database directory. This directory is built at construction from MOLA_MAP_STORAGE_DIR and the map name, which by default is the current date and time.

std::set<id_t> entity_neighbors(const id_t id) const

Returns all entities that are connected to a given one by any common factor.

virtual void initialize(const Yaml& cfg)

This should be reimplemented to read all the required parameters

virtual int launchOrderPriority() const

The WorldModel is launched first, before most other modules.