Ask Your Question
1

Can I make a directory in launch file?

asked 2014-04-08 05:45:08 -0500

benabruzzo gravatar image

My local machine is a laptop running Ubuntu 10.04 (old, I know). While collecting data during my experiments, I am generating text files for Matlab, but I want to organize a single experiment into a new directory. Here is my test code (found on an ANT reference page):

<!-- -*- mode: XML -*-  -->
<launch>
  <mkdir dir="/home/turtlebot/00x/"/>
  <!-- Other Stuff excluded as irrelevant -->
</launch>

Does anyone know a way to have a directory (in this case /00x/) automatically generated using XML?

edit retag flag offensive close merge delete

Comments

I made a shell script and called it this way: <node pkg="hast" type="makedir.sh" name="makeDir" output="screen"/>

benabruzzo gravatar image benabruzzo  ( 2014-04-14 08:13:39 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
3

answered 2014-04-08 07:33:23 -0500

Tom Moore gravatar image

Also, nodes can be shell scripts, making directory creation pretty straightforward.

edit flag offensive delete link more

Comments

I made a shell script and called it this way: <node pkg="hast" type="makedir.sh" name="makeDir" output="screen"/>

benabruzzo gravatar image benabruzzo  ( 2014-04-14 08:13:19 -0500 )edit
3

answered 2014-04-08 07:43:04 -0500

I found this interesting hack in maxwell_calibration:

  <node type="record" pkg="rosbag" name="robot_measurement_recorder" output="screen"
        args="-O /tmp/maxwell_calibration/cal_measurements robot_measurement robot_description" >
    <!-- Hack to create the directory -->
    <param name="mkdir_tmp" command="mkdir -m 777 -p /tmp/maxwell_calibration" />
  </node>

So it appears you can create folders from launch files (using very hacky abuse of parameters)

edit flag offensive delete link more

Comments

1

This method is interesting!

Ken_in_JAPAN gravatar image Ken_in_JAPAN  ( 2014-04-08 18:40:42 -0500 )edit
2

answered 2014-04-08 07:08:18 -0500

ahendrix gravatar image

You cannot do this directly in your launch file.

If you have a node that requires a directory to exist, you can have that node create the directory in question.

edit flag offensive delete link more

Comments

Thank you.

benabruzzo gravatar image benabruzzo  ( 2014-04-08 07:19:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-04-08 05:45:08 -0500

Seen: 992 times

Last updated: Apr 08 '14