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

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,

    Tom.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

Dirk Thomas gravatar image

Yes, you need to call "rosbag fix" ( http://wiki.ros.org/rosbag/Commandlin... ) on your rosbags before playing them back. You won't need a migration rule (according to this discussion when the change was introduced: https://github.com/ros/common_msgs/pu... ).

Afaik there is only a Python API for this due to its dynamic nature: https://github.com/ros/ros_comm/blob/...

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 357 times

Last updated: Apr 01 '15