Ask Your Question
0

How to implement offline data synchronization?

asked 2014-01-27 04:30:47 -0600

Nicolas Vignard gravatar image

Currently I work a lot with ROS and I think, this middleware, provides a good way to produce loosely coupled modules and a very easy way to use frames transformations. But I have a serious issue and I would like to have your opinion.

I would like to tell my "story" first: "As a ROS user, I would like to process each ROS messages in offline mode so that I can run quantitative test of computer vision algorithms. As the running time of an algorithm can be longer than the time between successive images, it would be great that the publisher waits until the algorithm finishes."

With this story is in mind, I would like to know if there is an easy way to process each message in ROS. For example, in online mode, if you have a camera that provides you images at 30Hz (~30ms) and an algorithm which takes 200ms to process, it is not a problem. In this case, you just want to process the latest data.

In contrast, in offline mode (playing data with rosbag play), I would like to evaluate the quality of the algorithm and I need to process each image.

It would be nice to have the same framework/node graph between online and offline mode.

In order to do that I would like to know if someone is aware of a way to implement that? Otherwise, developers from Willow Garage can tell me if it is possible to do that in the core or give me their ideas?

Thanks in advance

edit retag flag offensive close merge delete

Comments

First of all thank you for your answers. [Thomas D]( http://answers.ros.org/users/304/thomas-d/ ) proposed to use rosbag play with the -r option but I would like to be sure to process each messages. [demmeln]( http://answers.ros.org/users/1370/demmeln/ ) has a good idea, it could be great if I have just one algorithm connected directly to the rosbag API. In order to clarify my need, I asked a second question: http://answers.ros.org/question/134276/how-to-implement-offline-data-synchronization-on-several-nodes/

Nicolas Vignard gravatar imageNicolas Vignard ( 2014-02-27 21:49:45 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-01-27 05:02:47 -0600

Thomas D gravatar image

If you are playing back bag files for your offline analysis then you can simply slow down the rate at which messages are published so that your other algorithms have time to finish. Use the -r flag of rosbag play.

edit flag offensive delete link more
1

answered 2014-01-27 10:27:33 -0600

demmeln gravatar image

One approach would be to make sure that your code is structured in such a way that the actual implementation is independent from your ROS node. I.e. the core algorithms are implemented in a library and the ROS node is just a very thin wrapper that subscribes to topics and reads parameters, and the callbacks just call the library's functions with the received data.

This way you can easily write a standalone executable that uses the rosbag API [1] to read the bag file and call the appropriate library functions to process your data. Running this repeatedly with the same bagfile is then deterministic in the sense that all messages are processed (none is dropped) and it is furthermore processing the data as fast as possible given your algorithm (i.e. you do not have to set the rate conservatively high in order to avoid all message drops). You also don't have to worry about a running ros system, load spikes on your machine that might case some messages to be dropped, and can even process multiple instances at once.

There are also some examples [2] using the rosbag API to get you going.

[1] http://wiki.ros.org/rosbag/Code%20API [2] http://wiki.ros.org/rosbag/Cookbook

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2014-01-27 04:30:47 -0600

Seen: 521 times

Last updated: Jan 27 '14