Robotics StackExchange | Archived questions

overriding <arg>

I have a default arguments in a launch file called origin/orientation. If I decide to load a specific file containing another origin/orientation and I would like the default argument values to be re-written. See the code below.

<?xml version="1.0"?>
<launch>
        <arg name="origin"          default="-1 2 0"/>
        <arg name="orientation"     default="0 0 0 1"/>
        <arg name="load_saved"      default="True"/>

        <group if="$(arg load_saved)">
            <!--include file="$(arg save_path)/table_link/origin.xml"/-->
            <param name="origin" value="0 0 0"/>
        </group>

</launch>

I would want the argument origin to be chagned from "-1 2 0" -> "0 0 0". If load_save is True this value will be loaded from file via include. Does anyboy have any idea how to do this. At the moment the value is not getting changed.

Asked by gpldecha on 2015-03-05 08:27:36 UTC

Comments

Answers

I think you need 2 launch files to have this behaviour:

First launch:

<?xml version="1.0"?>
<launch>
        <arg name="origin"          default="-1 2 0"/>
        <arg name="orientation"     default="0 0 0 1"/>

        <!-- do whatever has to be done here -->
</launch>

Second launch file:

<?xml version="1.0"?>

<launch>

        <arg name="load_saved"      default="True"/>

        <group if="$(arg load_saved)">
            <!--include file="$(arg save_path)/table_link/origin.xml"/-->
            <include file="$(find your_package)/launch/first_file.launch">
                   <arg name="origin" value="0 0 0"/>   <!-- set other arg value -->
            </include>
        </group>

        <!-- include your first launch if not arg load_saved -->
        <include unless="$(arg load_saved)" file="$(find your_package)/launch/first_file.launch" />
   </launch>

Asked by Wolf on 2015-03-05 10:00:57 UTC

Comments

yes you can do it with two. But wanted to do it all in one. I have found an alternative solution which consists of setting the orientation and position in the node depending on a flag past to it.

Asked by gpldecha on 2015-03-05 10:29:39 UTC