|
Python YASMIN (Yet Another State MachINe)
|


Public Member Functions | |
| None | __init__ (self) |
| AddTwoInts.Request | create_request_handler (self, Blackboard blackboard) |
| str | response_handler (self, Blackboard blackboard, AddTwoInts.Response response) |
Public Member Functions inherited from yasmin_ros.service_state.ServiceState | |
| None | __init__ (self, Type srv_type, str srv_name, Callable create_request_handler, Set[str] outcomes=None, Callable response_handler=None, CallbackGroup callback_group=None, Node node=None, float wait_timeout=None, float response_timeout=None, int maximum_retry=3) |
| str | execute (self, Blackboard blackboard) |
| None | response_callback (self, Future future) |
Public Attributes | |
| create_request_handler | |
| response_handler | |
Public Attributes inherited from yasmin_ros.service_state.ServiceState | |
| response_callback = self._service_client.call_async(request) | |
Additional Inherited Members | |
Protected Attributes inherited from yasmin_ros.service_state.ServiceState | |
| Callable[[Blackboard], Any] | _create_request_handler = create_request_handler |
| Function to create service requests. | |
| Callable[[Blackboard, Any], str] | _response_handler = response_handler |
| Function to handle service responses. | |
| float | _wait_timeout = wait_timeout |
| Maximum wait time for service availability. | |
| float | _response_timeout = response_timeout |
| Timeout for the service response. | |
| Node | _node = node |
| The ROS 2 node used to communicate with the service. | |
| str | _srv_name = srv_name |
| Name of the service. | |
| Client | _service_client |
| Shared pointer to the service client. | |
| Any | _response = None |
| The response received from the service. | |
| int | _maximum_retry = maximum_retry |
| Maximum number of retries. | |
| Event | _response_received_event = Event() |
| Event to signal when the service response is received. | |
A state that calls the AddTwoInts service to add two integers. This class is a state in a finite state machine that sends a request to the AddTwoInts service, retrieves the response, and updates the blackboard with the result.
| None yasmin_demos.service_client_demo.AddTwoIntsState.__init__ | ( | self | ) |
Initializes the AddTwoIntsState. Calls the parent constructor with the specific service type, service name, request handler, outcomes, and response handler.
| AddTwoInts.Request yasmin_demos.service_client_demo.AddTwoIntsState.create_request_handler | ( | self, | |
| Blackboard | blackboard ) |
Creates the service request from the blackboard data.
Args:
blackboard (Blackboard): The blackboard containing the input values.
Returns:
AddTwoInts.Request: The request object populated with values from the blackboard.
| str yasmin_demos.service_client_demo.AddTwoIntsState.response_handler | ( | self, | |
| Blackboard | blackboard, | ||
| AddTwoInts.Response | response ) |
Processes the response from the AddTwoInts service.
Updates the blackboard with the sum result from the response.
Args:
blackboard (Blackboard): The blackboard to update with the sum.
response (AddTwoInts.Response): The response from the service call.
Returns:
str: The outcome of the operation, which is "outcome1".
| yasmin_demos.service_client_demo.AddTwoIntsState.create_request_handler |
| yasmin_demos.service_client_demo.AddTwoIntsState.response_handler |