ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Best way to deal with diagnostic message compatibility

asked 2015-04-01 01:35:00 -0500

TomLowe gravatar image

I recently upgraded to ROS hydro, and I can no longer read the /diagnostics message from bag files created prior to hydro. The sample code is:

rosbag::View view(bag, rosbag::TopicQuery(string("/diagnostics")));
for (rosbag::View::iterator viter = view.begin(); viter != view.end(); ++viter)
  rosbag::MessageInstance const m = *viter;
  if (m.getTopic() == string("/diagnostics"))
    diagnostic_msgs::DiagnosticArray::ConstPtr diagnosticArray = m.instantiate<diagnostic_msgs::DiagnosticArray>();

diagnosticArray now returns NULL as there is an md5sum mismatch, which can be verified by calling rosbag check on the bag file.

My question is, what is the most appropriate way to deal with this change? I can think of several options:

  1. save a migration rule and call rosbag fix on every bag file we have ever saved
  2. make the application which is trying to read the diagnostics message call a system call to rosbag fix if/when the diagnosticArray variable is NULL. Warning the user and saving a backup of the bag file.
  3. Is it possible that the diagnostic message change was minor and I could somehow still access the diagnostic information at a lower level without requiring a migration? (rosbag_wrapper for matlab seems like it might be capable of this)
  4. Is there some other way to migrate a bagfile through C++ API rather than system("rosbag fix ...")?

    Many thanks,


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-01 12:45:20 -0500

Dirk Thomas gravatar image

Yes, you need to call "rosbag fix" ( ) on your rosbags before playing them back. You won't need a migration rule (according to this discussion when the change was introduced: ).

Afaik there is only a Python API for this due to its dynamic nature:

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



Asked: 2015-04-01 01:35:00 -0500

Seen: 329 times

Last updated: Apr 01 '15