Python YASMIN (Yet Another State MachINe)
|
Public Member Functions | |
None | __init__ (self, int times) |
str | monitor_handler (self, Blackboard blackboard, Odometry msg) |
Public Member Functions inherited from yasmin_ros.monitor_state.MonitorState | |
str | execute (self, Blackboard blackboard) |
Public Member Functions inherited from yasmin.state.State | |
str | __call__ (self, Blackboard blackboard=None) |
str | __str__ (self) |
None | cancel_state (self) |
bool | is_canceled (self) |
bool | is_running (self) |
Set[str] | get_outcomes (self) |
Public Attributes | |
monitor_handler | |
times = times | |
Public Attributes inherited from yasmin_ros.monitor_state.MonitorState | |
list | msg_list = [] |
A set of messages received from the topic. | |
int | msg_queue = msg_queue |
The maximum number of messages to retain. | |
float | time_to_wait = 0.001 |
Time to wait between checks for messages. | |
bool | monitoring = False |
Flag indicating if monitoring is active. | |
Additional Inherited Members | |
Protected Attributes inherited from yasmin_ros.monitor_state.MonitorState | |
Callable[[Blackboard, Any], None] | _monitor_handler = monitor_handler |
Function to handle incoming messages. | |
int | _timeout = timeout |
Timeout duration for monitoring. | |
Node | _node = node |
The ROS 2 node instance used for subscriptions. | |
str | _topic_name = topic_name |
The name of the topic to monitor. | |
Subscription | _sub |
Subscription object for the specified topic. | |
Protected Attributes inherited from yasmin.state.State | |
Set | _outcomes = set() |
A set of valid outcomes for this state. | |
bool | _running = False |
A flag indicating whether the state is currently running. | |
bool | _canceled = False |
A flag indicating whether the state has been canceled. | |
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. Attributes: times (int): The number of messages to monitor before transitioning to the next outcome. Parameters: times (int): The initial count of how many Odometry messages to process before changing state. Methods: monitor_handler(blackboard: Blackboard, msg: Odometry) -> str: Handles incoming Odometry messages, logging the message and returning the appropriate outcome based on the remaining count.
None yasmin_demos.monitor_demo.PrintOdometryState.__init__ | ( | self, | |
int | times ) |
Initializes the PrintOdometryState. Parameters: times (int): The number of Odometry messages to monitor before transitioning to the next outcome.
Reimplemented from yasmin_ros.monitor_state.MonitorState.
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. Parameters: 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
yasmin_demos.monitor_demo.PrintOdometryState.monitor_handler |
yasmin_demos.monitor_demo.PrintOdometryState.times = times |