ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Can I make a directory in launch file?

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

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 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
4

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

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 -0600 )edit
4

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

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 -0600 )edit
2

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

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 -0600 )edit

Question Tools

Stats

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

Seen: 1,603 times

Last updated: Apr 08 '14