Getting Started with ROS on Embedded Systems - User Guide - C++ - Launch files

From RidgeRun Developer Connection
Jump to: navigation, search




Previous: User Guide/C++/Publishers_and_subscribers Index Next: User Guide/C++/Parameters




Introduction

This wiki is based on the following pages:

  1. http://wiki.ros.org/roslaunch
  2. http://wiki.ros.org/roslaunch/XML

ROS launch files are XML files that used with the roslaunch tools, eases the launching of multiple nodes, with multiple configurations. This makes it easier to have for example more than one node running, you don't need to have the roscore running, and you can ease node grouping, topic renaming, node naming, parameter loading, and many other things by using this tool.

Examples

Simple launch file with parameter loading

<launch>
  <group ns="group_namespace">
    <rosparam command="load" file="$(find node_package)/configuration/node_parameters.yaml" ns="node_parameters_namespace"/>
    <node name="$(arg node_name)" pkg="node_package" type="listener" required="true" output="screen"/>
  </group>
</launch>
  1. This launch file receives one parameter, the node name as an argument.
  2. This will create a node under group_namespace/node_name, and all the logs will be output into the caller terminal.
  3. This should also load the parameters yaml file inside the node_parameters_namespace/ namespace.
  4. You can add more nodes in this launch file too, the only requirement is that these have different names.

The launch files should be located inside a launch subfolder inside each package.

To launch it, you can use

roslaunch <package name> <launch file> node_name:=my_node
Previous: User Guide/C++/Publishers_and_subscribers Index Next: User Guide/C++/Parameters