as2fm.scxml_converter.scxml_entries.scxml_ros_action_client.RosActionHandleGoalResponse
- class as2fm.scxml_converter.scxml_entries.scxml_ros_action_client.RosActionHandleGoalResponse(action_client: str | RosActionClient, accept_target: str, reject_target: str)
Bases:
ScxmlTransition
SCXML 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
(ros_declarations)Convert the object to its plain SCXML version.
as_xml
()Convert the object to an XML element.
check_valid_ros_instantiations
(ros_declarations)Check if the ros instantiations have been declared.
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)Create a RosServiceServer object from an XML tree.
get_body
()Get the body of the object.
Return the condition required to execute this transition (if any).
Return the events that trigger this transition (if any).
get_id
()Get the ID of the object.
Get the tag name of the XML element.
Return all targets belonging to this transition.
This can not have a body, so it can not have BT blackboard input.
instantiate_bt_events
(_, __)Instantiate the BT events of this transition.
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
(target[, ...])Generate a "traditional" transition with exactly one target.
set_targets
(new_targets)Set the targets of the transition.
set_thread_id
(thread_id)Set the thread ID for the executable entries of this transition.
Update the values of potential entries making use of BT ports.
- 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: ScxmlAssign | ScxmlIf | ScxmlSend)
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(ros_declarations: ScxmlRosDeclarationsContainer) List[ScxmlTransition]
Convert the object to its plain SCXML version.
- as_xml() Element
Convert the object to an XML element.
- check_valid_ros_instantiations(ros_declarations: ScxmlRosDeclarationsContainer) bool
Check if the ros instantiations have been declared.
- 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.
- static from_xml_tree(xml_tree: Element) RosActionHandleGoalResponse
Create a RosServiceServer object from an XML tree.
- get_body()
Get the body of the object.
- get_condition() str | None
Return the condition required to execute this transition (if any).
- get_events() List[str]
Return the events that trigger this transition (if any).
- get_id() str
Get the ID of the object.
- static get_tag_name() str
Get the tag name of the XML element.
- get_targets() List[ScxmlTransitionTarget]
Return all targets belonging to this transition.
- has_bt_blackboard_input(_) bool
This can not have a body, so it can not have BT blackboard input.
- instantiate_bt_events(_, __) List[RosActionHandleGoalResponse]
Instantiate the BT events of this transition.
- is_plain_scxml() bool
Check if the transition is a plain scxml entry and contains only plain scxml.
- classmethod load_transition_targets_from_xml(xml_tree: Element) List[ScxmlTransitionTarget]
Loads all transition targets contained in the transition-like tags.
- static make_single_target_transition(target: str, events: List[str] | None = None, condition: str | None = None, body: List[ScxmlAssign | ScxmlIf | ScxmlSend] | None = None)
Generate a “traditional” transition with exactly one target.
- Parameters:
target – The state transition goes to. Required (unlike in SCXML specifications)
events – The events that trigger this transition.
condition – The condition guard to enable/disable the transition
body – Content that is executed when the transition happens
- set_targets(new_targets: List[ScxmlTransitionTarget])
Set the targets of the transition.
Additionally, calculates potentially remaining probabilities and checks they sum to one.
- set_thread_id(thread_id: int) None
Set the thread ID for the executable entries of this transition.
- update_bt_ports_values(_) None
Update the values of potential entries making use of BT ports.