Python YASMIN (Yet Another State MachINe)
|
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. | |
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.
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.
|
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.
|
protected |
Executor for managing node operations.
|
staticprotected |
The single instance of YasminNode.
|
staticprotected |
Lock to control access to the instance.
|
protected |
Thread to execute the spinning of the node.