as2fm.scxml_converter.ascxml_extensions.ros_entries.scxml_ros_action_client.RosActionHandleGoalResponse
- class as2fm.scxml_converter.ascxml_extensions.ros_entries.scxml_ros_action_client.RosActionHandleGoalResponse(action_client: str | RosActionClient, accept_target: str, reject_target: str)
Bases:
RosCallbackSCXML object representing the handler of an action response upon a goal request.
A server might accept or refuse a goal request, based on its internal state. This handler is meant to handle both acceptance or refusal of a request. Translating this to plain-SCXML, it results to two conditional transitions.
- __init__(action_client: str | RosActionClient, accept_target: str, reject_target: str) None
Initialize a new RosActionHandleGoalResponse object.
- Parameters:
action_client – Action client used by this handler, or its name.
accept_target – State to transition to, in case of goal acceptance.
reject_target – State to transition to, in case of goal refusal.
Methods
__init__(action_client, accept_target, ...)Initialize a new RosActionHandleGoalResponse object.
add_event(event)add_targets_to_scxml_sends(events_to_targets)For each "ScxmlSend" entry in the transition body, add the automata receiving the event.
append_body_executable_entry(exec_entry)Append a executable body entry if this has only one target.
as_plain_scxml(struct_declarations, ...)Convert the object to its plain SCXML version.
as_xml()Convert the ROS callback to an XML element.
check_interface_defined(ascxml_declarations)Check if the ROS interface used in the callback exists.
Check if the object is valid.
contains_transition_target(xml_tree)Check if the children of the ScxmlTransition contain ScxmlTransitionTarget tags.
from_xml_tree(xml_tree, custom_data_types, ...)External interface to create a ScxmlBase object from an XML tree.
from_xml_tree_impl(xml_tree, _)Create a RosServiceServer object from an XML tree.
Return the callback type of a specific ROS Callback subclass
Return the condition required to execute this transition (if any).
Get all events for requesting and receiving the updated configurable values.
Get the container with custom data types.
Get the type of ROS declaration related to the callback.
Return the events that trigger this transition (if any).
get_interface_name(interface_decl)Extract the interface name from either a string or a RosDeclaration.
get_plain_scxml_event(ascxml_declaration)Translate the ROS interface name to a plain scxml event.
get_related_interface(ascxml_declarations)Find the declared interface related to this callback.
XML tag name for the ROS callback type.
Return all targets belonging to this transition.
Get the xml_element this object was made from.
is_plain_scxml([verbose])Check if the transition is a plain scxml entry and contains only plain scxml.
load_transition_targets_from_xml(xml_tree, ...)Loads all transition targets contained in the transition-like tags.
make_single_target_transition(...[, ...])Generate a RosCallback with exactly one target, like in vanilla SCXML.
Replace the string literals in the transition condition and the different targets.
set_custom_data_types(custom_data_types)Save container with custom data types.
set_targets(new_targets)Set the targets of the transition.
set_xml_origin(xml_origin)Set the xml_element this object was made from.
update_exec_body_configurable_values(...)- add_targets_to_scxml_sends(events_to_targets: Dict[str, Set[str]])
For each “ScxmlSend” entry in the transition body, add the automata receiving the event.
- append_body_executable_entry(exec_entry: ScxmlExecutableEntry)
Append a executable body entry if this has only one target.
If this transition has not exactly one target, this will raise an AssertionError.
- as_plain_scxml(struct_declarations: ScxmlStructDeclarationsContainer, ascxml_declarations: List[AscxmlDeclaration], **kwargs) List[ScxmlBase]
Convert the object to its plain SCXML version.
- Parameters:
struct_declarations – List of custom structures defined in the model
ascxml_declarations – Additional declarations, like ROS or BT specific ones
kwargs – Additional framework specific entries, e.g. the BT plugin ID.
- as_xml() _Element
Convert the ROS callback to an XML element.
- check_interface_defined(ascxml_declarations: List[AscxmlDeclaration]) bool
Check if the ROS interface used in the callback exists.
- check_validity() bool
Check if the object is valid.
- static contains_transition_target(xml_tree: _Element) bool
Check if the children of the ScxmlTransition contain ScxmlTransitionTarget tags.
- classmethod from_xml_tree(xml_tree: _Element, custom_data_types: Dict[str, StructDefinition], **kwargs) Self
External interface to create a ScxmlBase object from an XML tree.
- classmethod from_xml_tree_impl(xml_tree: _Element, _: Dict[str, StructDefinition]) RosActionHandleGoalResponse
Create a RosServiceServer object from an XML tree.
- classmethod get_callback_prefixes()
Return the callback type of a specific ROS Callback subclass
- get_condition() str | None
Return the condition required to execute this transition (if any).
- get_config_request_receive_events() List[Tuple[str, str]]
Get all events for requesting and receiving the updated configurable values.
- get_custom_data_types() Dict[str, StructDefinition]
Get the container with custom data types.
- classmethod get_declaration_type() Type[RosDeclaration]
Get the type of ROS declaration related to the callback.
Examples: RosSubscriber, RosPublisher, …
- get_events() List[str]
Return the events that trigger this transition (if any).
- classmethod get_interface_name(interface_decl: str | RosDeclaration) str
Extract the interface name from either a string or a RosDeclaration.
- Parameters:
interface_decl – The interface declaration to extract the information from.
- Returns:
A string providing the alias for the communication interface within the model.
- get_plain_scxml_event(ascxml_declaration: AscxmlDeclaration)
Translate the ROS interface name to a plain scxml event.
Find the declared interface related to this callback.
- static get_tag_name() str
XML tag name for the ROS callback type.
- get_targets() List[ScxmlTransitionTarget]
Return all targets belonging to this transition.
- get_xml_origin() _Element | None
Get the xml_element this object was made from.
- is_plain_scxml(verbose: bool = False) bool
Check if the transition is a plain scxml entry and contains only plain scxml.
- classmethod load_transition_targets_from_xml(xml_tree: _Element, custom_data_types: Dict[str, StructDefinition]) List[ScxmlTransitionTarget]
Loads all transition targets contained in the transition-like tags.
- classmethod make_single_target_transition(interface_decl: str | RosDeclaration, target: str, condition: str | None = None, body: List[ScxmlExecutableEntry] | None = None) Self
Generate a RosCallback with exactly one target, like in vanilla SCXML.
- Parameters:
interface_decl – The ROS declaration this Callback refers to.
target – The state to transition to once the callback is executed.
condition – The condition that enables this callback.
body – The operations to execute when running this callback.
- replace_strings_types_with_integer_arrays() None
Replace the string literals in the transition condition and the different targets.
- set_custom_data_types(custom_data_types: Dict[str, StructDefinition])
Save container with custom data types.
- set_targets(new_targets: List[ScxmlTransitionTarget])
Set the targets of the transition.
Additionally, calculates potentially remaining probabilities and checks they sum to one.
- set_xml_origin(xml_origin: _Element)
Set the xml_element this object was made from.