# How to migrate a bag file after these two types of changes?

Hi everybody,

I've been working with bag migration for a while now and it has been working pretty well until recently. The problem I am experiencing is the following:

Let's assume I have a message like this (msgdef1):

int8 MY_CONSTANT1 = 1

int8 data


I record the message into a bag file. Let's call the bag bag1.

Then, I make a first change to the message definition and the message becomes like this (msgdef2):

int8 MY_CONSTANT1 = 1
int8 MY_CONSTANT2 = 2

int8 data


I record the new message into a bag file. Let's call the bag bag2.

When I do a rosbag check on bag2, or try to make a migration rule from the message definition, it says that I don't need a migration rule. However, the checksums are different because of the constant that has changed. Therefore, I need to fix the bag. I can rosbag fix on bag2 and the bag is converted successfully. Everything is fine so far.

Let's assume I make this change (msgdef3):

int8 MY_CONSTANT1 = 1
int8 MY_CONSTANT2 = 2

int8 data
int8 new_data


So now, I can create a rule from msgdef2 to msgdef3. If I try to convert bag2 to the new format, it works. However, if I try to convert bag1 to use msgdef3 it doesn't work because its missing the step from msgdef1 to msgdef2. The problem I am facing is that ROS utilities won't allow to create a rule if only the constant(s) has/have changed in the message definition. Therefore, to be able to migrate bag1 to the latest message definition, I need to manually create a rule to handle the msgdef1 to msgdef2 conversion. Is this use case something that wasn't considered for converting bag files? Is there a better way to do this?

Thanks!

edit retag close merge delete