Skip to content

Commit

Permalink
Merge pull request #1 from oKermorgant/master
Browse files Browse the repository at this point in the history
deduce executable from package name if needed
  • Loading branch information
oKermorgant authored Dec 9, 2020
2 parents 7d2d234 + a2d748d commit 791730b
Showing 1 changed file with 8 additions and 10 deletions.
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))

0 comments on commit 791730b

Please sign in to comment.