class mola::Rosbag2Dataset

Overview

RawDataSource for datasets in rosbag2 format.

It reads a rosbag2 file, and exposes it as a dataset with N entries, N being the number of messages in the bag. Reading them via the offline API (OfflineDatasetSource) returns empty shared_ptr observations for those messages that do not have a direct mapping to mrpt::obs classes. The dataset can be also played in an online (real-time, or with a custom time wrapping) fashion via the RawDataSourceBase API.

See example configuration files to see how to define what topics to publish, and how to optionally override the sensor poses in the local robot frame.

#include <Rosbag2Dataset.h>

class Rosbag2Dataset:
    public mola::RawDataSourceBase,
    public mola::OfflineDatasetSource,
    public mola::Dataset_UI
{
public:
    // structs

    struct DatasetEntry;

    // methods

    virtual void spinOnce();
    virtual size_t datasetSize() const;
    virtual mrpt::obs::CSensoryFrame::Ptr datasetGetObservations(size_t timestep) 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);
};

Inherited Members

public:
    // structs

    struct SensorViewerImpl;

    // methods

    virtual void initialize(const Yaml& cfg) = 0;
    virtual size_t datasetSize() const = 0;
    virtual mrpt::obs::CSensoryFrame::Ptr datasetGetObservations(size_t timestep) const = 0;
    virtual bool hasGroundTruthTrajectory() const;
    virtual trajectory_t getGroundTruthTrajectory() const;
    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;

Methods

virtual void spinOnce()

Runs any required action on a timely manner

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