Public Member Functions | List of all members
fuse_core::Publisher Class Referenceabstract

The interface class for publisher plugins in the fuse ecosystem. More...

#include <publisher.h>

Inheritance diagram for fuse_core::Publisher:
Inheritance graph
[legend]

Public Member Functions

 FUSE_SMART_PTR_ALIASES_ONLY (Publisher)
 
virtual void initialize (const std::string &name)=0
 Perform any required post-construction initialization, such as advertising publishers or reading from the parameter server. More...
 
virtual const std::string & name () const =0
 Get the unique name of this publisher. More...
 
virtual void notify (Transaction::ConstSharedPtr transaction, Graph::ConstSharedPtr graph)=0
 Notify the publisher that an optimization cycle is complete, and about changes to the Graph. More...
 
 Publisher ()=default
 Constructor. More...
 
virtual void start ()
 Function to be executed whenever the optimizer is ready to receive transactions. More...
 
virtual void stop ()
 Function to be executed whenever the optimizer is no longer ready to receive transactions. More...
 
virtual ~Publisher ()=default
 Destructor. More...
 

Detailed Description

The interface class for publisher plugins in the fuse ecosystem.

A publisher plugin is responsible for querying the latest variable value from the optimized Graph, converting the variable values into ROS messages, and publishing the messages on their desired topics. Publisher plugins will be loaded by the optimizer at run/configure time. The optimizer will notify the plugins after the graph has been optimized. This class defines the supported interface between the optimizer and publisher. If you are deriving a new publisher class, consider using fuse_core::AsyncPublisher as the base class instead. It offers additional features making it act similar to a standard node or nodelet.

Definition at line 57 of file publisher.h.

Constructor & Destructor Documentation

◆ Publisher()

fuse_core::Publisher::Publisher ( )
default

Constructor.

All ROS plugins must provide a default constructor for use with the plugin loader.

◆ ~Publisher()

virtual fuse_core::Publisher::~Publisher ( )
virtualdefault

Destructor.

Member Function Documentation

◆ FUSE_SMART_PTR_ALIASES_ONLY()

fuse_core::Publisher::FUSE_SMART_PTR_ALIASES_ONLY ( Publisher  )

◆ initialize()

virtual void fuse_core::Publisher::initialize ( const std::string &  name)
pure virtual

Perform any required post-construction initialization, such as advertising publishers or reading from the parameter server.

This will be called on each plugin after construction, and after the ros node has been initialized. Plugins are encouraged to subnamespace any of their parameters to prevent conflicts and allow the same plugin to be used multiple times with different settings and topics.

Parameters
[in]nameA unique name to give this plugin instance

Implemented in fuse_core::AsyncPublisher.

◆ name()

virtual const std::string& fuse_core::Publisher::name ( ) const
pure virtual

Get the unique name of this publisher.

Implemented in fuse_core::AsyncPublisher.

◆ notify()

virtual void fuse_core::Publisher::notify ( Transaction::ConstSharedPtr  transaction,
Graph::ConstSharedPtr  graph 
)
pure virtual

Notify the publisher that an optimization cycle is complete, and about changes to the Graph.

Most publishers will only publish new data whenever the Graph values have been updated. The Publisher::notify() method will be called by the optimizer (and in the optimizer's thread) after every optimization cycle is complete. Additionally, the set of added and removed variables and constraints since the last optimization cycle will be provided to the publisher. In many cases this should prevent the plugins from searching through the entire graph, looking for the variables of interest.

Parameters
[in]transactionA Transaction object, describing the set of variables that have been added and/or removed
[in]graphA read-only pointer to the graph object, allowing queries to be performed whenever needed

Implemented in fuse_core::AsyncPublisher.

◆ start()

virtual void fuse_core::Publisher::start ( )
inlinevirtual

Function to be executed whenever the optimizer is ready to receive transactions.

This method will be called by the optimizer, in the optimizer's thread, once the optimizer has been initialized and is ready to receive transactions. It may also be called as part of a stop-start cycle when the optimizer has been requested to reset itself. This allows the publisher to reset any internal state before the optimizer begins processing after a reset. No calls to notify() will happen before the optimizer calls start().

Reimplemented in fuse_core::AsyncPublisher.

Definition at line 113 of file publisher.h.

◆ stop()

virtual void fuse_core::Publisher::stop ( )
inlinevirtual

Function to be executed whenever the optimizer is no longer ready to receive transactions.

This method will be called by the optimizer, in the optimizer's thread, before the optimizer shutdowns. It may also be called as part of a stop-start cycle when the optimizer has been requested to reset itself. This allows the publisher to reset any internal state before the optimizer begins processing after a reset. No calls to notify() will happen until start() has been called again.

Reimplemented in fuse_core::AsyncPublisher.

Definition at line 123 of file publisher.h.


The documentation for this class was generated from the following file:


fuse_core
Author(s): Stephen Williams
autogenerated on Thu Apr 24 2025 02:18:55