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

Public Member Functions

None __init__ (self)
 

Static Public Member Functions

"YasminNode" get_instance ()
 

Protected Attributes

MultiThreadedExecutor _executor = MultiThreadedExecutor()
 Executor for managing node operations.
 
Thread _spin_thread = Thread(target=self._executor.spin)
 Thread to execute the spinning of the node.
 

Static Protected Attributes

str _instance = None
 The single instance of YasminNode.
 
RLock _lock = RLock()
 Lock to control access to the instance.
 

Detailed Description

A Singleton ROS 2 Node for the Yasmin application.

This class implements a Singleton pattern to ensure that only one instance
of YasminNode exists throughout the application. It manages a ROS 2 Node
and a MultiThreadedExecutor to handle callbacks.

@section attributes Attributes
- _instance: The single instance of YasminNode.
- _lock: A reentrant lock for thread safety.
- _executor: An instance of MultiThreadedExecutor to manage node execution.
- _spin_thread: A thread that runs the executor's spin method.

@exception RuntimeError Raised when attempting to instantiate the node more than once.

Constructor & Destructor Documentation

◆ __init__()

None yasmin_ros.yasmin_node.YasminNode.__init__ ( self)
Initializes the YasminNode instance.

This constructor initializes the ROS 2 Node with a unique name and
starts a MultiThreadedExecutor for handling node callbacks.
It raises a RuntimeError if an attempt is made to create a second instance
of this Singleton class.

@exception RuntimeError Raised when an attempt is made to create
more than one instance of YasminNode.

Member Function Documentation

◆ get_instance()

"YasminNode" yasmin_ros.yasmin_node.YasminNode.get_instance ( )
static
Retrieves the single instance of YasminNode.

If the instance does not exist, it creates one in a thread-safe manner.

@return A reference to the YasminNode instance.

@exception RuntimeError Raised if the creation of the instance fails.

Member Data Documentation

◆ _executor

MultiThreadedExecutor yasmin_ros.yasmin_node.YasminNode._executor = MultiThreadedExecutor()
protected

Executor for managing node operations.

◆ _instance

str yasmin_ros.yasmin_node.YasminNode._instance = None
staticprotected

The single instance of YasminNode.

◆ _lock

RLock yasmin_ros.yasmin_node.YasminNode._lock = RLock()
staticprotected

Lock to control access to the instance.

◆ _spin_thread

Thread yasmin_ros.yasmin_node.YasminNode._spin_thread = Thread(target=self._executor.spin)
protected

Thread to execute the spinning of the node.


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