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 1 You must be signed in to fork a gist
  • Save mintar/cabd026f1ad488e19242ea07f2eec285 to your computer and use it in GitHub Desktop.
Save mintar/cabd026f1ad488e19242ea07f2eec285 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import rosbag
import sys
inbag_name = sys.argv[1]
outbag_name = inbag_name.replace('.bag', '-fixed.bag')
with rosbag.Bag(outbag_name, 'w') as outbag:
for topic, msg, t in rosbag.Bag(inbag_name).read_messages():
if topic == "/camera/depth_registered/points_drop" and msg.header.frame_id:
msg.header.frame_id = "/kinect_rgb_optical_frame"
outbag.write("/kinect/depth_registered/points_drop", msg, t)
else:
outbag.write(topic, msg, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment