What is the general structure of .launch file for using a sensor?

For example:

1.Following code is example for using a JoyStick to control TurtleSim

  <node pkg="turtlesim" type="turtlesim_node" name="sim"/>
  <node pkg="chapter4_tutorials" type="example1" name="example1" />
  <param name="axis_linear" value="1" type="int" />
  <param name="axis_angular" value="0" type="int" />
  <node respawn="true" pkg="joy"type="joy" name="teleopJoy">
    <param name="dev" type="string" value="/dev/input/js0" />
    <param name="deadzone" value="0.12" />

2.Using a Laser Range finder

  <node pkg="hokuyo_node" type="hokuyo_node" name="hokuyo_node"/>
  <node pkg="rviz" type="rviz" name="rviz"
        args="-d $(find chapter4_tutorials)/example2.vcg"/>
  <node pkg="chapter4_tutorials" type="example2" name="example2" />

What exactly is the syntax?

Why do we have two <node pkg>?


1 Answer 1


The first node, hokuyo_node, is the driver for the sensor. The second node, rviz, is for visualizing the data coming from the hokuyo_node. The third node is the tutorial program.

The launch file format is well documented. However it assumes that you understand the basic organization of ROS, what nodes are, and how they interact.

  • $\begingroup$ Where can I find documentation for launch file format? $\endgroup$ Jun 6, 2017 at 18:40
  • $\begingroup$ Both Google search, and the search tool of wiki.ros.org give good results. $\endgroup$
    – hauptmech
    Jun 6, 2017 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.