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

Data Recording to simple text file

asked 2011-12-28 01:33:55 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am a newbie here, just started working on ROS a week ago. Is there any way to record /save some data into a simple text file directly from the server or client? I want to record the request received by the server, alternatively can anybody give example of this implemented by rosbag ? The basic c++ methods of fstream and ofstream do not work in ROS.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2011-12-28 02:09:37 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

1) See this question for how to convert ROS messages to text file from the command line.

2) Here is a good introduction to the rosbag API.

3) fstream and ofstream do work in ROS. All ROS nodes are still C++ executables. I've used fstream and ofstream many times for simple logging in my ROS nodes.

4) ROS also logs all ROS print statements (ROS_INFO) to log files. Mine are located in ~/.ros/log. Files called {node}-{number}-stdout.log contain this information.

edit flag offensive delete link more

Comments

1
Depending on the task at hand, maybe the simplest solution is: rostopic echo /mytopic > textfile
dornhege gravatar image dornhege  ( 2011-12-28 03:03:35 -0500 )edit

Question Tools

Stats

Asked: 2011-12-28 01:33:55 -0500

Seen: 6,608 times

Last updated: Dec 28 '11