Skip to content

Commit

Permalink
Remove node_info structure and add public API
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffrey Biggs <gbiggs@killbots.net>
  • Loading branch information
gbiggs committed Mar 29, 2021
1 parent 1958ed7 commit 2d9f3d1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions launch_ros/launch_ros/actions/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ class NodeActionExtension:
* `execute`
"""

class NodeInfo:
def __init__(self, package, executable, name):
self.package = package
self.executable = executable
self.name = name

NAME = None
EXTENSION_POINT_VERSION = '0.1'

Expand All @@ -96,10 +90,10 @@ def command_extension(self, context):
"""
return []

def execute(self, context, ros_specific_arguments, node_info):
def execute(self, context, ros_specific_arguments, node_action):
""" Perform any actions prior to the node's process being launched.
`node_info` is an instance of `NodeInfo`.
`node_action` is the Node action instance that is calling the extension.
This method must return `ros_specific_arguments` with any modifications
made to it.
Expand Down Expand Up @@ -328,6 +322,16 @@ def parse(cls, entity: Entity, parser: Parser):

return cls, kwargs

@property
def node_package(self):
"""Getter for node_package."""
return self.__package

@property
def node_executable(self):
"""Getter for node_executable."""
return self.__node_executable

@property
def node_name(self):
"""Getter for node_name."""
Expand Down Expand Up @@ -461,12 +465,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
ros_specific_arguments['name'] = '__node:={}'.format(self.__expanded_node_name)
if self.__expanded_node_namespace != '':
ros_specific_arguments['ns'] = '__ns:={}'.format(self.__expanded_node_namespace)
node_info = NodeActionExtension.NodeInfo(
self.__package,
self.__node_executable,
self.node_name)
for extension in self.__extensions.values():
ros_specific_arguments = extension.execute(context, ros_specific_arguments, node_info)
ros_specific_arguments = extension.execute(context, ros_specific_arguments, self)

context.extend_locals({'ros_specific_arguments': ros_specific_arguments})
ret = super().execute(context)
Expand Down

0 comments on commit 2d9f3d1

Please sign in to comment.