class mola::BridgeROS2

Overview

A bridge to read sensor observations from ROS 2 topics and forwarding them to other MOLA subsystems, and to publish MOLA topics, localization, and maps to ROS 2.

#include <BridgeROS2.h>

class BridgeROS2:
    public mola::RawDataSourceBase,
    public mola::RawDataConsumer
{
public:
    // structs

    struct MolaSubs;
    struct Params;
    struct RosPubs;

    // methods

    virtual void spinOnce();
    virtual void onNewObservation(const CObservation::Ptr& o);
    void attachToDataConsumer(RawDataConsumer& rdc);
    virtual void initialize(const Yaml& cfg);
};

Inherited Members

public:
    // structs

    struct SensorViewerImpl;

    // methods

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

Methods

virtual void spinOnce()

Runs any required action on a timely manner

virtual void onNewObservation(const CObservation::Ptr& o)

To be called whenever a new observation arrives. It should return as fast as possible, enqueuing the data for processing in another thread.

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.