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

deduce executable from package name if needed #1

Merged
merged 1 commit into from
Dec 9, 2020
Merged
Changes from all commits
Commits
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
18 changes: 8 additions & 10 deletions src/simple_launch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
def regular_path_elem(path):
return path is None or type(path) == str



class SimpleLauncher:
def __init__(self, namespace = ''):
'''
Expand Down Expand Up @@ -45,8 +47,7 @@ def arg(self, name):
if type(name) != str:
return name
return LaunchConfiguration(name)



def arg_map(self, names, to_update={}):
'''
Retrieves several arguments as a dict
Expand Down Expand Up @@ -211,12 +212,12 @@ def node(self, package, executable = None, plugin = None, **node_args):
Add a node to the launch tree.

* package -- name of the package
* executable (classical node) -- name of the node within the package
* executable (classical node) -- name of the node within the package, if None then assumes the node has the name of the package
* plugin (inside a composition group) -- name of the composed node plugin within the package
* node_args -- any other args passed to the node constructor
'''
if executable is None and not self.composed:
raise Exception('Indicate the executable name when adding a classical node')
executable = package
if plugin is None and self.composed:
raise Exception('Indicate the plugin name when adding a composable node')

Expand Down Expand Up @@ -299,7 +300,7 @@ def robot_state_publisher(self, package=None, description_file=None, description
node_args['parameters'] = {'robot_description': urdf_xml}

# Launch the robot state publisher with the desired URDF
self.node("robot_state_publisher", "robot_state_publisher", **node_args)
self.node("robot_state_publisher", **node_args)

def joint_state_publisher(self, use_gui = True, **node_args):
'''
Expand All @@ -309,9 +310,6 @@ def joint_state_publisher(self, use_gui = True, **node_args):
if type(use_gui) == bool:
use_gui = str(use_gui)

pkg_exec = 'joint_state_publisher'
self.node(pkg_exec, pkg_exec, parameters = node_args, condition=UnlessCondition(use_gui))

pkg_exec = 'joint_state_publisher_gui'
self.node(pkg_exec, pkg_exec, parameters = node_args, condition=IfCondition(use_gui))
self.node('joint_state_publisher', parameters = node_args, condition=UnlessCondition(use_gui))
self.node('joint_state_publisher_gui', parameters = node_args, condition=IfCondition(use_gui))