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

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 ( http://wiki.ros.org/rosbag/migration ) and rosbag fix?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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 http://wiki.ros.org/rosbag/migration ) :

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

Question Tools

1 follower

Stats

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

Seen: 234 times

Last updated: Mar 06 '15