def __next_round_robin_topic()

in a2d2/src/rosbag_producer.py [0:0]


    def __next_round_robin_topic(self,  topic=None, msg=None, ts=None):
        # add message to topic queue
        self.topic_dict[topic].append(Qmsg(msg=msg, ts=ts))
                
        msg = None
        ts = None
        topic = None

        # round robin through topics
        _ntopics = len(self.topic_list)
        for _topic in self.topic_list:
            self.topic_index = (self.topic_index + 1) % _ntopics
            _topic = self.topic_list[ self.topic_index ]
            if _topic in self.round_robin and any([True for k in self.topic_active.keys() if not (k in self.round_robin) and self.__is_topic_alive(k)]):
                continue

            if self.topic_dict[_topic]:
                front = self.topic_dict[_topic].pop(0)
                msg = front.msg
                ts = front.ts
                topic = _topic
                break
        
        return topic, msg, ts