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

Migrating rosbag message

asked 2018-09-03 08:35:49 -0500

kk2105 gravatar image

updated 2018-09-05 02:08:14 -0500

Hi Guys,

When I was trying to play a rosbag file in ROS Indigo version, I was getting the below error.

Waiting 0.2 seconds after advertising topics.../rrrrrr/platform/ros/ros_comm/roscpp/src/libros/publication.cpp:629 Publication::validateHeader() 
[ERROR] [1535722434.248608746]: Client [/my_c] wants topic /topic to have datatype/md5sum [visualization_msgs/MarkerArray/90da67007c26525f655c1c269094e39f], but our version has [visualization_msgs/MarkerArray/d155b9ce5188fbaf89745847fd5882d7]. Dropping connection.

After going through the answers.ros blog, I finally found that the ROS version plays an important role in playing the rosbag file. The version which used to collect the rosbag is different from what I am trying to play in.

I am currently working on migrating the message from old to new. I am following the link and .

I have completed the below steps:

rosbag check old.bag -  
the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
WARNING: Within rule [GENERATED.update_visualization_msgs_MarkerArray_d155b9ce5188fbaf89745847fd5882d7] cannot migrate from subtype [Marker] to [Marker]..
The following migrations need to occur:
 * From: visualization_msgs/Marker [4048c9de2a16f4ae8e0538085ebf1b97]
   To:   visualization_msgs/Marker [18326976df9d29249efc939e00342cde]
    1 rules missing:
     * From: visualization_msgs/Marker [4048c9de2a16f4ae8e0538085ebf1b97]
       To:   visualization_msgs/Marker [18326976df9d29249efc939e00342cde]
 * From: visualization_msgs/MarkerArray [d155b9ce5188fbaf89745847fd5882d7]
   To:   visualization_msgs/MarkerArray [90da67007c26525f655c1c269094e39f]
    1 rules missing:
     * From: visualization_msgs/Marker [4048c9de2a16f4ae8e0538085ebf1b97]
       To:   visualization_msgs/Marker [18326976df9d29249efc939e00342cde]
 * From: tf2_msgs/TFMessage [94810edda583a504dfda3829e70d7eec]
   To:   tf2_msgs/TFMessage [94810edda583a504dfda3829e70d7eec]
To generate rules, please run with -g <rulefile>

Also I have generated a bag migration rule file and saved in myRule.bmr

rosbag check -g diagnostics.bmr diag.bag

I am getting the error, when I try to fix the bag.

the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
ERROR: Update rule [carla_rule_v1.bmr:update_visualization_msgs_Marker_4048c9de2a16f4ae8e0538085ebf1b97] has valid set to False.
Traceback (most recent call last):
  File "/home/tmp/ros/bin/rosbag", line 35, in <module>
  File "/home/tmp/ros/lib/python2.7/dist-packages/rosbag/", line 883, in rosbagmain
  File "/home/tmp/ros/lib/python2.7/dist-packages/rosbag/", line 415, in fix_cmd
    migrator = MessageMigrator(rules, plugins=not options.noplugins)
  File "/home/tmp/ros/lib/python2.7/dist-packages/rosbag/", line 554, in __init__
    raise BagMigrationException("Cannot instantiate MessageMigrator with invalid rules")
rosbag.migration.BagMigrationException: Cannot instantiate MessageMigrator with invalid rules

As per the document:

If a bag is currently unplayable and non-migratable, it may be necessary to generate rules to bring the bag up to date. See Migrating Messages for the preferred approaches to doing this.

Could you please help me to update the rule file manually.

Thank you, KK

edit retag flag offensive close merge delete


Do you know which ros version was used to record the bag?

Choco93 gravatar image Choco93  ( 2018-09-04 01:12:24 -0500 )edit

@Choco93 Thanks for the reply. No, Unfortunately I dont know the ROS version used to collect the bag file.

kk2105 gravatar image kk2105  ( 2018-09-04 01:20:49 -0500 )edit

This error occurs due to message mismatch. One thing you can do is remove visualization_msgs and reinstall and then try. Other thing can be you clone visualization_msgs from github, switch branch and build and then try. I haven't worked with migration rules so cannot help there.

Choco93 gravatar image Choco93  ( 2018-09-04 01:38:44 -0500 )edit

@Choco93 Thank you for the input. I have already tried the first approach, but reinstalling the visualization_msgs did not help. I believe the migration would fix, but not able to find any reference.

kk2105 gravatar image kk2105  ( 2018-09-04 02:05:19 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-09-20 04:32:47 -0500

kk2105 gravatar image

updated 2018-09-20 04:33:19 -0500

Issue has been fixed by using the below commands

 rosbag check
 rosbag fix

Thank you, KK

edit flag offensive delete link more


Hi, i know it is an old topic. But i have exactly the same issue, and i was hoping you could explain more how you solved the problem. These commands are the one I am trying, but they are without any argument. How do they work?

flash_27 gravatar image flash_27  ( 2019-11-12 08:55:08 -0500 )edit

You need to pass your bag file name.

kk2105 gravatar image kk2105  ( 2019-11-12 11:02:07 -0500 )edit

answered 2022-12-16 08:13:44 -0500

fbelmonteklein gravatar image

updated 2022-12-16 08:14:12 -0500

For the inattentive bunch (to which I am included):

If you followed, in the myrule.bmr rules generated:

Those need to be manually checked and edited. The variable valid needs set to True in the last portion of the code (when you generate it, at least in the version I am using, it defaults to false and the rule will fail). Probably so that ROS knows it is not botching anything.

In myrule.bmr change:

valid = False


valid = True

Then the migration rules work.

edit flag offensive delete link more

Question Tools



Asked: 2018-09-03 08:35:49 -0500

Seen: 2,206 times

Last updated: Dec 16 '22