ROS

launch file的條件用法

因為在tabletop_object_detector這個package裡面的tabletop_segmentation.launch用到了大量的if和unless,所以稍微研究了一下if跟unless的用法(可以用rosed tabletop_object_detector tabletop_segmentation.launch看看)

在這個launch file中,我們可以透過條件的用法來指定要用那一組參數

例如說(我把node部份簡化)

<launch>
   <node>
   <param if=”$(arg tabletop_segmentation_convert_to_base_link)” name=”processing_frame” value=”base_link” />
   <param unless=”$(arg tabletop_segmentation_convert_to_base_link)” name=”processing_frame” value=”” />
   </node>
</launch>

如果tabletop_segmentation_convert_to_base_link這個arg是true,if那行會過,processing_frame的值會被設為base_link,反之若tabletop_segmentation_convert_to_base_link是false,unless那行會過,processing_frame的值會被設為None

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s