Ask Your Question

bag migration, fill new field with incrementing counter

asked 2015-03-06 02:04:52 -0500

Wolf gravatar image

Is it possible to fill a new message field in an old bag data with an incrementing counter using a bag migration rules file ( ) and rosbag fix?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-06 07:01:33 -0500

Wolf gravatar image

Yep it is (as simple as it should be)! Just create a counter and increment and assign it i update()

Snippet of the migration rules class, ( see ) :

migrated_types = [  ]

valid = True

counter = 0

def update(self, old_msg, new_msg):
    self.counter += 1
    new_msg.obj_id = self.counter
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

1 follower


Asked: 2015-03-06 02:04:52 -0500

Seen: 193 times

Last updated: Mar 06 '15