== <arg> tag ==

<<Version(C Turtle)>>

<<TOC(3)>>

== Introduction ==
The `<arg>` tag allows you to create more re-usable and configurable launch files by specifying values that are passed via the command-line, passing in via an `<include>`, or declared for higher-level files.  ''Args are not global.'' An arg declaration is specific to a single launch file, much like a local parameter in a method.  You must explicitly pass arg values to an included file, much like you would in a method call.


== Usecase pattern ==
`<arg>` can be used in one of three ways:

   `<arg name="foo" />`
     Declares the existence of `foo`. `foo` must be passed in either as a command-line argument (if top-level) or via `<include>` passing (if included).
   `<arg name="foo" default="1" />`
     Declares `foo` with a default value. `foo` can be overriden by command-line argument (if top-level) or via `<include>` passing (if included).
   `<arg name="foo" value="bar" />`
     Declares `foo` with constant value. The value for `foo` cannot be overridden. This usage enables internal parameterization of a launch file without exposing that parameterization at higher levels.

== Attributes ==

 `name="arg_name"`
  Name of argument.
 `default="default value"` ''(optional)''
  Default value of argument. Cannot be combined with `value` attribute.
 `value="value"` ''(optional)''
  Argument value. Cannot be combined with `default` attribute.
 `doc="description for this arg"` ''(optional)''  <<Version(Indigo)>>
  Description of the argument. You could get this through `--ros-args` argument to the `roslaunch` command.

== Examples ==

=== Passing an argument to an included file ===

 `my_file.launch`:
 {{{
<include file="included.launch">
  <!-- all vars that included.launch requires must be set -->
  <arg name="hoge" value="fuga" />
</include>
}}}

 `included.launch`:
 {{{
<launch>
  <!-- declare arg to be passed in -->
  <arg name="hoge" /> 

  <!-- read value of arg -->
  <param name="param" value="$(arg hoge)"/>
</launch>
}}}

=== Passing an argument via the command-line ===

`roslaunch` uses the same syntax as ROS remapping arguments to specify `arg` values.

 {{{
$ roslaunch my_file.launch hoge:=my_value      (.launch file is available at the current dir)
$ roslaunch %YOUR_ROS_PKG% my_file.launch hoge:=my_value
}}}