Giving a directory to output file in a launcher. for (rosbag record and rostopic echo)
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:
2)rostopic echo 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:
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 #rosbagrecord #rostopicecho #output #directory #outputdirectory #specifydirectory #rosbagoutput #rostopicoutput
Asked by PabloPM on 2013-12-01 06:02:21 UTC
Answers
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/how-to-save-file-to-the-current-directory-with-roslaunch/
The cwd option does not work for me but this does:
ROS_HOME=`pwd` roslaunch foo.launch
Asked by chrisb on 2015-12-18 15:44:28 UTC
Comments
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!
Asked by luketheduke on 2015-12-19 15:05:50 UTC
Comments
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" />
Asked by Stefan Kohlbrecher on 2015-12-21 03:05:24 UTC
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:
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
Asked by PabloPM on 2013-12-01 07:20:35 UTC