Hi! Is it possible in roslaunch to change the value of an arg? I would like to write a launch file for rosbag record with arguments about which topics to record. Like this:
roslaunch record record.launch record_scan:=true record_image:=true
where the launch file might look like this:
<launch>
<arg name="record_scan" default="false" />
<arg name="record_image" default="false" />
<arg name="scan_topic" default="" />
<arg name="image_topic" value="" />
<group if="$(arg record_scan)">
<arg name="scan_topic" value="/scan />
</group>
<group if="$(arg record_image)">
<arg name="image_topic" value="/image />
</group>
<node pkg="rosbag" type="record" name="rosbag" output="screen" args="/tf /odom $(arg image_topic) $(arg scan_topic)"/>
<launch>
If I try it like this, ros complains:
Invalid <arg> tag: arg 'scan_topic has already been declared.
Is there some way to do this? I also tried nested group statements and putting an unless statement instead of declaring the arg before, but both didn't work. Thank you for your help!!
Originally posted by emchenk on ROS Answers with karma: 43 on 2016-07-15
Post score: 4
Original comments
Comment by emielke on 2016-07-21:
Why don't you simply input the scan topic and image topic as args rather than the boolean args? Is it necessary for you to be able to turn one off and leave the other on? I guess this is more curiosity since it seems you found a solution.
Comment by emchenk on 2016-07-21:
I posted a simplified version of what I want to do. When I specify "image", I want rosbag to record multiple image related topics and so on. Furthermore, the topic names are harder to remember than the args I wanted to specify.