Skip to content

Instantly share code, notes, and snippets.

@janpaul123
Created January 7, 2020 23:17
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Read an "input.bag" ROS bag with messages stored in arbitrary order, and write to "output.bag" ordered by receive time (required by Webviz to read)
import rosbag
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
outbag.write(topic, msg, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment