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 mola::TransformTreeSource { public: // structs struct CachedLocalizationTf; struct MolaSubs; struct Params; // construction BridgeROS2(); BridgeROS2(const BridgeROS2&); BridgeROS2(BridgeROS2&&); // methods virtual std::optional<TransformTree> transform_tree( const std::string& root, const std::optional<mrpt::Clock::time_point>& timestamp = std::nullopt ) const; virtual std::string transform_tree_default_root() const; BridgeROS2& operator = (const BridgeROS2&); BridgeROS2& operator = (BridgeROS2&&); virtual void spinOnce(); virtual void onNewObservation(const CObservation::ConstPtr& o); };
Inherited Members
public: // structs struct DiagnosticsOutput; struct SensorViewerImpl; // methods 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&&); TransformTreeSource& operator = (const TransformTreeSource&); TransformTreeSource& operator = (TransformTreeSource&&); virtual std::optional<TransformTree> transform_tree( const std::string& root, const std::optional<mrpt::Clock::time_point>& timestamp = std::nullopt ) const = 0; virtual std::string transform_tree_default_root() const;
Methods
virtual std::optional<TransformTree> transform_tree( const std::string& root, const std::optional<mrpt::Clock::time_point>& timestamp = std::nullopt ) const
Returns all frames reachable below root (that is, the subtree it is the root of), with their poses resolved with respect to it.
Filtering happens here, in the source, since it is what owns the underlying transform buffer: a consumer interested in a robot’s joints never has to receive, nor walk, the frames of unrelated subtrees.
Parameters:
root |
The frame to use as the subtree root, e.g. “base_link”. |
timestamp |
The time to look the transforms up at. If not provided, or if no data is buffered for it, the latest available transform of each frame is used instead. |
Returns:
The subtree, or std::nullopt if root is not a known frame.
virtual std::string transform_tree_default_root() const
Returns the frame this source considers the robot’s body frame (its base_link_frame_id parameter, or equivalent), so consumers can default to it instead of hardcoding a name. Empty if the source has none.
virtual void spinOnce()
Runs any required action on a timely manner
virtual void onNewObservation(const CObservation::ConstPtr& o)
To be called whenever a new observation arrives. It should return as fast as possible, enqueuing the data for processing in another thread.