CORESENSE4home_Architecture
Loading...
Searching...
No Matches
Efferent Class Referenceabstract

Manages efferent operations in the robotic system, including the configuration of publishers and message broadcasting. More...

#include <Efferent.hpp>

Inheritance diagram for Efferent:
Collaboration diagram for Efferent:

Public Member Functions

virtual bool configure ()=0
 Configures the Efferent component.
 
 Efferent (rclcpp_lifecycle::LifecycleNode::SharedPtr parent)
 Constructs an Efferent object associated with a parent lifecycle node.
 
template<class MessageT>
void publish (std::unique_ptr< MessageT > msg)
 Publishes a serialized message to all configured publishers.
 

Protected Member Functions

bool create_publisher (const std::string &topic, const std::string &type)
 Creates a publisher for a specified topic and message type.
 

Protected Attributes

rclcpp_lifecycle::LifecycleNode::SharedPtr parent_
 < Shared pointer to the parent lifecycle node.
 
std::vector< std::shared_ptr< rclcpp::GenericPublisher > > pubs_
 

Detailed Description

Manages efferent operations in the robotic system, including the configuration of publishers and message broadcasting.

Constructor & Destructor Documentation

◆ Efferent()

Efferent ( rclcpp_lifecycle::LifecycleNode::SharedPtr parent)
explicit

Constructs an Efferent object associated with a parent lifecycle node.

Constructs an Efferent object and assigns the parent lifecycle node.

Parameters
parentShared pointer to the lifecycle node managing this Efferent instance.

Member Function Documentation

◆ configure()

virtual bool configure ( )
pure virtual

Configures the Efferent component.

Returns
True if configuration is successful.

Implemented in SimpleImageOutput.

◆ create_publisher()

bool create_publisher ( const std::string & topic,
const std::string & type )
protected

Creates a publisher for a specified topic and message type.

Parameters
topicThe topic name to publish messages to.
typeThe type of messages to publish on the topic.
Returns
True if the publisher was created successfully.

This function sets up a generic publisher on a given topic, allowing the Efferent component to send messages of the specified type.

Parameters
topicThe topic name to publish messages to.
typeThe type of messages to publish on the topic.
Returns
True if the publisher was created successfully.

◆ publish()

template<class MessageT>
void publish ( std::unique_ptr< MessageT > msg)

Publishes a serialized message to all configured publishers.

This templated method serializes the provided message and broadcasts it to each publisher in the pubs_ list.

Template Parameters
MessageTType of the message to publish.
Parameters
msgUnique pointer to the message to broadcast.

Member Data Documentation

◆ parent_

rclcpp_lifecycle::LifecycleNode::SharedPtr parent_
protected

< Shared pointer to the parent lifecycle node.

List of generic publishers.

◆ pubs_

std::vector<std::shared_ptr<rclcpp::GenericPublisher> > pubs_
protected

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