as2fm.jani_generator.ros_helpers.ros_service_handler.RosServiceHandler

class as2fm.jani_generator.ros_helpers.ros_service_handler.RosServiceHandler

Bases: RosCommunicationHandler

Object storing the declarations related to a ROS Service and creating an handler for them.

__init__()

Initialize the object completely empty.

Methods

__init__()

Initialize the object completely empty.

add_client(interface_name, interface_type, ...)

Set the client of the service.

generate_transition_from_processing_state(...)

Generate a transition from the processing state to the waiting state for a given client.

generate_transition_to_processing_state(...)

Generate a transition from the waiting state to the processing state for a given client.

get_interface_prefix()

Get the prefix used for the interface.

set_server(interface_name, interface_type, ...)

Set the server of the ROS interface.

to_scxml()

Generate the srv_handler automaton that implements the link between the server of this service and its clients.

add_client(interface_name: str, interface_type: str, automaton_name: str) None

Set the client of the service. There must be one or more.

Interface_name:

The name of the ROS interface.

Interface_type:

The type of the ROS interface (e.g. std_srvs/SetBool).

Automaton_name:

The name of the JANI automaton that implements this client.

generate_transition_from_processing_state(client_id: str, res_fields: Dict[str, str]) ScxmlTransition

Generate a transition from the processing state to the waiting state for a given client.

generate_transition_to_processing_state(client_id: str, req_fields: Dict[str, str]) ScxmlTransition

Generate a transition from the waiting state to the processing state for a given client.

Parameters:
  • client_id – The id of the client to generate the transition for.

  • req_fields – The fields of the request to be assigned to the data model.

Returns:

The generated transition.

static get_interface_prefix() str

Get the prefix used for the interface.

Returns:

The prefix used for the interface.

set_server(interface_name: str, interface_type: str, automaton_name: str) None

Set the server of the ROS interface. There must be exactly one.

Interface_name:

The name of the ROS interface.

Interface_type:

The type of the ROS interface (e.g. std_srvs/SetBool).

Automaton_name:

The name of the JANI automaton that implements this server.

to_scxml() ScxmlRoot

Generate the srv_handler automaton that implements the link between the server of this service and its clients. This ensures that only one request can be processed at the time and that the client receives only the response related to it’s request.

Returns:

Scxml object representing the necessary file content.