[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-users
Subject:    [ros-users] Using $(arg) substitution
From:       kartikmohta () gmail ! com (Kartik Mohta)
Date:       2011-01-29 7:31:44
Message-ID: AANLkTim3xsAhG3BWSN5Yy=BTi1U+8fznq8KUxnhPsWwa () mail ! gmail ! com
[Download RAW message or body]

On Sat, Jan 29, 2011 at 2:05 AM, Patrick Bouffard
<bouffard at eecs.berkeley.edu> wrote:
> Kartik,
>
> You can think of launch files like subroutines, and of course, a
> subroutine needs to declare what arguments it takes and, optionally,
> default values of those arguments:
>
> ---
> Pseudocode:
> main:
> ?call foo(arg1=false)
>
> subroutine foo(arg1, arg2=true):
> ? if arg1: something
> ? if arg2: something_else
>
> ---
>
> Launch file equivalent:
>
> main.launch:
> <launch>
> ?<include file="foo.launch">
> ? ?<arg name="arg1" value="false"/>
> ?</include>
> </launch>
>
> foo.launch:
> <launch>
> ?<arg name="arg1"/>
> ?<arg name="arg2", default="true"/>
>
> ?<node if="$(arg arg1)" pkg="somepkg" type="something" name="something"/>
> ?<node if="$(arg arg2)" pkg="somepkg" type="something_else"
> name="something_else"/>
> </launch>
> ---
>
> This is essentially what the documentation tells you but I found it
> helped to think about the analogy between launch file arguments and
> subroutine/function arguments.
>
> Cheers,
>
> Pat
>

This analogy really helps, thanks Pat.

-- 
Kartik

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic