Example #1
0
    def rosbaginfo(self, req):
        response = RecordingGetBagInfoResponse()
        response.filesize = int(os.path.getsize(req.filename) / 1e+6)

        bag = Bag(req.filename, 'r')
        response.filename = req.filename
        response.starttime = bag.get_start_time()
        response.endtime = bag.get_end_time()
        response.topics = []

        topicmap = bag.get_type_and_topic_info()[1]
        for topic in topicmap.keys():
            topicinfo = BagTopicInfo()
            topicinfo.topicname = topic
            topicinfo.messagecount = topicmap[topic].message_count
            response.topics.append(topicinfo)
        return response
Example #2
0
    def analyze(file_path):
        try:
            bag = Bag(file_path)
            dataset_candidates = []
            for topic_name, info in bag.get_type_and_topic_info().topics.items(
            ):
                if info.msg_type in MSG_DATA_TYPE_MAP.keys():
                    candidate = {
                        "analyzed_info": {
                            "topic_name": topic_name,
                            "msg_type": info.msg_type,
                        },
                        "data_type": MSG_DATA_TYPE_MAP[info.msg_type],
                        "frame_count": info.message_count
                    }
                    dataset_candidates.append(candidate)

            return dataset_candidates
        except Exception as e:
            # FIXME
            raise (e)
 def analyze(cls, file_path, label_type):
     try:
         bag = Bag(file_path)
         dataset_candidates = []
         for topic_name, info in bag.get_type_and_topic_info().topics.items(
         ):
             if info.msg_type in MSG_DATA_TYPE_MAP.keys():
                 candidate = {
                     "analyzed_info": {
                         "topic_name": topic_name,
                         "msg_type": info.msg_type,
                     },
                     "data_type": MSG_DATA_TYPE_MAP[info.msg_type],
                     "frame_count": info.message_count
                 }
                 dataset_candidates.append(candidate)
         if cls.__is_label_type_valid(dataset_candidates, label_type):
             return dataset_candidates, 'analyzed'
         return [], 'invalid'
     except Exception as e:
         # FIXME
         raise (e)