ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Since ROS Kinetic, there is a very neat solution for boolean operators in roslaunch file. See documentation. Here is an example for a "or" operation.
<arg name="cond_1" default="false"/>
<arg name="cond_2" default="false"/>
<node pkg="PKG" type="TYPE" name="NAME" if="$(eval arg('cond_1) or arg('cond_2'))" />
This syntax can of course also be applied to including a launch file.
2 | No.2 Revision |
Use eval
keyword.
Since ROS Kinetic, there is a very neat solution for boolean operators in roslaunch file. See documentation. Here is an example for a "or" operation.
<arg name="cond_1" default="false"/>
<arg name="cond_2" default="false"/>
<node pkg="PKG" type="TYPE" name="NAME" if="$(eval arg('cond_1) or arg('cond_2'))" />
This syntax can of course also be applied to including a launch file.
3 | No.3 Revision |
Use eval
keyword.
Since ROS Kinetic, there is a very neat solution for boolean operators in roslaunch file. See documentation. Here is an example for a "or" operation.
<arg name="cond_1" default="false"/>
<arg name="cond_2" default="false"/>
<node pkg="PKG" type="TYPE" name="NAME" if="$(eval arg('cond_1) or arg('cond_2'))" />
This syntax can of course also be applied to including a launch file.
Thanks to @gvhoorn, I realized
$(eval <expression>)
allows to evaluate arbitrary complex python expressions.
4 | No.4 Revision |
Use eval
keyword. keyword if you are using ROS Kinetic or newer version. See documentation.
Since ROS Kinetic, there This is a very neat solution for boolean operators in roslaunch file. See documentation. Here is an An example for a "or" operation. operation:
<arg name="cond_1" default="false"/>
<arg name="cond_2" default="false"/>
<node pkg="PKG" type="TYPE" name="NAME" if="$(eval arg('cond_1) or arg('cond_2'))" />
This syntax can of course also be applied to including a launch file.
Thanks to @gvhoorn, I realized
@gvhoorn's:
$(eval <expression>)
allows to evaluate arbitrary complex python expressions.
5 | No.5 Revision |
Use eval
keyword if you are using ROS Kinetic or newer version. See documentation.
This is a very neat solution for boolean operators in roslaunch file. An example for a an "or" operation:
<arg name="cond_1" default="false"/>
<arg name="cond_2" default="false"/>
<node pkg="PKG" type="TYPE" name="NAME" if="$(eval arg('cond_1) or arg('cond_2'))" />
This syntax can of course also be applied to including a launch file.
Thanks to @gvhoorn's:
$(eval <expression>)
allows to evaluate arbitrary complex python expressions.