Assign a parameter to rosbag record
I am a bit confused by the answer to a related question
I have the following launch file
<launch>
<node type="generate_message.py" name="generator" pkg="my_package" />
<node name="rosbag" type="record" pkg="rosbag" args="-o $(find my_package)/bags/default_ /the_topic">
</node>
</launch>
please focus on the rosbag part. This launch file works well to start. It records a bag with the name default_ then the date and time in the bags folder of my workspace (a folder that I suppose have to exist???)
What I want to achieve is:
- To enter the output folder path and name as a parameter (or argument?? I am confused about the difference)
- That this output folder path may include non-existent folders and if that is the case to generate those folders (is this possible?)
- That the default would be the one written above
So I am trying something like
<launch>
<arg name = "output_folder" default="-$(find my_package)/bags/default_" />
<node name="rosbag" type="record" pkg="rosbag"
arg="-O $(arg name) /the=topic>
</node>
</launch>
Obviously it is not working that well. I suppose with this
I can enter the parameter as
output_folder:="/the/path/to/the/bag.bag"
and it will generate this bag but by default it will generatedefault_.bag
not with the dateI don't know what would happen if the output folder path includes non existent folders
Can somebody lend me a hand to get this?