as2fm.scxml_converter.scxml_entries.scxml_bt_base.BtGenericStatusHandle
- class as2fm.scxml_converter.scxml_entries.scxml_bt_base.BtGenericStatusHandle(child_seq_id: str | int, targets: List[ScxmlTransitionTarget], condition: str | None = None)
Bases:
ScxmlTransition
Process a generic response received from a BT child.
- __init__(child_seq_id: str | int, targets: List[ScxmlTransitionTarget], condition: str | None = None)
Generate an instance of a handler for a generic BT Child reply.
- Parameters:
child_seq_id – Which BT child is the response related to.
targets – The targets to use for transitioning to new states.
condition – The condition to check before transitioning.
Methods
__init__
(child_seq_id, targets[, condition])Generate an instance of a handler for a generic BT Child reply.
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 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, custom_data_types, ...)External interface to create a ScxmlBase object from an XML tree.
from_xml_tree_impl
(xml_tree, custom_data_types)Create a ScxmlTransition object from an XML tree.
generate_bt_event_name
(instance_id)Generate the plain scxml event associated to the BT Transition instance_id.
get_body
()Get the body of the object.
Return the condition required to execute this transition (if any).
Get the container with custom data types.
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.
Get the xml_element this object was made from.
has_bt_blackboard_input
(bt_ports_handler)Check if the transition contains references to blackboard inputs.
instantiate_bt_events
(instance_id, children_ids)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
(child_seq_id, ...)Generate a BtGenericStatusHandle with exactly one target.
set_custom_data_types
(custom_data_types)Save container with custom data types.
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.
set_xml_origin
(xml_origin)Set the xml_element this object was made from.
update_bt_ports_values
(bt_ports_handler)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(struct_declarations: ScxmlStructDeclarationsContainer, 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.
- 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, custom_data_types: Dict[str, StructDefinition]) BtGenericStatusHandle
Create a ScxmlTransition object from an XML tree.
- classmethod generate_bt_event_name(instance_id: int)
Generate the plain scxml event associated to the BT Transition instance_id.
- get_body()
Get the body of the object.
- get_condition() str | None
Return the condition required to execute this transition (if any).
- get_custom_data_types() Dict[str, StructDefinition]
Get the container with custom data types.
- get_events() List[str]
Return the events that trigger this transition (if any).
- get_id() str
Get the ID of the object.
- classmethod get_tag_name()
Get the tag name of the XML element.
- 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.
- has_bt_blackboard_input(bt_ports_handler: BtPortsHandler)
Check if the transition contains references to blackboard inputs.
- instantiate_bt_events(instance_id: int, children_ids: List[int]) List[ScxmlTransition]
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, custom_data_types: Dict[str, StructDefinition]) List[ScxmlTransitionTarget]
Loads all transition targets contained in the transition-like tags.
- classmethod make_single_target_transition(child_seq_id: str | int, target: str, condition: str | None = None, body: List[ScxmlAssign | ScxmlIf | ScxmlSend] | None = None)
Generate a BtGenericStatusHandle with exactly one target.
- Parameters:
child_seq_id – From which BT children ID we receive the response.
target – The state transition goes to. Required (unlike in SCXML specifications)
condition – The condition guard to enable/disable the transition
body – Content that is executed when the transition happens
- 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_thread_id(thread_id: int) None
Set the thread ID for the executable entries of this transition.
- set_xml_origin(xml_origin: _Element)
Set the xml_element this object was made from.
- update_bt_ports_values(bt_ports_handler: BtPortsHandler) None
Update the values of potential entries making use of BT ports.