def find_bag_tracklets(directory, tracklet_dir): bag_tracklets = [] bags = bu.find_bags(directory) assert (len(bags) > 0) for bag in bags: tracklet_path = find_tracklet(bag, tracklet_dir) if tracklet_path is not None: bag_tracklets.append(BagTracklet(bag, tracklet_path)) return bag_tracklets
def main(argv=None): if not tf.gfile.Exists(FLAGS.out_dir): tf.gfile.MakeDirs(FLAGS.out_dir) if FLAGS.bag_file: print('Processing single bag. {}'.format(FLAGS.bag_file)) process_bag(FLAGS.bag_file) elif FLAGS.bag_dir: print('Processing bag folder. {}'.format(FLAGS.bag_dir)) bags = bu.find_bags(FLAGS.bag_dir) for bag in bags: process_bag(bag) else: print('Neither bag_file nor bag_dir specified.')
def convert_bag_help(self, input_bag): output_file = get_points_filename(bag) self.output_bag = rosbag.Bag(output_file, 'w') self.processor.read_bag(input_bag) # Allow last few messages to flow through self.on_lidar_msg() before closing output bag. time.sleep(3) with self.lock: self.output_bag.close() packet_count = bu.count_velodyne_packets(input_bag) points_count = bu.count_velodyne_points(output_file) missing_count = packet_count - points_count print('Missing={}. Read={}. Wrote={}. Output={}.'.format( missing_count, packet_count, points_count, output_file)) def on_lidar_msg(self, msg): with self.lock: self.output_bag.write('/velodyne_points', msg, msg.header.stamp) if __name__ == '__main__': bags = bu.find_bags('/data/') writer = VelodynePointBagWriter() for bag in bags: writer.convert_bag(bag)