At runtime (when I call roslaunch), I want to create a new subdirectory in a known directory, and pass that path to two different nodes as a rosparam.
How can I edit my .launch file to do this?
For example,I have the folder ~/datacapture
. whenever I use roslaunch, I want to create a subdirectory based on the current time, (ie ~/datacacpture/20161129_1352/
) and pass that into a few nodes using rosparams.
To further explain what I want to do, here is an example roslaunch file:
<launch>
<node
name="node_A"
pkg="pkg_A"
type="A"
output="screen"
>
<param name="dataDumpFolder" value="???" />
</node>
<node
name="node_B"
pkg="pkg_B"
type="B"
output="screen"
>
<param name="dataDumpFolder" value="???" />
</node>
</launch>
What i want it to look like is this:
<launch>
#1) create a new folder using current date.
#2) pass it's filepath into a variable. let's call the variable, NEW_FOLDER_FILE_PATH
<node
name="node_A"
pkg="pkg_A"
type="A"
output="screen"
>
<param name="dataDumpFolder" value="NEW_FOLDER_FILE_PATH" />
</node>
<node
name="node_B"
pkg="pkg_B"
type="B"
output="screen"
>
<param name="dataDumpFolder" value="NEW_FOLDER_FILE_PATH" />
</node>
</launch>
Originally posted by IDrinkArizona on ROS Answers with karma: 11 on 2016-11-29
Post score: 1