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

The rosbag play application itself is implemented in C++: https://github.com/ros/ros_comm/blob/indigo-devel/tools/rosbag/src/play.cpp

The code relevant to publishing messages can be found in the method Player::publish(). The C++ file also contains code for pausing and resuming playback, console output etc., but maybe you can use this code to get a rough idea: https://github.com/ros/ros_comm/blob/indigo-devel/tools/rosbag/src/player.cpp

I'm not sure how Python compares to C++ performance-wise if you are playing large bagfiles (e.g. containing camera images).

The rosbag play application itself is implemented in C++: https://github.com/ros/ros_comm/blob/indigo-devel/tools/rosbag/src/play.cpp

The code relevant to publishing messages can be found in the method Player::publish(). The C++ file also contains code for pausing and resuming playback, console output etc., but maybe you can use this code to get a rough idea: https://github.com/ros/ros_comm/blob/indigo-devel/tools/rosbag/src/player.cpp

I'm not sure how Python compares to C++ performance-wise if you are playing large bagfiles (e.g. containing camera images).


Edit, to answer your question: I believe there is no other way than either

  • using the C++ API (should provide best performance)
  • using the Python API
  • invoking "rosbag play" using a system() command.

The rosbag play application itself is implemented in C++: https://github.com/ros/ros_comm/blob/indigo-devel/tools/rosbag/src/play.cppplay.cpp

The code relevant to publishing messages can be found in the method Player::publish(). The C++ file also contains code for pausing and resuming playback, console output etc., but maybe you can use this code to get a rough idea: https://github.com/ros/ros_comm/blob/indigo-devel/tools/rosbag/src/player.cppplayer.cpp

I'm not sure how Python compares to C++ performance-wise if you are playing large bagfiles (e.g. containing camera images).


Edit, to answer your question: I believe there is no other way than either

  • using the C++ API (should provide best performance)
  • using the Python API
  • invoking "rosbag play" using a system() command.

The rosbag play application itself is implemented in C++: play.cpp

The code relevant to publishing messages can be found in the method Player::publish(). The C++ file also contains code for pausing and resuming playback, console output etc., but maybe you can use this code to get a rough idea: player.cpp

I'm not sure how I'd expect Python compares to give slightly worse performance compared to C++ performance-wise if you are playing plan to play large bagfiles (e.g. containing camera images).


Edit, to answer your question: I believe there is no other way than either

  • using the C++ API (should provide best performance)
  • using the Python API
  • invoking "rosbag play" using a system() command.