as2fm.scxml_converter.scxml_entries.scxml_root.GenericScxmlRoot
- class as2fm.scxml_converter.scxml_entries.scxml_root.GenericScxmlRoot(name: str)
Bases:
ScxmlBaseGeneric container for the (A)Scxml models.
- __init__(name: str)
Methods
__init__(name)add_state(state, *[, initial])Append a state to the list of states in the SCXML model.
add_target_to_event_send(events_to_targets)For each "ScxmlSend" instance, add the names of the automata receiving the sent event.
as_plain_scxml(struct_declarations, ...)Convert the object to its plain SCXML version.
as_xml(**kwargs)Convert the object to an XML element.
as_xml_string(**kwargs)Check if the object is valid.
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 GenericScxmlRoot object from an XML tree.
Get the container with custom data types.
get_data_model()List the supported AscxmlDeclaration classes related to the specific ASCXML class loader.
Get all the declarations contained in the (A)SCXML model.
Get the expected file extension depending on the specific root tag (scxml vs ascxml).
Get the ID of the initial state of the SCXML model.
get_name()Get the name of the automaton represented by this SCXML model.
get_state_by_id(state_id)get_states()Get the expected tag name related to this class.
List the supported AscxmlThread classes related to the specific ASCXML class loader.
Get the threads in the (A)SCXML model.
Generate the set of events that are expected by the SCXML automaton.
Get the xml_element this object was made from.
is_plain_scxml([verbose])Check whether there are ROS or BT specific tags in the SCXML model.
load_scxml_file(xml_file, custom_data_types)Create a GenericScxmlRoot instance from an ASCXML file.
Replace all occurrences of strings in the datamodel and the expressions with array of int.
set_custom_data_types(custom_data_types)Save container with custom data types.
set_data_model(data_model)set_name(name)Rename the automaton represented by this SCXML model.
set_xml_origin(xml_origin)Set the xml_element this object was made from.
Convert a GenericScxmlRoot object to ScxmlRoot ones, that are framework agnostic.
- add_state(state: ScxmlState, *, initial: bool = False)
Append a state to the list of states in the SCXML model. If initial is True, set it as the initial state.
- add_target_to_event_send(events_to_targets: Dict[str, Set[str]]) None
For each “ScxmlSend” instance, add the names of the automata receiving the sent event.
- Parameters:
events_to_targets – Mapping between the event name and the automata recipients.
- as_plain_scxml(struct_declarations, ascxml_declarations, **kwargs)
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(**kwargs) _Element
Convert the object to an XML element.
- check_validity() bool
Check if the object is valid.
- 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, custom_data_types: Dict[str, StructDefinition]) Self
Create a GenericScxmlRoot object from an XML tree.
- get_custom_data_types() Dict[str, StructDefinition]
Get the container with custom data types.
- abstract classmethod get_declaration_classes() List[Type[AscxmlDeclaration]]
List the supported AscxmlDeclaration classes related to the specific ASCXML class loader.
E.g. ASCXML for ROS nodes can support topic, service, actions and timers. ASCXML for BT plugins, can support the ROS declarations plus BT ports. Plain SCXML, has no additional declaration class to support.
- get_declarations() List[AscxmlDeclaration]
Get all the declarations contained in the (A)SCXML model.
- classmethod get_file_extension() str
Get the expected file extension depending on the specific root tag (scxml vs ascxml).
- get_initial_state_id() str
Get the ID of the initial state of the SCXML model.
- get_name() str
Get the name of the automaton represented by this SCXML model.
- abstract classmethod get_tag_name() str
Get the expected tag name related to this class.
- abstract classmethod get_thread_classes() List[Type[AscxmlThread]]
List the supported AscxmlThread classes related to the specific ASCXML class loader.
E.g. ASCXML for ROS nodes can action threads, as well as BT plugins. Plain SCXML, has no additional thread class to support.
- get_threads() List[AscxmlThread]
Get the threads in the (A)SCXML model.
- get_transition_events() Set[str]
Generate the set of events that are expected by the SCXML automaton.
- get_xml_origin() _Element | None
Get the xml_element this object was made from.
- is_plain_scxml(verbose: bool = False) bool
Check whether there are ROS or BT specific tags in the SCXML model.
- classmethod load_scxml_file(xml_file: str, custom_data_types: Dict[str, StructDefinition]) Self
Create a GenericScxmlRoot instance from an ASCXML file.
- replace_strings_types_with_integer_arrays() None
Replace all occurrences of strings in the datamodel and the expressions with array of int.
- set_custom_data_types(custom_data_types: Dict[str, StructDefinition])
Save container with custom data types.
- set_name(name: str) None
Rename the automaton represented by this SCXML model.
- set_xml_origin(xml_origin: _Element)
Set the xml_element this object was made from.