예제 #1
0
    def _process_NAV_POSLLH(self, data: UBXMessage):
        '''
        Process NAV-LLH sentence - Latitude, Longitude, Height.
        '''

        try:
            self.utc = UBXMessage.itow2utc(data.iTOW)
            self.lat = data.lat / 10**7
            self.lon = data.lon / 10**7
            self.alt = data.hMSL / 1000
            self.hacc = data.hAcc / 1000
            self.vacc = data.vAcc / 1000
            self.__app.frm_banner.update_banner(time=self.utc,
                                                lat=self.lat,
                                                lon=self.lon,
                                                alt=self.alt,
                                                hacc=self.hacc,
                                                vacc=self.vacc)

            if self.__app.frm_settings.get_settings()['webmap']:
                self.__app.frm_mapview.update_map(lat=self.lat,
                                                  lon=self.lon,
                                                  hacc=self.hacc,
                                                  vacc=self.vacc,
                                                  fix='3D',
                                                  static=False)
            else:
                self.__app.frm_mapview.update_map(lat=self.lat,
                                                  lon=self.lon,
                                                  hacc=self.hacc,
                                                  vacc=self.vacc,
                                                  fix='3D',
                                                  static=True)
        except ValueError:
            # self.__app.set_status(ube.UBXMessageError(err), "red")
            pass
예제 #2
0
    def _process_NAV_PVT(self, data: UBXMessage):
        '''
        Process NAV-PVT sentence -  Navigation position velocity time solution
        '''

        try:
            self.utc = UBXMessage.itow2utc(data.iTOW)
            self.lat = data.lat / 10**7
            self.lon = data.lon / 10**7
            self.alt = data.hMSL / 1000
            self.hacc = data.hAcc / 1000
            self.vacc = data.vAcc / 1000
            self.pdop = data.pDOP / 100
            self.sip = data.numSV
            self.speed = data.gSpeed / 1000  # m/s
            self.track = data.headMot / 10**5
            fix = UBXMessage.gpsfix2str(data.fixType)
            self.__app.frm_banner.update_banner(time=self.utc,
                                                lat=self.lat,
                                                lon=self.lon,
                                                alt=self.alt,
                                                hacc=self.hacc,
                                                vacc=self.vacc,
                                                dop=self.pdop,
                                                sip=self.sip,
                                                speed=self.speed,
                                                fix=fix,
                                                track=self.track)

            if self.__app.frm_settings.get_settings()['webmap']:
                self.__app.frm_mapview.update_map(lat=self.lat,
                                                  lon=self.lon,
                                                  hacc=self.hacc,
                                                  vacc=self.vacc,
                                                  fix='3D',
                                                  static=False)
            else:
                self.__app.frm_mapview.update_map(lat=self.lat,
                                                  lon=self.lon,
                                                  hacc=self.hacc,
                                                  vacc=self.vacc,
                                                  fix='3D',
                                                  static=True)

            if self.__app.frm_settings.get_settings()['recordtrack'] \
                and self.lat != '' and self.lon != '':
                time = datetime(data.year, data.month, data.day, data.hour,
                                data.min, data.second).isoformat() + 'Z'
                if fix == '3D':
                    fix = '3d'
                elif fix == '2D':
                    fix = '2d'
                else:
                    fix = 'none'
                self.__app.file_handler.add_trackpoint(self.lat,
                                                       self.lon,
                                                       ele=self.alt,
                                                       time=time,
                                                       fix=fix,
                                                       sat=self.sip,
                                                       pdop=self.pdop)
        except ValueError:
            # self.__app.set_status(ube.UBXMessageError(err), "red")
            pass
예제 #3
0
 def testitow2utc(self):
     res = str(UBXMessage.itow2utc(387092000))
     self.assertEqual(res, '11:31:16')