Python YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin_demos.monitor_demo.PrintOdometryState Class Reference
Inheritance diagram for yasmin_demos.monitor_demo.PrintOdometryState:
Collaboration diagram for yasmin_demos.monitor_demo.PrintOdometryState:

Public Member Functions

None __init__ (self)
str monitor_handler (self, Blackboard blackboard, Odometry msg)
Public Member Functions inherited from yasmin_ros.monitor_state.MonitorState
None __init__ (self, Type msg_type, str topic_name, Set[str] outcomes, Callable monitor_handler, Union[QoSProfile, int] qos=10, CallbackGroup callback_group=None, int msg_queue=10, Node node=None, int timeout=None, int maximum_retry=3)
str execute (self, Blackboard blackboard)
None cancel_state (self)

Public Attributes

 monitor_handler
int times = 5
Public Attributes inherited from yasmin_ros.monitor_state.MonitorState
list msg_list = []
 List to store queued messages.
int msg_queue = msg_queue
 Maximum number of messages to queue.

Additional Inherited Members

Protected Attributes inherited from yasmin_ros.monitor_state.MonitorState
Callable[[Blackboard, Any], str] _monitor_handler = monitor_handler
 Function to handle incoming messages.
Event _msg_event = Event()
 Event for message reception.
int _timeout = timeout
 Timeout in seconds for message reception.
Node _node = node
 Shared pointer to the ROS 2 node.
str _topic_name = topic_name
 Name of the topic to monitor.
Subscription _sub = None
 Subscription to the ROS 2 topic.
Type _msg_type = msg_type
Union[QoSProfile, int] _qos = qos
CallbackGroup _callback_group = callback_group
int _maximum_retry = maximum_retry
 Subscription to the ROS 2 topic.

Detailed Description

MonitorState subclass to handle Odometry messages.

This state monitors Odometry messages from the specified ROS topic,
logging them and transitioning based on the number of messages received.

Constructor & Destructor Documentation

◆ __init__()

None yasmin_demos.monitor_demo.PrintOdometryState.__init__ ( self)
Initializes the PrintOdometryState.

Member Function Documentation

◆ monitor_handler()

str yasmin_demos.monitor_demo.PrintOdometryState.monitor_handler ( self,
Blackboard blackboard,
Odometry msg )
Handles incoming Odometry messages.

This method is called whenever a new Odometry message is received.
It logs the message, decrements the count of messages to process,
and determines the next state outcome.

Args:
    blackboard (Blackboard): The shared data storage for states.
    msg (Odometry): The incoming Odometry message.

Returns:
    str: The next state outcome, either "outcome1" to continue
         monitoring or "outcome2" to transition to the next state.

Exceptions:
    None

Member Data Documentation

◆ monitor_handler

yasmin_demos.monitor_demo.PrintOdometryState.monitor_handler

◆ times

int yasmin_demos.monitor_demo.PrintOdometryState.times = 5

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