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

set arg in condition

asked 2021-10-06 02:34:02 -0500

omerk gravatar image

Hello I am triying to develop a roslaunch. I need to set a argument in group with if like that

<group if="$(arg Flag)">
    <arg name="my_oppurtunity" value="oppurtunity_1"
</group>

<group unless="$(arg Flag)">
    <arg name="my_oppurtunity" value="oppurtunity_2"
</group>

<include file="my/launch/file/path">
   <arg name="launch_arg" value="$(arg oppurtunity)"/>
</include>

But it can not find my_oppurtunity argument out of group. Is there a way to do that?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-10-06 07:55:36 -0500

Ranjit Kathiriya gravatar image

updated 2021-10-06 07:58:35 -0500

Just to note:

<arg name="my_oppurtunity" value="oppurtunity_2"

You forgot to end the ars it shoube be <arg name="name" value="val" />

Have a look at this #q12756

<arg name="path_planned" default="true"/>

Condition True

<group if="$(arg path_planned)">
  <!-- stuff that will only be evaluated if path_planned is true -->
</group>

Condition False

<group unless="$(arg path_planned)">
<!-- stuff that will only be evaluated if path_planned is false -->
</group>
edit flag offensive delete link more
0

answered 2021-10-06 08:05:19 -0500

omerk gravatar image

Thank you for your answer

There is no syntax error in my launch. Just I wrote wrong while asking.Tank you for your note. It's a big project and I cannot use this way. I solve the problem just using another way. It is spesific solution for my case so I don't add there. I understand that I cannot set global arg in group. Thank you again

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-10-06 02:34:02 -0500

Seen: 286 times

Last updated: Oct 06 '21