ros2_snapshot.snapshot.snapshot module

Snapshot: a tool for probing active ROS deployments.

Discovers the ROS Computation Graph and stores as a snapshot_modeling model

class ros2_snapshot.snapshot.snapshot.ROSSnapshot(name='/ros_snapshot')

Bases: object

Class responsible for discovering the main components.

Discovers the main components in the ROS Computation Graph, which are needed to extract a ROSModel.

property action_bank

Return the ActionBankBuilder.

Returns:

the ActionBankBuilder

Return type:

ActionBankBuilder

property action_specification_bank

Return the SpecificationBankBuilder for Action Specifications.

Returns:

the SpecificationBankBuilder for Action Specifications

Return type:

SpecificationBankBuilder

collect_system_info(node, include_hidden_topics=True)

Crawl the system and collects nodes, topics, actions, & services.

Returns:

information

Return type:

tuple(dict, list, dict, dict)

Is expecting the final result to be (per ROS1 implementation) state = {topic1: [node1, node2], topic2: [node3, node4], etc…}

find_unmatched_executables()

Find unmatched executables.

Returns:

List of possible executables that match the unmatched nodes

Return type:

list[str]

static list_to_io_dict(names)

Convert a list of input/output names into a dictionary with default None values.

Parameters:

names (list[str]) – List of full names (e.g., parameter names) to convert

Returns:

Dictionary mapping each name to None

Return type:

dict[str, None]

load_specifications(source_folder)

Load specification model from folder.

Parameters:

source_folder – the input folder pointing to either yaml or pickle files

Returns:

True if successful, false otherwise

property machine_bank

Return the MachineBankBuilder.

Returns:

the MachineBankBuilder

Return type:

MachineBankBuilder

property message_specification_bank

Return the SpecificationBankBuilder for Message Specifications.

return:

the SpecificationBankBuilder for Message Specifications

rtype:

SpecificationBankBuilder

property node_bank

Return the NodeBankBuilder.

Returns:

the NodeBankBuilder

Return type:

NodeBankBuilder

property package_specification_bank

Return the PackageBankBuilder.

Returns:

the PackageBankBuilder

Return type:

PackageBankBuilder

property parameter_bank

Return the ParameterBankBuilder.

Returns:

the ParameterBankBuilder

Return type:

ParameterBankBuilder

print_statistics()

Print statistics.

print_unmatched()

Print unmatched nodes and executables if there are any.

property ros_deployment_model

Return the ROSModel instance of deployment models.

Returns:

the ROSModel instance, if called after the snapshot method; Otherwise, None

Return type:

ROSModel

property ros_specification_model

Return the ROSModel instance of specifications.

Returns:

the ROSModel instance, if called after the snapshot method; Otherwise, None

Return type:

ROSModel

property service_bank

Return the ServiceBankBuilder.

Returns:

the ServiceBankBuilder

Return type:

ServiceBankBuilder

property service_specification_bank

Return the SpecificationBankBuilder for Service Specifications.

Returns:

the SpecificationBankBuilder for Service Specifications

Return type:

SpecificationBankBuilder

snapshot()

Probe the ROS deployment to populate the ROSModel.

Captures details of the ROS Computation Graph.

Returns:

True if successful; False if failures were encountered

Return type:

bool

timeout_call_list_params(node, node_name, timeout=2)

Bypass parameter freezing when invoking ros2 param list.

Node:

NodeStrategy object

Node_name:

name of node

Timeout:

How long to wait until we override call_list_param hang error

property topic_bank

Return the TopicBankBuilder.

Returns:

the TopicBankBuilder

Return type:

TopicBankBuilder

ros2_snapshot.snapshot.snapshot.get_options(argv)

Handle command line options.

Parameters:

argv – command arguments

ros2_snapshot.snapshot.snapshot.main(argv=None)

Run the ROS Snapshot tool.

This is the driver that sets up and runs all of the Logging, Filtering, Probing, and Model creation functionality