<node> tag

The <node> tag specifies a ROS node that you wish to have launched. This is the most common roslaunch tag as it supports the most important features: bringing up and taking down nodes.

roslaunch does not provide any guarantees about what order nodes start in. This is intentional: there is no way to externally know when a node is fully initialized, so all code that is launched must be robust to launching in any order.

The roslaunch tutorials page covers some examples of how to fully utilize the <node> tag, such as configuring a node to launch in gdb.

Examples

<node name="listener1" pkg="rospy_tutorials" type="listener.py" args="--test" respawn="true" />

Launches the "listener1" node using the listener.py executable from the rospy_tutorials package with the command-line argument --test. If the node dies, it will automatically be respawned.

<node name="bar1" pkg="foo_pkg" type="bar" args="$(find baz_pkg)/resources/map.pgm" />

Launches the bar node from the foo_pkg package. This example uses substitution arguments to pass in a portable reference to baz_pkg/resources/map.pgm.

Attributes

  • pkg="mypackage"

    • Package of node.

    type="nodetype"

    • Node type. There must be a corresponding executable with the same name.

    name="nodename"

    • Node name. NOTE: name cannot contain a namespace. Use the ns attribute instead.

    args="arg1 arg2 arg3"(optional)

    • Pass arguments to node.

    machine="machine-name"(optional, see <machine>)

    • Launch node on designated machine.

    respawn="true"(optional, default: False)

    • Restart the node automatically if it quits.

    respawn_delay="30" (optional, default 0) New in ROS indigo

    • If respawn is true, wait respawn_delay seconds after the node failure is detected before attempting restart.

    required="true"(optional)

    • ROS 0.10: If node dies, kill entire roslaunch.

    ns="foo"(optional)

    • Start the node in the 'foo' namespace.

    clear_params="true|false"(optional)

    • Delete all parameters in the node's private namespace before launch.

    output="log|screen"(optional)

    • If 'screen', stdout/stderr from the node will be sent to the screen. If 'log', the stdout/stderr output will be sent to a log file in $ROS_HOME/log, and stderr will continue to be sent to screen. The default is 'log'.

    cwd="ROS_HOME|node"(optional)

    • If 'node', the working directory of the node will be set to the same directory as the node's executable. In C Turtle, the default is 'ROS_HOME'. In Box Turtle (ROS 1.0.x), the default is 'ros-root'. The use of 'ros-root' is deprecated in C Turtle.

    launch-prefix="prefix arguments"(optional)

    • Command/arguments to prepend to node's launch arguments. This is a powerful feature that enables you to enable gdb, valgrind, xterm, nice, or other handy tools. See Roslaunch Nodes in Valgrind or GDB for examples.

    if="true|false"(optional)

    • If 'true' the node will be launched as usual. If 'false' the node will not be launched. Can be used to evaluate arguments/parameters and run based on the outcome without modifying the launch file every time.

Elements

You can use the following XML tags inside of a <node> tag:

Wiki: roslaunch/XML/node (last edited 2022-01-24 14:08:51 by ParakhMGupta)