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

Giving a directory to output file in a launcher. for (rosbag record and rostopic echo)

asked 2013-12-01 05:02:21 -0500

PabloPM gravatar image

updated 2013-12-01 05:04:06 -0500

Hi,

I have been working by now in ROS by the command line and I have just started to work with launch files.

Some nodes I want to run are rosbag (record) and rostopic (echo). I have been finding templates of launchers for these nodes, that i have found useful. But the problem is that in both nodes (rosbag record and rostopic echo) we create output files, and i havent found a way to specify the output file directory.

Examples:

1)rosbag record launch:

<launch> <node pkg="rosbag" type="record" name="record" output="screen" args="-a"/> </launch>

2)rostopic echo launch

<launch> <node name="rostopic_echo_gps" pkg="rostopic" type="rostopic" output="screen" args="echo /extended_gps"> </node> </launch>

Question: Is there any way for any of them (rosbag record or rostopic echo) that you know for specify the output file directory??

For example in rosbag play we can specify the input file directory with:

<launch> <node pkg="rosbag" type="play" name="rosbag_play" output="screen" args="/home/user/Escritorio/main_bags/2013-04-13-02-36-11.bag"/> </launch>

in this example the input file directory is specified by "/home/user/Escritorio/main_bags/" and the filename by "2013-04-13-02-36-11.bag", I want to specify the directory too when I use output files not only when I use input. Could you please help me in any case rosbag record or rostopic echo (to a output file) if you know how to?

Thank you very much,

Pablo Payno

Error when introducing tags: #launch #roslaunch #rosbag #rostopic #rosbag_record #rostopic_echo #output #directory #output_directory #specify_directory #rosbag_output #rostopic_output

edit retag flag offensive close merge delete

Comments

I have found a solution, dont think it might be the best but at least it works for rosbag record in a specified directory: <launch> <node pkg="rosbag" type="record" name="record" output="screen" args="-o /directory/Prefix_name -a"/> </launch> It makes with -o /directory/Prefix_name the record rosbag to be written inside the specified directory, with the name: "Prefix_name+date.bag" and with -a it makes the rosbag to record all topics, if any find a prettier solution please share, about the rostopic echo still couldnt find a solution to specify the output file directory, so please explain if any knows, thanks

PabloPM gravatar image PabloPM  ( 2013-12-01 06:20:35 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2015-12-21 02:05:24 -0500

updated 2015-12-21 02:06:02 -0500

Another option is creating a dedicated subfolder in one of your packages, maybe putting a .gitignore file containing "*.bag" into it (so you won't accidentally commit bagfiles) and then using that folder for recording your bagfiles to it.

Example launch file line:

  <node pkg="rosbag" type="record" name="rosbag_record_standard_data" respawn="true" output="screen" args="-o $(find argo_bag_launch)/bags/default_record /tf /odom /cmd_vel" />
edit flag offensive delete link more
0

answered 2015-12-18 14:44:28 -0500

chrisb gravatar image

updated 2015-12-18 14:49:32 -0500

I have the same issue. Running the rosbag in a specific directory creates the bag file directly in the current path. Doing this in a launch file how ever writes the file to ~/.ros/

I found this http://answers.ros.org/question/57075...

The cwd option does not work for me but this does:

ROS_HOME=`pwd` roslaunch foo.launch
edit flag offensive delete link more
0

answered 2015-12-19 14:05:50 -0500

luketheduke gravatar image

updated 2015-12-19 14:06:36 -0500

It appears that ROS doesn't support output redirection to a specified file yet, however it can output stdout/stderr to a file in $ROS_HOME/log by changing the output attribute in the launch file to "log". If you want to launch the node outside of a launch file, you may be able to use the standard Linux output redirection, but that has not been tested yet. I hope that this answers your question!

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-12-01 05:02:21 -0500

Seen: 6,022 times

Last updated: Dec 21 '15