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 | |
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 | |
create_request_handler | |
response_handler | |
Additional Inherited Members | |
Protected Attributes inherited from yasmin_ros.service_state.ServiceState | |
Callable[[Blackboard], Any] | _create_request_handler = create_request_handler |
A function that creates the service request. | |
Callable[[Blackboard, Any], str] | _response_handler = response_handler |
A function that processes the service response. | |
float | _timeout = timeout |
Timeout duration for the service call. | |
Node | _node = node |
The ROS node used to communicate with the service. | |
str | _srv_name = srv_name |
The name of the service to call. | |
Client | _service_client = self._node.create_client(srv_type, srv_name) |
The client used to call the service. | |
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. | |
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. Attributes: service_type (type): The service type being used (AddTwoInts). service_name (str): The name of the service. outcomes (list): The list of possible outcomes for this state.
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.
Reimplemented from yasmin_ros.service_state.ServiceState.
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 |