4 from tf.msg
import tfMessage
7 print 'Usage: $ python extract_stereo.py "2012-01-25-12-14-25"' 11 with
rosbag.Bag(bagName +
'_stereo.bag',
'w')
as outbag:
12 print 'Processing ' + bagName +
'.bag...' 13 leftCamInfoStatus =
True 14 leftImageStatus =
True 15 rightCamInfoStatus =
True 16 rightImageStatus =
True 17 for topic, msg, t
in rosbag.Bag(bagName +
'.bag').read_messages():
19 outbag.write(topic, msg, t)
20 elif topic ==
"/wide_stereo/left/camera_info":
22 outbag.write(topic, msg, t)
23 leftCamInfoStatus =
not leftCamInfoStatus
24 elif topic ==
"/wide_stereo/right/camera_info":
25 if rightCamInfoStatus:
26 outbag.write(topic, msg, t)
27 rightCamInfoStatus =
not rightCamInfoStatus
28 elif topic ==
"/wide_stereo/left/image_raw":
30 outbag.write(topic, msg, t)
31 leftImageStatus =
not leftImageStatus
32 elif topic ==
"/wide_stereo/right/image_raw":
34 outbag.write(topic, msg, t)
35 rightImageStatus =
not rightImageStatus
37 print 'Output: ' + bagName +
'_out.bag'