ros2_snapshot.core.ros_model module
A model of ROS system deployment as banks of metamodel instances.
- class ros2_snapshot.core.ros_model.BankType(*values)
Bases:
EnumEnumerated type for Bank identifiers.
- ACTION = 3
- ACTION_SPECIFICATION = 11
- MACHINE = 6
- MESSAGE_SPECIFICATION = 9
- NODE = 1
- NODE_SPECIFICATION = 8
- PACKAGE_SPECIFICATION = 7
- PARAMETER = 5
- SERVICE = 4
- SERVICE_SPECIFICATION = 10
- TOPIC = 2
- class ros2_snapshot.core.ros_model.ROSModel(bank_dictionary)
Bases:
objectThe ROS Model class definition.
- BANK_TYPES_TO_BANK_CLASS = {BankType.ACTION: <class 'ros2_snapshot.core.deployments.action.ActionBank'>, BankType.ACTION_SPECIFICATION: <class 'ros2_snapshot.core.specifications.type_specification.TypeSpecification'>, BankType.MACHINE: <class 'ros2_snapshot.core.deployments.machine.MachineBank'>, BankType.MESSAGE_SPECIFICATION: <class 'ros2_snapshot.core.specifications.type_specification.TypeSpecification'>, BankType.NODE: <class 'ros2_snapshot.core.deployments.node.NodeBank'>, BankType.NODE_SPECIFICATION: <class 'ros2_snapshot.core.specifications.node_specification.NodeSpecificationBank'>, BankType.PACKAGE_SPECIFICATION: <class 'ros2_snapshot.core.specifications.package_specification.PackageSpecificationBank'>, BankType.PARAMETER: <class 'ros2_snapshot.core.deployments.parameter.ParameterBank'>, BankType.SERVICE: <class 'ros2_snapshot.core.deployments.service.ServiceBank'>, BankType.SERVICE_SPECIFICATION: <class 'ros2_snapshot.core.specifications.type_specification.TypeSpecification'>, BankType.TOPIC: <class 'ros2_snapshot.core.deployments.topic.TopicBank'>}
- BANK_TYPES_TO_OUTPUT_NAMES = {BankType.ACTION: 'action_bank', BankType.ACTION_SPECIFICATION: 'action_specification_bank', BankType.MACHINE: 'machine_bank', BankType.MESSAGE_SPECIFICATION: 'message_specification_bank', BankType.NODE: 'node_bank', BankType.NODE_SPECIFICATION: 'node_specification_bank', BankType.PACKAGE_SPECIFICATION: 'package_specification_bank', BankType.PARAMETER: 'parameter_bank', BankType.SERVICE: 'service_bank', BankType.SERVICE_SPECIFICATION: 'service_specification_bank', BankType.TOPIC: 'topic_bank'}
- DEPLOYMENT_TYPES = []
- SPECIFICATION_TYPES = [BankType.PACKAGE_SPECIFICATION, BankType.NODE_SPECIFICATION, BankType.MESSAGE_SPECIFICATION, BankType.SERVICE_SPECIFICATION, BankType.ACTION_SPECIFICATION]
- property action_bank
Return action bank.
- property action_specification_bank
Return action specification bank.
- static get_yaml_processors()
Return YAML handler.
- property items
Return key, value list of model bank dictionary.
- property keys
Return keys to model bank dictionary.
- static load_model(input_directory, spec_only=False)
Load model from folder.
- Parameters:
input_directory – the input directory pointing to either yaml, json, or pickle files (e.g. output/yaml)
- Returns:
ROSModel instance with models stored in dictionary by type
- property machine_bank
Return machine bank.
- property message_specification_bank
Return message specification bank.
- property node_bank
Return node bank.
- property node_specification_bank
Return node specification bank.
- property package_specification_bank
Return package specification bank.
- property parameter_bank
Return parameter bank.
- static read_model_from_json(directory_path, base_file_name, spec_only=False)
Read model banks from directory containing JSON files.
- Parameters:
directory_path – file path to JSON files
base_file_name – base file name used in JSON files
:return : instance of ROSModel
- static read_model_from_pickle(directory_path, base_file_name, spec_only=False)
Read model banks from directory containing Pickle files.
- Parameters:
directory_path – file path to Pickle files
base_file_name – base file name used in Pickle files
:return : instance of ROSModel
- static read_model_from_yaml(directory_path, base_file_name, spec_only=False)
Read model banks from directory containing YAML files.
- Parameters:
directory_path – file path to YAML files
base_file_name – base file name used in YAML files
:return : instance of ROSModel
- save_dot_graph_files(directory_path, file_name, show_graph=True)
Save the ROS model computation graph to DOT file format.
:param directory_path : directory to store files :param file_name: file name of the graph data :param show_graph: show output when complete :return: None
- save_model_info_files(directory_path, base_file_name)
Save the ROS model to human-readable files.
:param directory_path : directory to store files :param base_file_name: file name string :return:
- save_model_json_files(directory_path, base_file_name)
Save the ROS bank metamodel instances to json files (preferred by Pydantic).
:param directory_path : directory to store files :param base_file_name: :return: None
- save_model_pickle_files(directory_path, base_file_name)
Save the ROS bank metamodel instances to Pickle files.
:param directory_path : directory to store files :param base_file_name: :return: None
- save_model_yaml_files(directory_path, base_file_name)
Save the ROS bank metamodel instances to yaml files.
:param directory_path : directory to store files :param base_file_name: :return: None
- property service_bank
Return service bank.
- property service_specification_bank
Return service specification bank.
- property topic_bank
Return topic bank.
- update_bank(bank_type, bank_dictionary)
Add a new bank data to ROS model.
- Parameters:
bank_type – a BankType
bank_dictionary – dictionary of name to entity instances