Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute process refactor #215

Open
wants to merge 19 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions launch_ros/launch_ros/actions/lifecycle_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def unblock(future):
self.__logger.error(
"Failed to make transition '{}' for LifecycleNode '{}'".format(
ChangeState.valid_transitions[request.transition.id],
self.node_name,
self.name,
)
)

Expand All @@ -142,20 +142,20 @@ def execute(self, context: launch.LaunchContext) -> Optional[List[Action]]:

Delegated to :meth:`launch.actions.ExecuteProcess.execute`.
"""
self._perform_substitutions(context) # ensure self.node_name is expanded
if '<node_name_unspecified>' in self.node_name:
raise RuntimeError('node_name unexpectedly incomplete for lifecycle node')
self.prepare(context) # ensure self.name is expanded
if '<node_name_unspecified>' in self.name:
raise RuntimeError('name unexpectedly incomplete for lifecycle node')
node = get_ros_node(context)
# Create a subscription to monitor the state changes of the subprocess.
self.__rclpy_subscription = node.create_subscription(
lifecycle_msgs.msg.TransitionEvent,
'{}/transition_event'.format(self.node_name),
'{}/transition_event'.format(self.name),
functools.partial(self._on_transition_event, context),
10)
# Create a service client to change state on demand.
self.__rclpy_change_state_client = node.create_client(
lifecycle_msgs.srv.ChangeState,
'{}/change_state'.format(self.node_name))
'{}/change_state'.format(self.name))
# Register an event handler to change states on a ChangeState lifecycle event.
context.register_event_handler(launch.EventHandler(
matcher=lambda event: isinstance(event, ChangeState),
Expand Down
8 changes: 4 additions & 4 deletions launch_ros/launch_ros/actions/load_composable_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def execute(
# resolve target container node name

if is_a_subclass(self.__target_container, ComposableNodeContainer):
self.__final_target_container_name = self.__target_container.node_name
self.__final_target_container_name = self.__target_container.name
elif isinstance(self.__target_container, SomeSubstitutionsType_types_tuple):
subs = normalize_to_list_of_substitutions(self.__target_container)
self.__final_target_container_name = perform_substitutions(
Expand Down Expand Up @@ -261,11 +261,11 @@ def get_composable_node_load_request(
request.plugin_name = perform_substitutions(
context, composable_node_description.node_plugin
)
if composable_node_description.node_name is not None:
if composable_node_description.name is not None:
request.node_name = perform_substitutions(
context, composable_node_description.node_name
context, composable_node_description.name
)
expanded_ns = composable_node_description.node_namespace
expanded_ns = composable_node_description.namespace
if expanded_ns is not None:
expanded_ns = perform_substitutions(context, expanded_ns)
base_ns = context.launch_configurations.get('ros_namespace', None)
Expand Down
Loading