Ask Your Question

Can I get data from ros to a file?

asked 2014-08-15 11:42:03 -0500

dshimano gravatar image

updated 2014-08-15 11:42:30 -0500

Hi I'm running Ubuntu 12.04 and ros hydro,

I'm curently playing around with an ar drone with the tum_ardrone package. I wanted to know if theres a way to output data to a text file? I know I can use rostopic echo to get the data published to a terminal, but is there a way to get it somewere else?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-08-15 13:15:05 -0500

jc2016 gravatar image

I dont want to steal @bvbdort thunder, but I think you should probably save to a .bag file first and then change to a .txt or .csv file. Going directly to a text file, particularly if you are working with any imaging output from the bot can get weird quickly.

I believe the "ROS" way to do this would be to run a command like

    $rosbag record <topic>

And then move it over to a .txt/.csv file. A useful script to do this can be found here: ( ) which converts to a .csv. This will save the data long-term and allow a cleaner transition in the short term.

edit flag offensive delete link more

answered 2014-08-15 12:03:59 -0500

bvbdort gravatar image

updated 2014-08-15 12:07:26 -0500

To save data from ros topic to text file. It saves a .txt file in current directory,

rostopic echo /scan >>mydata.txt

Have looking into rosbag to save data and play it later.

edit flag offensive delete link more


That's nice! I never thought about this idea!

dj0405 gravatar image dj0405  ( 2014-08-18 19:44:24 -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

1 follower


Asked: 2014-08-15 11:42:03 -0500

Seen: 4,478 times

Last updated: Aug 15 '14