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

Revision history [back]

click to hide/show revision 1
initial version

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