in a2d2/src/rosbag_producer.py [0:0]
def __record_ros_msg(self, topic=None, msg=None, ts=None, s3_client=None):
try:
if self.bag_lock:
self.bag_lock.acquire()
topic, msg, ts = self.__next_round_robin_topic(topic=topic, msg=msg, ts=ts)
if topic and msg and ts:
self.__write_ros_msg_to_bag(topic=topic, msg=msg, ts=ts, s3_client=s3_client)
sensor_topics = [k for k in self.topic_active.keys() if k != self.bus_topic and self.__is_topic_alive(k)]
if (len(self.round_robin) >= len(sensor_topics)) and self.round_robin:
self.round_robin.pop(0)
except Exception as _:
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_tb(exc_traceback, limit=20, file=sys.stdout)
self.logger.error(str(exc_type))
self.logger.error(str(exc_value))
raise
finally:
if self.bag_lock:
self.bag_lock.release()