ros2_snapshot.snapshot.builders package
Submodules
- ros2_snapshot.snapshot.builders.action_bank_builder module
- ros2_snapshot.snapshot.builders.action_builder module
ActionBuilderActionBuilder.CLIENT_PUBLISHED_TOPIC_SUFFIXESActionBuilder.CORE_TOPIC_SUFFIXES_TO_TYPE_TOKENSActionBuilder.NUM_TOPIC_SUFFIXESActionBuilder.SERVER_PUBLISHED_TOPIC_SUFFIXESActionBuilder.TOPIC_SUFFIXESActionBuilder.add_info()ActionBuilder.add_topic_builder()ActionBuilder.client_node_namesActionBuilder.construct_typeActionBuilder.extract_metamodel()ActionBuilder.get_node_infoActionBuilder.prepare()ActionBuilder.server_node_namesActionBuilder.test_potential_action_topic_builder()ActionBuilder.topic_name_suffixes_to_buildersActionBuilder.topic_names_to_buildersActionBuilder.validate_action_topic_builders()
- ros2_snapshot.snapshot.builders.base_builders module
- ros2_snapshot.snapshot.builders.machine_bank_builder module
- ros2_snapshot.snapshot.builders.machine_builder module
- ros2_snapshot.snapshot.builders.node_bank_builder module
- ros2_snapshot.snapshot.builders.node_builder module
NodeBuilderNodeBuilder.action_clientsNodeBuilder.action_serversNodeBuilder.add_action_client()NodeBuilder.add_action_server()NodeBuilder.add_info()NodeBuilder.add_parameter_name()NodeBuilder.add_service_name_and_type()NodeBuilder.add_topic_name()NodeBuilder.all_topic_namesNodeBuilder.executable_cmdlineNodeBuilder.executable_cpu_percentNodeBuilder.executable_fileNodeBuilder.executable_memory_infoNodeBuilder.executable_memory_percentNodeBuilder.executable_nameNodeBuilder.executable_num_threadsNodeBuilder.extract_metamodel()NodeBuilder.get_node_pid()NodeBuilder.get_processes()NodeBuilder.machineNodeBuilder.namespaceNodeBuilder.nodeNodeBuilder.parameter_namesNodeBuilder.prepare()NodeBuilder.published_topic_namesNodeBuilder.remove_topic_name()NodeBuilder.service_namesNodeBuilder.service_names_to_typesNodeBuilder.service_names_with_remapNodeBuilder.set_comp_yaml()NodeBuilder.set_component_list()NodeBuilder.set_manager_yaml()NodeBuilder.set_node_name()NodeBuilder.subscribed_topic_namesNodeBuilder.topic_names_to_types
- ros2_snapshot.snapshot.builders.parameter_bank_builder module
- ros2_snapshot.snapshot.builders.parameter_builder module
- ros2_snapshot.snapshot.builders.service_bank_builder module
- ros2_snapshot.snapshot.builders.service_builder module
- ros2_snapshot.snapshot.builders.topic_bank_builder module
- ros2_snapshot.snapshot.builders.topic_builder module
TopicBuilderTopicBuilder.add_node_name()TopicBuilder.construct_typeTopicBuilder.endpoint_typeTopicBuilder.extract_metamodel()TopicBuilder.get_verbose_info()TopicBuilder.gid_informationTopicBuilder.publisher_node_namesTopicBuilder.qos_profileTopicBuilder.set_gid_dict()TopicBuilder.subscriber_node_namesTopicBuilder.topic_hash
Module contents
Define exports for this sub-package.
- class ros2_snapshot.snapshot.builders.ActionBankBuilder
Bases:
_BankBuilderDefine an ActionBankBuilder.
ActionBankBuilder is responsible for collecting, maintaining, and populating ActionBuilders for the purpose of extracting metamodel instances
- class ros2_snapshot.snapshot.builders.ActionBuilder(name)
Bases:
_EntityBuilderDefine an ActionBuilder.
ActionBuilder represents a ROS Action and is responsible for allowing itself to be populated with basic information relevant to an Action and then further populating itself from that information for the purpose of extracting a metamodel instance
- CLIENT_PUBLISHED_TOPIC_SUFFIXES = {'/cancel', '/goal'}
- CORE_TOPIC_SUFFIXES_TO_TYPE_TOKENS = {'/feedback': 'Feedback', '/goal': 'Goal', '/result': 'Result'}
- NUM_TOPIC_SUFFIXES = 5
- SERVER_PUBLISHED_TOPIC_SUFFIXES = {'/feedback', '/result', '/status'}
- TOPIC_SUFFIXES = {'/cancel', '/feedback', '/goal', '/result', '/status'}
- add_info(action_information)
Collect information and sort it into respective attributes.
- Action_information:
all known information about an action, including clients and servers
- add_topic_builder(topic_builder)
Add a TopicBuilder that represents the Topic.
- Parameters:
topic_builder (TopicBuilder) – the TopicBuilder to add to the Action
- property client_node_names
Return the names of Client ROS Nodes for this Action.
- Returns:
the names of Client ROS Nodes for this Action
- Return type:
set{str}
- property construct_type
Return this Action’s ROS type.
- Returns:
this Action’s ROS type
- Return type:
str
- extract_metamodel()
Extract metamodel.
Allows the ActionBuilder to create / extract an Action instance from its internal state
- Returns:
the created / extracted metamodel instance
- Return type:
- property get_node_info
Return this Action’s ROS client / server information.
- Returns:
clients, servers
- Return type:
tuple(set(), set())
- prepare(**kwargs)
Prepare ActionBuilder internal state.
for eventual metamodel extraction; internal changes to the state of the class instance occur here
- Parameters:
kwargs (dict{param: value}) – keyword arguments used in the preparation process
- property server_node_names
Return the names of Server ROS Nodes for this Action.
- Returns:
the names of Server ROS Nodes for this Action
- Return type:
set{str}
- classmethod test_potential_action_topic_builder(action_topic)
Verify whether a potential Action TopicBuilder has a name suffix.
Checks if suffix that falls within the set of expected Action Topic suffixes.
- Parameters:
action_topic (TopicBuilder) – the potential Action TopicBuilder to test
- Returns:
True if the TopicBuilder’s name suffix falls in the expected Action Topic suffixes; False if not
- Return type:
bool
- property topic_name_suffixes_to_builders
Return the mapping of Topic name suffixes (last token) to TopicBuilders.
TopicBuilders represent the Topics that are part of the Action
- Returns:
the mapping of Topic suffix names to TopicBuilders
- Return type:
dict{str: TopicBuilder}
- property topic_names_to_builders
Return the mapping of Topic names to TopicBuilders.
TopicBuilders represent the Topics that are part of the Action
- Returns:
the mapping of Topic names to TopicBuilders
- Return type:
dict{str: TopicBuilder}
- validate_action_topic_builders()
Verify if the TopicBuilders are valid.
Verify that make up this Action are, in fact, valid and should actually make up this Action
- Returns:
True if the TopicBuilders are valid; False if not
- Return type:
bool
- class ros2_snapshot.snapshot.builders.MachineBankBuilder
Bases:
_BankBuilderDefine a MachineBankBuilder.
which is responsible for collecting,
maintaining, and populating MachineBuilders for the purpose of extracting metamodel instances
- prepare(**kwargs)
Prepare the internal MachineBankBuilder based on identified nodes.
Used for eventual metamodel extraction; internal changes to the state of the *EntityBuilders occur for the builders that are stored in the internal bank
- Parameters:
kwargs (dict{param: value}) – keyword arguments needed by the underlying *EntityBuilders used in the preparation process
- class ros2_snapshot.snapshot.builders.MachineBuilder(name)
Bases:
_EntityBuilderDefine a MachineBuilder.
- Represents a host machine running ROS nodes
and is responsible for allowing itself to be
populated with basic information relevant to a Machine and then further populating itself from that information for the purpose of extracting a metamodel instance
- add_node_name(node_name)
Associate the name of a ROS Node to this machine.
- Parameters:
node_name (str) – the name of the ROS Node
- extract_metamodel()
Create/extract a MachineBuilder instance.
Machine instance from its internal state
- Returns:
the created / extracted metamodel instance
- Return type:
- property hostname
Return the hostname of machine on network.
- Returns:
hostname on network
- Return type:
str
- property ip_address
Return the ip address of given machine on network.
- Returns:
ip address of machine
- Return type:
str
- property node_names
Return the collection of names of the ROS Nodes.
Only those that have set a value for this Parameter
- Returns:
the collection of names of the ROS Nodes that have set a value for this Parameter
- Return type:
set{str}
- class ros2_snapshot.snapshot.builders.NodeBankBuilder
Bases:
_BankBuilderDefine a NodeBankBuilder.
Responsible for collecting, maintaining, and populating NodeBuilders for the purpose of extracting metamodel instances
- extract_node_bank_metamodel()
Extract and return an instance of the NodeBank.
Extracted and populated from this builder (built by this builder); only pure Node instances (no subtypes) are part of this bank
- Returns:
an extracted instance of this builder’s NodeBank
- Return type:
- get_node_builder()
Get node builder.
- class ros2_snapshot.snapshot.builders.NodeBuilder(name)
Bases:
_EntityBuilderDefine a NodeBuilder.
Represents a ROS Node and is responsible for allowing itself to be populated with basic information relevant to a Node and then further populating itself from that information for the purpose of extracting a metamodel instance
- property action_clients
Return the set of Action names for which this ROS Node is a Client.
- Returns:
Action names where this ROS Node is a Client
- Return type:
set{str}
- property action_servers
Return the set of Action names associated to this ROS Node.
- Returns:
Action names where this ROS Node is a Server
- Return type:
set{str}
- add_action_client(action_name)
Add list of action client names to node_bank.
- Action_name:
the action name
- add_action_server(action_name)
Add list of action server names to node_bank.
- Action_name:
the action name
- add_info(node)
Set node name of the builder.
- Node:
the node name of our builder
- add_parameter_name(parameter_name)
Associate parameters with the ROS Node.
- Parameters:
parameter_name (str) – the name of the Parameter
- add_service_name_and_type(service_name, service_type)
Associate the name of a Service with the ROS Node.
- Parameters:
service_name (str) – the name of the associated Service
service_type (str) – the ROS Service type
- add_topic_name(topic_name, status, topic_type, remap)
Associate a ‘published’ or ‘subscribed’ Topic with a ROS Node.
- Parameters:
topic_name (str) – the name of the Topic
status (str) – the relationship or status (‘subscribed’ or ‘published’) of the Topic to the ROS Node
topic_type (str) – the ROS Topic Type
remap – name used by node specification
“type remap: str”
- property all_topic_names
Return the name of all Topics either published or subscribed to by the ROS Node.
Including those that were removed from the basic Published / Subscribed store since they were related to either a Nodelet / Nodelet Manager interaction or an Action
- Returns:
all Topic names
- Return type:
set{str}
- property executable_cmdline
Return the ROS Node executable command line.
- Returns:
the ROS Node executable command line
- Return type:
str
- property executable_cpu_percent
Return the ROS Node executable cpu percent.
- Returns:
the ROS Node executable cpu percent
- Return type:
str
- property executable_file
Return the ROS Node executable.
- Returns:
the ROS Node executable
- Return type:
str
- property executable_memory_info
Return the ROS Node executable memory_info.
- Returns:
the ROS Node executable memory_info
- Return type:
str
- property executable_memory_percent
Return the ROS Node executable memory percent.
- Returns:
the ROS Node executable memory percent
- Return type:
str
- property executable_name
Return the ROS Node executable name.
- Returns:
the ROS Node executable
- Return type:
str
- property executable_num_threads
Return the ROS Node executable number threads.
- Returns:
the ROS Node executable number threads
- Return type:
str
- extract_metamodel()
Extract metamodel.
Allows the NodeBuilder to create / extract either a Node, or Component Manager, instance from its internal state
- Returns:
the created / extracted metamodel instance
- Return type:
Node or ComponentManager
- get_node_pid(namespace, node_name, guess=False)
Return the PID number give node_name.
This is a best effort “fuzzy” process given process names that do not necessarily match node names. It is not based on static code analysis, and needs improvement.
- Returns:
the ROS Node process id
- Return type:
int
- classmethod get_processes()
Return list of processes.
- Returns:
dictionary of system processes data
- Return type:
dict
- property machine
Extract the machine ID from the uri information.
- Returns:
machine ID as string
- property namespace
Return the namespace of this node.
- Returns:
namespace
- Return type:
string
- property node
Return the package/node name of this node.
- Returns:
package/node name
- Return type:
string
- property parameter_names
Return parameter names for metamodel extraction.
- prepare(**kwargs)
Allow this NodeBuilder to prepare its internal state.
Used for eventual metamodel extraction; internal changes to the state of the class instance occur here
- Parameters:
topic_bank_builder (TopicBankBuilder) – the TopicBankBuilder to use for Action-related Topic name removal (from kwargs)
action_bank_builder (ActionBankBuilder) – the ActionBankBuilder to use for Action-related Topic name removal and Action Server / Client reference
- property published_topic_names
Return the names of the Topics published by the ROS Node.
- Returns:
published Topic names
- Return type:
dict{name:remap}
- remove_topic_name(topic_name, status)
Remove either a ‘published’ or ‘subscribed’ association.
Between a Topic name and the ROS Node
- Parameters:
topic_name (str) – the name of the Topic
status (str) – the relationship or status (‘subscribed’ or ‘published’) of the Topic to the ROS Node
- property service_names
Return the name of all Services associated with the ROS Node.
- Returns:
associated Service names
- Return type:
set{str}
- property service_names_to_types
Return the mapping of all Service names to their Service type.
- Returns:
all Service names to their mapped ROS Service Type
- Return type:
dict{str: str}
- property service_names_with_remap
Return the name of all Services associated with the ROS Node.
As dictionary to remapped service id (None at this point)
- Returns:
associated Service names
- Return type:
dict{str:str}
- set_comp_yaml(isTrue, manager_name)
Set Component to true or false.
Used for differentiation later
- Parameters:
isTrue – boolean determined if self.name
found in our @TODO
- set_component_list(components_list)
Set Component list.
@TODO
- set_manager_yaml(isTrue)
Set ComponentManager to true or false.
Used for differentiation later
- Parameters:
isTrue – boolean determined if self.name
found in our :param results: component list results @TODO
- set_node_name(name)
Set the package/node name for this node.
- Parameters:
name – package/node name
- property subscribed_topic_names
Return the names of the Topics subscribed to by the ROS Node.
- Returns:
subscribed Topic names
- Return type:
set{str}
- property topic_names_to_types
Return the mapping of all added Topic names to their ROS type.
- Returns:
all Topic names to their mapped ROS Topic Type
- Return type:
dict{str: str}
- class ros2_snapshot.snapshot.builders.ParameterBankBuilder
Bases:
_BankBuilderDefine a ParameterBankBuilder.
Responsible for collecting, maintaining, and populating ParameterBuilders for the purpose of extracting metamodel instances
- class ros2_snapshot.snapshot.builders.ParameterBuilder(name)
Bases:
_EntityBuilderDefine a ParameterBuilder.
Represents a ROS Parameter and is responsible for allowing itself to be populated with basic information relevant to a Parameter and then further populating itself from that information for the purpose of extracting a metamodel instance
- add_description(descriptor)
Collect description information associated with the parameter.
- add_info(parameter_info)
Collect information and initializes each parameter in the bank.
- property construct_type
Return the type of the Parameter’s value.
- Returns:
the Python type of the Parameter’s value
- Return type:
str
- property description
Return the description associated with the parameter.
- Returns:
description
- Return type:
str
- extract_metamodel()
Extract Parameter metamodel.
Allow the ParameterBuilder to create / extract a Parameter instance from its internal state
- Returns:
the created / extracted metamodel instance
- Return type:
- property node_name
Return the node name associated with the parameter.
- Returns:
node_name
- Return type:
str
- property value
Return the value of the Parameter.
- Returns:
the value of the Parameter
- Return type:
str
- property value_type
Return the Python type of the Parameter’s value.
- Returns:
the Python type of the Parameter’s value
- Return type:
str
- class ros2_snapshot.snapshot.builders.ServiceBankBuilder
Bases:
_BankBuilderDefine a ServiceBankBuilder.
Responsible for collecting, maintaining, and populating ServiceBuilders for the purpose of extracting metamodel instances
- class ros2_snapshot.snapshot.builders.ServiceBuilder(name)
Bases:
_EntityBuilderDefine a ServiceBuilder.
Represents a ROS Service and is responsible for allowing itself to be populated with basic information relevant to a Service and then further populating itself from that information for the purpose of extracting a metamodel instance
- add_service_provider_node_name(service_provider_node_name)
Add service provider node name.
Adds an association between a Service Provider ROS Node’s name and this Action
- Parameters:
service_provider_node_name (str) – the Service Provider ROS Node name to associate with this Action
- property construct_type
Return the Service’s ROS type.
- Returns:
the Service’s ROS type
- Return type:
str
- extract_metamodel()
Extract metamodel.
Allows the ServiceBuilder to create / extract a Service instance from its internal state
- Returns:
the created / extracted metamodel instance
- Return type:
- property service_provider_node_names
Return the names of the ROS Nodes that act as Providers.
- Returns:
the names of the Service Provider ROS Nodes
- Return type:
set{str}
- class ros2_snapshot.snapshot.builders.TopicBankBuilder(topic_types)
Bases:
_BankBuilderDefine a TopicBankBuilder.
Responsible for collecting, maintaining, and populating TopicBuilders for the purpose of extracting metamodel instances
- class ros2_snapshot.snapshot.builders.TopicBuilder(name)
Bases:
_EntityBuilderDefine a TopicBuilder.
Represents a ROS Topic and is responsible for allowing itself to be populated with basic information relevant to a Topic and then further populating itself from that information for the purpose of extracting a metamodel instance
- add_node_name(node_name, status)
Associate this Topic with a ROS Node name.
Based on whether it was Published by or Subscribed to by the ROS Node
- Parameters:
node_name (str) – the name of the associated ROS Node
status (str) – the status or relationship (‘published’ or ‘subscribed’) between the Topic and the ROS Node
- property construct_type
Return this Topic’s ROS type.
- Returns:
this Topic’s ROS type
- Return type:
str
- property endpoint_type
Get endpoint type.
- extract_metamodel()
Extract metamodel.
Allows the TopicBuilder to create / extract a Topic instance from its internal state
- Returns:
the created / extracted metamodel instance
- Return type:
- get_verbose_info(info, gid_dict)
Add verbose information to the topic_bank.
- property gid_information
Get GID information.
- property publisher_node_names
Return the names of the ROS Nodes that have Published the Topic.
- Returns:
the names of Publisher ROS Nodes for this Topic
- Return type:
set{str}
- property qos_profile
Get QOS profile.
- set_gid_dict(gid_dict)
Set GID information.
- property subscriber_node_names
Return the names of the subscribed ROS Nodes.
- Returns:
the names of Subscriber ROS Nodes for this Topic
- Return type:
set{str}
- property topic_hash
Get topic hash.