Python YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin_ros.publisher_state.PublisherState Class Reference
Inheritance diagram for yasmin_ros.publisher_state.PublisherState:
Collaboration diagram for yasmin_ros.publisher_state.PublisherState:

Public Member Functions

None __init__ (self, Type msg_type, str topic_name, Callable create_message_handler, Union[QoSProfile, int] qos=10, CallbackGroup callback_group=None, Node node=None)
 
str execute (self, Blackboard blackboard)
 

Protected Attributes

Callable[[Blackboard], Any] _create_message_handler = create_message_handler
 Callback handler to create messages.
 
Node _node = node
 Shared pointer to the ROS 2 node.
 
str _topic_name = topic_name
 Name of the topic to publish to.
 
Publisher _pub
 Publisher to the ROS 2 topic.
 

Detailed Description

Template class to publish ROS 2 messages.

This class provides functionality to publish to a ROS 2 topic
and create custom messages.

Attributes:
    _node (Node): Shared pointer to the ROS 2 node.
    _pub (Publisher): Publisher to the ROS 2 topic.
    _topic_name (str): Name of the topic to publish to.
    _create_message_handler (Callable[[Blackboard], Any]): Callback handler to create messages.

Constructor & Destructor Documentation

◆ __init__()

None yasmin_ros.publisher_state.PublisherState.__init__ ( self,
Type msg_type,
str topic_name,
Callable create_message_handler,
Union[QoSProfile, int] qos = 10,
CallbackGroup callback_group = None,
Node node = None )
Construct a new PublisherState with ROS 2 node and specific QoS.

Args:
    msg_type (Type): The type of message to be published.
    topic_name (str): The name of the topic to publish to.
    create_message_handler (Callable[[Blackboard], Any]): A callback handler to create messages.
    qos (Union[QoSProfile, int], optional): Quality of Service settings for the topic.
    callback_group (CallbackGroup, optional): The callback group for the publisher.
    node (Node, optional): The ROS 2 node to use. If None, a default node is created.

Member Function Documentation

◆ execute()

str yasmin_ros.publisher_state.PublisherState.execute ( self,
Blackboard blackboard )
Execute the publishing operation.

Args:
    blackboard (Blackboard): A shared pointer to the blackboard for data storage.

Returns:
    str: A string outcome indicating the result of the publishing operation.

Member Data Documentation

◆ _create_message_handler

Callable[[Blackboard], Any] yasmin_ros.publisher_state.PublisherState._create_message_handler = create_message_handler
protected

Callback handler to create messages.

◆ _node

Node yasmin_ros.publisher_state.PublisherState._node = node
protected

Shared pointer to the ROS 2 node.

◆ _pub

Publisher yasmin_ros.publisher_state.PublisherState._pub
protected
Initial value:
= ROSClientsCache.get_or_create_publisher(
self._node,
msg_type,
topic_name,
qos,
callback_group=callback_group,
)

Publisher to the ROS 2 topic.

◆ _topic_name

str yasmin_ros.publisher_state.PublisherState._topic_name = topic_name
protected

Name of the topic to publish to.


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