ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The answer from @dornhege will work with no problems.

To go a bit further, I tend to treat launch files like a separate language, where each individual launch file is a function and the <arg> tags at the top of the launch file are the function parameters that have default values. To accomplish that I would put the following line just below the <launch> tag in both launch files:

<arg name="START_NODE_NAME" default="goal_server"/>

There are two benefits to this approach:

  1. In A.launch you can simply have the following line:

    <include file="$(find some_package_name)/launch/B.launch"/>
    

    and you will have B.launch use goal_server as the node name.

  2. You can remap arguments for your launch files when starting A.launch from the command line:

    roslaunch your_package A.launch START_NODE_NAME:=new_goal_server
    

    This is helpful when you want to try changing a few things without necessarily going into the actual files to modify values.

More tips can be found here for using roslaunch with large projects.