ros2_snapshot.snapshot.builders.action_builder module
Module for *EntityBuilders.
EntityBuilders represent ROS Entities and are responsible for allowing themselves to be populated with basic information and then further populating themselves from that information for the purpose of extracting metamodel instances
- class ros2_snapshot.snapshot.builders.action_builder.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