def test_prop_single_diff(): rover_nm = [t.NavigationMeasurement(sat_pos=[-19277207.52067729, -8215764.2479763795, 16367744.770246204], pseudorange=21123480.27105955, doppler=0, raw_doppler=0, carrier_phase=-110993309.26669005, sat_vel=[-1025.0370403901404, -1821.9217799467374, -2091.6303199092254], lock_time=0, tot=ti.GpsTime(wn=1876, tow=167131.92954684512), raw_pseudorange=21121324.476403236, raw_carrier_phase=-110993309.26669005, snr=30.0, sid=s.GNSSSignal(code=0, sat=0), lock_counter=0), t.NavigationMeasurement(sat_pos=[-16580310.849158794, 918714.1939749047, 20731444.258332774], pseudorange=22432049.84763688, doppler=0, raw_doppler=0, carrier_phase=-117882743.21601027, sat_vel=[1060.9864205977192, -2411.43509917502, 953.6270954519971], lock_time=0, tot=ti.GpsTime(wn=1876, tow=167131.9251737675), raw_pseudorange=22432340.166121125, raw_carrier_phase=-117882743.21601027, snr=30.0, sid=s.GNSSSignal(code=0, sat=2), lock_counter=0)] base_nm = [t.NavigationMeasurement(sat_pos=[-19277279.74504115, -8215892.62052003, 16367597.39238895], pseudorange=21123480.27105955, doppler=0, raw_doppler=0, carrier_phase=-110993309.26669005, sat_vel=[-1025.03418813, -1821.90205153, -2091.65477547], lock_time=0, tot=ti.GpsTime(wn=1876, tow=167131.92954684512), raw_pseudorange=21121324.476403236, raw_carrier_phase=-110993309.26669005, snr=30.0, sid=s.GNSSSignal(code=0, sat=0), lock_counter=0), t.NavigationMeasurement(sat_pos=[-16580231.46081397, 918533.75723257, 20731515.61249766], pseudorange=22432049.84763688, doppler=0, raw_doppler=0, carrier_phase=-117882743.21601027, sat_vel=[1060.97989026, -2411.44777346, 953.59410165], lock_time=0, tot=ti.GpsTime(wn=1876, tow=167131.9251737675), raw_pseudorange=22432340.166121125, raw_carrier_phase=-117882743.21601027, snr=30.0, sid=s.GNSSSignal(code=0, sat=2), lock_counter=0)] remote_dists = np.array([ 21121393.87562408, 22432814.46819838]) base_pos = np.array( [-2704375, -4263211, 3884637]) sdiffs = o.make_propagated_sdiffs_(rover_nm, base_nm, remote_dists, base_pos) assert len(sdiffs) == 2 assert sdiffs[0].pseudorange > 0 assert sdiffs[1].pseudorange > 0 assert sdiffs[0].carrier_phase < 0 assert sdiffs[0].doppler > 0 assert sdiffs[0].sid['sat'] == 0 assert sdiffs[1].sid['sat'] == 2
def test_creation(): new_ref = s.GNSSSignal(sat=8, band=0, constellation=0) sids = [ s.GNSSSignal(sat=2, band=0, constellation=0), s.GNSSSignal(sat=1, band=0, constellation=0), s.GNSSSignal(sat=3, band=0, constellation=0), s.GNSSSignal(sat=4, band=0, constellation=0) ] sm = sat.SatsManagement(sids=sids) assert sm.num_sats assert sm.sids[0]['sat'] == 2 assert sm.sids[1]['sat'] == 1 assert sm.sids[2]['sat'] == 3 assert sm.sids[3]['sat'] == 4 assert not sm._print() assert not sm._print_short() sdiffs = [ o.SingleDiff(sid={ 'sat': 1, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=1), o.SingleDiff(sid={ 'sat': 2, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=5), o.SingleDiff(sid={ 'sat': 3, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=10) ] # TODO (Buro): Check outputs! assert sm.rebase(sdiffs) assert not sm.update(sdiffs)
def test_bad_measurements(): sids = [ s.GNSSSignal(sat=1, band=0, constellation=0), s.GNSSSignal(sat=2, band=0, constellation=0), s.GNSSSignal(sat=3, band=0, constellation=0), s.GNSSSignal(sat=5, band=0, constellation=0), s.GNSSSignal(sat=6, band=0, constellation=0) ] float_sats = sat.SatsManagement(sids=sids) sids = [ s.GNSSSignal(sat=3, band=0, constellation=0), s.GNSSSignal(sat=1, band=0, constellation=0), s.GNSSSignal(sat=2, band=0, constellation=0), s.GNSSSignal(sat=5, band=0, constellation=0), s.GNSSSignal(sat=6, band=0, constellation=0) ] amb_sats_init = sat.SatsManagement(sids=sids) test = a.AmbiguityTest(sats=float_sats) sdiffs = [ o.SingleDiff(sid={ 'sat': 1, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 2, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 3, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 4, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 5, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 6, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0) ]
def test_update_sats_same_sats(): sids = [ s.GNSSSignal(sat=3, band=0, constellation=0), s.GNSSSignal(sat=1, band=0, constellation=0), s.GNSSSignal(sat=2, band=0, constellation=0), s.GNSSSignal(sat=4, band=0, constellation=0) ] sm = sat.SatsManagement(sids=sids) test = a.AmbiguityTest(sats=sm) sdiffs = [ o.SingleDiff(sid={ 'sat': 1, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 2, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 3, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0), o.SingleDiff(sid={ 'sat': 4, 'band': 0, 'constellation': 0 }, pseudorange=0, sat_pos=(0, 0, 0), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, snr=0) ] assert not test.ambiguity_update_sats(sdiffs, None, None, None, None, False) assert test.sats['sids'][0]['sat'] == 3 assert test.sats['sids'][1]['sat'] == 1 assert test.sats['sids'][2]['sat'] == 2 assert test.sats['sids'][3]['sat'] == 4
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. from swiftnav.ephemeris import Ephemeris from swiftnav.pvt import calc_PVT_ import copy import numpy as np import pytest import swiftnav.time as ti import swiftnav.track as t import swiftnav.observation as o import swiftnav.signal as s nms = \ [t.NavigationMeasurement(sid=s.GNSSSignal(sat=9, code=0), pseudorange=23946993.888943646, raw_pseudorange=23946993.888943646, sat_pos=(-19477278.087422125, -7649508.9457812719, 16674633.163554827), sat_vel=(0, 0, 0), raw_carrier_phase=0, carrier_phase=0, raw_doppler=0, doppler=0, lock_counter=0, snr=0, lock_time=0, tot=ti.GpsTime(tow=0, wn=0)), t.NavigationMeasurement(sid=s.GNSSSignal(sat=1, code=0), pseudorange=22932174.156858064, raw_pseudorange=22932174.156858064, sat_pos=(-9680013.5408340245, -15286326.354385279, 19429449.383770257), sat_vel=(0, 0, 0), raw_carrier_phase=0, carrier_phase=0, raw_doppler=0, doppler=0, lock_counter=0, snr=0, lock_time=0, tot=ti.GpsTime(tow=0, wn=0)),
def test_prop_single_diff(): rover_nm = [ t.NavigationMeasurement(sat_pos=[ -19277207.52067729, -8215764.2479763795, 16367744.770246204 ], pseudorange=21123480.27105955, doppler=0, raw_doppler=0, carrier_phase=-110993309.26669005, sat_vel=[ -1025.0370403901404, -1821.9217799467374, -2091.6303199092254 ], lock_time=0, tot=ti.GpsTime(wn=1876, tow=167131.92954684512), raw_pseudorange=21121324.476403236, snr=30.0, sid=s.GNSSSignal(band=0, constellation=0, sat=0), lock_counter=0), t.NavigationMeasurement( sat_pos=[ -16580310.849158794, 918714.1939749047, 20731444.258332774 ], pseudorange=22432049.84763688, doppler=0, raw_doppler=0, carrier_phase=-117882743.21601027, sat_vel=[1060.9864205977192, -2411.43509917502, 953.6270954519971], lock_time=0, tot=ti.GpsTime(wn=1876, tow=167131.9251737675), raw_pseudorange=22432340.166121125, snr=30.0, sid=s.GNSSSignal(band=0, constellation=0, sat=2), lock_counter=0) ] remote_dists = np.array([21121393.87562408, 22432814.46819838]) base_pos = np.array([-2704375, -4263211, 3884637]) es = [ Ephemeris( **{ 'ura': 0.0, 'healthy': 1, 'xyz': { 'acc': [ -6.51925802230835e-08, 4.718410826464475e-09, 2.6226835183928943 ], 'iod': 0, 'a_gf0': 5153.648313522339, 'a_gf1': 0.5977821557062277, 'pos': [5.122274160385132e-09, 19.0625, 259.9375], 'rate': [ 1.0151416063308716e-06, 6.260350346565247e-06, -6.332993507385254e-08 ], 'toa': 4096 }, 'valid': 1, 'sid': { 'band': 0, 'constellation': 0, 'sat': 0 }, 'toe': { 'wn': 1876, 'tow': 172800.0 }, 'kepler': { 'inc_dot': 4.4966158735287064e-10, 'tgd': 5.122274160385132e-09, 'omegadot': -8.099980253833005e-09, 'sqrta': 5153.648313522339, 'inc': 0.9634151551139846, 'cus': 6.260350346565247e-06, 'omega0': 0.5977821557062277, 'cuc': 1.0151416063308716e-06, 'm0': 2.6226835183928943, 'toc': { 'wn': 1876, 'tow': 172800.0 }, 'dn': 4.718410826464475e-09, 'ecc': 0.0049016030970960855, 'cic': -6.332993507385254e-08, 'crs': 19.0625, 'iode': 74, 'iodc': 21845, 'cis': -6.51925802230835e-08, 'crc': 259.9375, 'w': 0.4885959643259506, 'af0': 7.212162017822266e-06, 'af1': 9.094947017729282e-13, 'af2': 0.0 }, 'fit_interval': 4 }), Ephemeris( **{ 'ura': 0.0, 'healthy': 1, 'xyz': { 'acc': [ -6.146728992462158e-08, 4.742340394655613e-09, -0.8114190126645531 ], 'iod': 0, 'a_gf0': 5153.798839569092, 'a_gf1': 1.6390180338742641, 'pos': [1.862645149230957e-09, -40.5625, 221.625], 'rate': [ -2.2239983081817627e-06, 8.001923561096191e-06, 3.725290298461914e-09 ], 'toa': 0 }, 'valid': 1, 'sid': { 'band': 0, 'constellation': 0, 'sat': 2 }, 'toe': { 'wn': 1876, 'tow': 172800.0 }, 'kepler': { 'inc_dot': -4.475186409476941e-10, 'tgd': 1.862645149230957e-09, 'omegadot': -8.103551831174965e-09, 'sqrta': 5153.798839569092, 'inc': 0.9587534715647247, 'cus': 8.001923561096191e-06, 'omega0': 1.6390180338742641, 'cuc': -2.2239983081817627e-06, 'm0': -0.8114190126645531, 'toc': { 'wn': 1876, 'tow': 172800.0 }, 'dn': 4.742340394655613e-09, 'ecc': 0.00035172002390027046, 'cic': 3.725290298461914e-09, 'crs': -40.5625, 'iode': 59, 'iodc': 21845, 'cis': -6.146728992462158e-08, 'crc': 221.625, 'w': 2.9037284161724037, 'af0': -9.969808161258698e-07, 'af1': -5.229594535194337e-12, 'af2': 0.0 }, 'fit_interval': 4 }) ] gpst = ti.GpsTime(wn=1876, tow=167132) sdiffs = o.make_propagated_sdiffs_(rover_nm, rover_nm, remote_dists, base_pos, es, gpst) assert len(sdiffs) == 2 assert sdiffs[0].pseudorange > 0 assert sdiffs[1].pseudorange > 0 assert sdiffs[0].carrier_phase < 0 assert sdiffs[0].doppler > 0 assert sdiffs[0].sid['sat'] == 0 assert sdiffs[1].sid['sat'] == 2
# # THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. from swiftnav.ephemeris import Ephemeris from swiftnav.pvt import calc_PVT_ import numpy as np import pytest import swiftnav.time as ti import swiftnav.track as t import swiftnav.observation as o import swiftnav.signal as s nms = \ [t.NavigationMeasurement(sid=s.GNSSSignal(sat=9, band=0, constellation=0), pseudorange=23946993.888943646, raw_pseudorange=23946993.888943646, sat_pos=(-19477278.087422125, -7649508.9457812719, 16674633.163554827), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, lock_counter=0, snr=0, lock_time=0, tot=ti.GpsTime(tow=0, wn=0)), t.NavigationMeasurement(sid=s.GNSSSignal(sat=1, band=0, constellation=0), pseudorange=22932174.156858064, raw_pseudorange=22932174.156858064, sat_pos=(-9680013.5408340245, -15286326.354385279, 19429449.383770257), sat_vel=(0, 0, 0), carrier_phase=0, raw_doppler=0, doppler=0, lock_counter=0, snr=0, lock_time=0, tot=ti.GpsTime(tow=0, wn=0)),