as2fm.scxml_converter.scxml_entries.scxml_root.ScxmlRoot
- class as2fm.scxml_converter.scxml_entries.scxml_root.ScxmlRoot(name: str)
Bases:
ScxmlBase
This class represents a whole scxml model, that is used to define specific skills.
- __init__(name: str)
Methods
__init__
(name)add_action_thread
(action_thread)add_bt_port_declaration
(bt_port_decl)Add a BT port declaration to the handler.
add_ros_declaration
(ros_declaration)add_state
(state, *[, initial])Append a state to the list of states in the SCXML model.
add_targets_to_scxml_sends
(events_to_targets)For each "ScxmlSend" instance, add the names of the automata receiving the sent event.
append_bt_child_id
(child_id)Append a child ID to the list of child IDs.
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_scxml_file
(xml_file, custom_data_types)Create a ScxmlRoot object from an SCXML file.
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 ScxmlRoot object from an XML tree.
get_body
()Get the body of the object.
Get the ID of the BT plugin instance, if any.
Get information about the BT ports in the model.
Get the container with custom data types.
get_data_model
()get_id
()Get the ID of the object.
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 tag name of the XML element.
Generate the set of events that are expected by the SCXML automaton.
Get the xml_element this object was made from.
Instantiate the values of BT ports and children IDs in the SCXML entries.
Check whether there are ROS or BT specific tags in the SCXML model.
set_bt_plugin_id
(instance_id)Update all BT-related events to use the assigned instance ID.
set_bt_port_value
(port_name, port_value)Set the value of an input port.
set_bt_ports_values
(ports_values)Set the values of multiple input ports.
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 all internal ROS specific entries to plain SCXML.
update_bt_ports_values
(bt_ports_handler)Update the values of potential entries making use of BT ports.
- add_bt_port_declaration(bt_port_decl: BtInputPortDeclaration | BtOutputPortDeclaration)
Add a BT port declaration to the handler.
- 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_targets_to_scxml_sends(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.
- append_bt_child_id(child_id: int)
Append a child ID to the list of child IDs.
- as_plain_scxml(struct_declarations, ros_declarations) List
Convert the object to its plain SCXML version.
- as_xml(**kwargs) _Element
Convert the object to an XML element.
- check_validity() bool
Check if the object is valid.
- static from_scxml_file(xml_file: str, custom_data_types: Dict[str, StructDefinition]) ScxmlRoot
Create a ScxmlRoot object from an SCXML file.
- 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]) ScxmlRoot
Create a ScxmlRoot object from an XML tree.
- get_body()
Get the body of the object.
- get_bt_plugin_id() int | None
Get the ID of the BT plugin instance, if any.
- get_bt_ports_types_values() List[Tuple[str, str, str]]
Get information about the BT ports in the model.
- Returns:
A list of Tuples containing bt_port_name, type and value.
- get_custom_data_types() Dict[str, StructDefinition]
Get the container with custom data types.
- get_id() str
Get the ID of the object.
- 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.
- static get_tag_name() str
Get the tag name of the XML element.
- 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.
- instantiate_bt_information()
Instantiate the values of BT ports and children IDs in the SCXML entries.
- is_plain_scxml() bool
Check whether there are ROS or BT specific tags in the SCXML model.
- set_bt_plugin_id(instance_id: int) None
Update all BT-related events to use the assigned instance ID.
- set_bt_port_value(port_name: str, port_value: str)
Set the value of an input port.
- set_bt_ports_values(ports_values: List[Tuple[str, str]])
Set the values of multiple input ports.
- 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.
- to_plain_scxml_and_declarations() Tuple[List[ScxmlRoot], ScxmlRosDeclarationsContainer]
Convert all internal ROS specific entries to plain SCXML.
- Returns:
A tuple with: - a list of ScxmlRoot objects with all ROS specific entries converted to plain SCXML - The Ros declarations contained in the original SCXML object
- update_bt_ports_values(bt_ports_handler)
Update the values of potential entries making use of BT ports.