def update_location(self): location = self.sm['liveLocationKalman'] self.gps_ok = location.gpsOK localizer_valid = (location.status == log.LiveLocationKalman.Status.valid) and location.positionGeodetic.valid if localizer_valid: self.last_bearing = math.degrees(location.calibratedOrientationNED.value[2]) self.last_position = Coordinate(location.positionGeodetic.value[0], location.positionGeodetic.value[1])
def update_location(self): location = self.sm['liveLocationKalman'] laikad = self.sm['gnssMeasurements'] locationd_valid = (location.status == log.LiveLocationKalman.Status.valid ) and location.positionGeodetic.valid laikad_valid = laikad.positionECEF.valid and np.linalg.norm( laikad.positionECEF.std) < VALID_POS_STD self.localizer_valid = locationd_valid or laikad_valid self.gps_ok = location.gpsOK or laikad_valid if locationd_valid: self.last_bearing = math.degrees( location.calibratedOrientationNED.value[2]) self.last_position = Coordinate(location.positionGeodetic.value[0], location.positionGeodetic.value[1]) elif laikad_valid: geodetic = ecef2geodetic(laikad.positionECEF.value) self.last_position = Coordinate(geodetic[0], geodetic[1]) self.last_bearing = None