class mola::BinFileDataset

Overview

RawDataSource from a directory of time-ordered .bin LiDAR scan files. Each .bin file is expected to contain a sequence of 4 floats (x, y, z, intensity) for each point, in the standard KITTI format.

#include <BinFileDataset.h>

class BinFileDataset:
    public mola::OfflineDatasetSource,
    public mola::RawDataSourceBase,
    public mola::Dataset_UI
{
public:
    // fields

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

    // construction

    BinFileDataset();
    BinFileDataset(const BinFileDataset&);
    BinFileDataset(BinFileDataset&&);

    // methods

    virtual trajectory_t getGroundTruthTrajectory() const;
    virtual int launchOrderPriority() const;
    virtual void onQuit();
    mrpt::containers::yaml getModuleParameters() const;

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

    BinFileDataset& operator = (const BinFileDataset&);
    BinFileDataset& operator = (BinFileDataset&&);
    virtual void initialize_rds(const mrpt::containers::yaml& params);
    virtual size_t datasetSize() const;
    virtual mrpt::obs::CSensoryFrame::Ptr datasetGetObservations(size_t timestep) const;
    virtual void spinOnce();
    virtual bool hasGroundTruthTrajectory() const;
    virtual size_t datasetUI_size() const;
    virtual size_t datasetUI_lastQueriedTimestep() const;
    virtual double datasetUI_playback_speed() const;
    virtual void datasetUI_playback_speed(double speed);
    virtual bool datasetUI_paused() const;
    virtual void datasetUI_paused(bool paused);
    virtual void datasetUI_teleport(size_t timestep);
    void attachToDataConsumer(RawDataConsumer& rdc);
    virtual void initialize(const Yaml& cfg);
    Ptr getAsPtr();
    static Ptr Factory(const std::string& classname);
};

Inherited Members

public:
    // structs

    struct DiagnosticsOutput;
    struct SensorViewerImpl;

    // methods

    virtual size_t datasetSize() const = 0;
    virtual mrpt::obs::CSensoryFrame::Ptr datasetGetObservations(size_t timestep) const = 0;
    virtual bool hasGroundTruthTrajectory() const;
    virtual void initialize(const Yaml& cfg) = 0;
    virtual void spinOnce() = 0;
    ExecutableBase& operator = (const ExecutableBase&);
    ExecutableBase& operator = (ExecutableBase&&);
    RawDataSourceBase& operator = (const RawDataSourceBase&);
    RawDataSourceBase& operator = (RawDataSourceBase&&);
    virtual size_t datasetUI_size() const = 0;
    virtual size_t datasetUI_lastQueriedTimestep() const = 0;
    virtual double datasetUI_playback_speed() const = 0;
    virtual void datasetUI_playback_speed(double speed) = 0;
    virtual bool datasetUI_paused() const = 0;
    virtual void datasetUI_paused(bool paused) = 0;
    virtual void datasetUI_teleport(size_t timestep) = 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

virtual trajectory_t getGroundTruthTrajectory() const

If hasGroundTruthTrajectory() returns true, this returns the dataset groundtruth for the vehicle trajectory.

Note that timestamps for datasets are not wall-clock time (“now”), but old timestamps of when original observations were grabbed.

See also:

hasGroundTruthTrajectory()

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.

mrpt::containers::yaml getModuleParameters() const

Returns the current list of all known parameters and their values, in the same format than used in exposeParameters(). An empty YAML map will be returned if no parameter exists. New in MOLA v1.4.0

See also:

changeParameters()

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_rds(const mrpt::containers::yaml& params)

Initializes the module by reading parameters, finding files, and generating timestamps.

virtual size_t datasetSize() const

Number of different time steps available to call getObservations()

virtual mrpt::obs::CSensoryFrame::Ptr datasetGetObservations(size_t timestep) const

Returns the set of observations available for the given time step.

virtual void spinOnce()

Runs any required action on a timely manner

virtual bool hasGroundTruthTrajectory() const

Returns true if a groundtruth is available for the vehicle trajectory.

See also:

getGroundTruthTrajectory()

virtual size_t datasetUI_size() const

Number of different time steps available to call getObservations()

virtual size_t datasetUI_lastQueriedTimestep() const

Returns the latest requested observation, range [0, datasetSize()]

virtual void datasetUI_teleport(size_t timestep)

Forces continue replaying in this moment in time

void attachToDataConsumer(RawDataConsumer& rdc)

Attach this object to a consumer. A shared_ptr is created to keep a reference to the object.

virtual void initialize(const Yaml& cfg)

Loads common parameters for all RDS. This handles:

  • gui_preview_sensors : Enable displaying sensor data in a subwindow.

  • export_to_rawlog : If defined, save observations to the given rawlog file.

  • force_load_lazy_load : (Default=false) Force load() on all incoming observations.

  • quit_mola_app_on_dataset_end : (Default=false) Quits the MOLA app when end of dataset is reached.

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