ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

overriding <arg>

asked 2015-03-05 07:27:36 -0500

gpldecha gravatar image

updated 2015-03-05 07:37:41 -0500

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-05 09:00:57 -0500

Wolf gravatar image

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:

<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>
edit flag offensive delete link more

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.

gpldecha gravatar image gpldecha  ( 2015-03-05 09:29:39 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-05 07:27:36 -0500

Seen: 1,508 times

Last updated: Mar 05 '15