Skip to content

Instantly share code, notes, and snippets.

@mintar
Created March 24, 2017 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mintar/7ef7a21c67c09546d2a7fc20c00a3e17 to your computer and use it in GitHub Desktop.
Save mintar/7ef7a21c67c09546d2a7fc20c00a3e17 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import rospy
import rosbag
# duration between the epoch and Oct 06 2012 17:15:38.30
TIME_OFFSET = rospy.Duration(1349536538.30)
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
t += TIME_OFFSET
outbag.write(topic, msg, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment