Skip to content

Commit d5a9382

Browse files
committed
handle no information NLOS in smartLoc
1 parent d4f0b08 commit d5a9382

3 files changed

Lines changed: 51 additions & 8 deletions

File tree

data/unit_test/tu_chemnitz_berlin_1_raw.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ GPSWeek [weeks];GPSSecondsOfWeek [s];Longitude (GT Lon) [deg];Longitude Cov (GT
1515
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;21265103.5823198;111748873.136693;-2225.042;GPS;24;0;20;46;5.12;0.02;2.048;1;0
1616
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;25078409.3557325;131787929.664155;-3107.812;GPS;17;0;0;34;20.48;0.06;8.192;1;1
1717
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;23477506.8316879;123375127.134657;2838.583;GPS;2;0;620;40;5.12;0.028;2.048;3;1
18-
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;21244265.3088298;111639366.963273;2518.071;GPS;25;0;0;29;10.24;0.06;4.096;1;1
18+
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;21244265.3088298;111639366.963273;2518.071;GPS;25;0;0;29;10.24;0.06;4.096;1;#
1919
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;23856563.6330063;125367091.970488;4087.463;GPS;29;0;18020;45;0.64;0.004;0.256;7;0
2020
1900;126641.499999971;13.3736577411555;7.76122581087713E-06;52.504560220676;6.07869197881139E-05;76.0045786043629;6.29563927005569E-06;1.24862086922803;1.26814020681675E-07;0.926577670979896;0.033529381550356;5.70623813848943;0.000242438557332;0.001159096629777;4.83289530290242E-06;126641.499999971;1900;17;19;1;39064567.9338026;205285685.12458;297.7017;SBAS;120;0;22400;38;0.64;0.004;0.256;7;1
2121
1900;126641.699999971;13.3736627708313;8.48649139289577E-06;52.5045700667812;2.14841165195449E-05;76.0109336772002;6.49893806177743E-06;1.24850033690745;1.24206077549312E-07;0.817891964201408;0.033520597472269;5.87869895162294;0.000244062630444;-0.006097359125874;4.83221090156567E-06;126641.699999971;1900;17;19;1;19834589.6522187;104231461.634255;221.9409;GPS;12;0;64500;49;0.32;0.004;0.128;15;0
@@ -55,7 +55,7 @@ GPSWeek [weeks];GPSSecondsOfWeek [s];Longitude (GT Lon) [deg];Longitude Cov (GT
5555
1900;126641.999999971;13.3736706368836;9.55423586761847E-06;52.5045852766343;5.68575971200413E-05;76.0209010224789;6.83321907497391E-06;1.2438438454119;1.2082266905476E-07;0.655158207700879;0.033528542665454;6.09507477277657;0.000242434675261;-0.017921329576893;4.83145653325631E-06;126641.999999971;1900;17;18;1;21244025.1022201;111638104.929202;2511.509;GPS;25;0;0;21;20.48;0.06;8.192;1;1
5656
1900;126641.999999971;13.3736706368836;9.55423586761847E-06;52.5045852766343;5.68575971200413E-05;76.0209010224789;6.83321907497391E-06;1.2438438454119;1.2082266905476E-07;0.655158207700879;0.033528542665454;6.09507477277657;0.000242434675261;-0.017921329576893;4.83145653325631E-06;126641.999999971;1900;17;18;1;23856174.754904;125365048.485882;4085.602;GPS;29;0;18520;46;0.64;0.004;0.256;7;0
5757
1900;126641.999999971;13.3736706368836;9.55423586761847E-06;52.5045852766343;5.68575971200413E-05;76.0209010224789;6.83321907497391E-06;1.2438438454119;1.2082266905476E-07;0.655158207700879;0.033528542665454;6.09507477277657;0.000242434675261;-0.017921329576893;4.83145653325631E-06;126641.999999971;1900;17;18;1;39064539.712438;205285536.588225;297.1433;SBAS;120;0;22900;40;0.64;0.004;0.256;7;1
58-
1900;126642.199999971;13.3736761025676;1.0266827129563E-05;52.5045954316559;6.12486413088635E-06;76.0277935978957;7.07500490845495E-06;1.24040398927173;1.18895715983536E-07;0.57562925809907;0.033474318069298;6.2159202832845;0.000241475888126;-0.016862766152372;4.83106492094534E-06;126642.199999971;1900;17;18;1;19834568.3585905;104231350.751478;221.7419;GPS;12;0;64500;49;0.32;0.004;0.128;15;0
58+
1900;126642.199999971;13.3736761025676;1.0266827129563E-05;52.5045954316559;6.12486413088635E-06;76.0277935978957;7.07500490845495E-06;1.24040398927173;1.18895715983536E-07;0.57562925809907;0.033474318069298;6.2159202832845;0.000241475888126;-0.016862766152372;4.83106492094534E-06;126642.199999971;1900;17;18;1;19834568.3585905;104231350.751478;221.7419;GPS;12;0;64500;49;0.32;0.004;0.128;15;#
5959
1900;126642.199999971;13.3736761025676;1.0266827129563E-05;52.5045954316559;6.12486413088635E-06;76.0277935978957;7.07500490845495E-06;1.24040398927173;1.18895715983536E-07;0.57562925809907;0.033474318069298;6.2159202832845;0.000241475888126;-0.016862766152372;4.83106492094534E-06;126642.199999971;1900;17;18;1;19784425.1288151;105796223.038639;2215.248;Glonass;20;9;21100;47;1.28;0.012;0.512;7;0
6060
1900;126642.199999971;13.3736761025676;1.0266827129563E-05;52.5045954316559;6.12486413088635E-06;76.0277935978957;7.07500490845495E-06;1.24040398927173;1.18895715983536E-07;0.57562925809907;0.033474318069298;6.2159202832845;0.000241475888126;-0.016862766152372;4.83106492094534E-06;126642.199999971;1900;17;18;1;22692778.5713973;121093013.883917;1262.786;Glonass;2;3;140;28;10.24;0.028;4.096;3;1
6161
1900;126642.199999971;13.3736761025676;1.0266827129563E-05;52.5045954316559;6.12486413088635E-06;76.0277935978957;7.07500490845495E-06;1.24040398927173;1.18895715983536E-07;0.57562925809907;0.033474318069298;6.2159202832845;0.000241475888126;-0.016862766152372;4.83106492094534E-06;126642.199999971;1900;17;18;1;22636156.3142782;118953803.474665;-2781.141;GPS;19;0;120;48;2.56;0.016;1.024;3;0
@@ -276,7 +276,7 @@ GPSWeek [weeks];GPSSecondsOfWeek [s];Longitude (GT Lon) [deg];Longitude Cov (GT
276276
1900;126644.699999971;13.3737528739026;1.72540386355625E-05;52.5047361165634;3.72494489267877E-05;76.1002339315601;1.27300932889936E-05;1.23059283207112;1.09200528507944E-07;0.004401746290284;0.033647816244823;6.79675773729105;0.000260777877192;0.003043568318105;4.83024382731984E-06;126644.699999971;1900;17;17;1;25080305.6490815;131797895.372687;-3103.288;GPS;17;0;40;34;10.24;0.028;4.096;1;1
277277
1900;126644.699999971;13.3737528739026;1.72540386355625E-05;52.5047361165634;3.72494489267877E-05;76.1002339315601;1.27300932889936E-05;1.23059283207112;1.09200528507944E-07;0.004401746290284;0.033647816244823;6.79675773729105;0.000260777877192;0.003043568318105;4.83024382731984E-06;126644.699999971;1900;17;17;1;23475770.4128713;123366020.315251;2838.054;GPS;2;0;220;40;5.12;0.024;2.048;3;1
278278
1900;126644.699999971;13.3737528739026;1.72540386355625E-05;52.5047361165634;3.72494489267877E-05;76.1002339315601;1.27300932889936E-05;1.23059283207112;1.09200528507944E-07;0.004401746290284;0.033647816244823;6.79675773729105;0.000260777877192;0.003043568318105;4.83024382731984E-06;126644.699999971;1900;17;17;1;21242772.4514273;111631522.460852;2514.472;GPS;25;0;0;22;20.48;0.06;8.192;1;1
279-
1900;126644.699999971;13.3737528739026;1.72540386355625E-05;52.5047361165634;3.72494489267877E-05;76.1002339315601;1.27300932889936E-05;1.23059283207112;1.09200528507944E-07;0.004401746290284;0.033647816244823;6.79675773729105;0.000260777877192;0.003043568318105;4.83024382731984E-06;126644.699999971;1900;17;17;1;23854076.9202652;125354024.770602;4082.52;GPS;29;0;21220;46;0.64;0.004;0.256;7;0
279+
1900;126644.699999971;13.3737528739026;1.72540386355625E-05;52.5047361165634;3.72494489267877E-05;76.1002339315601;1.27300932889936E-05;1.23059283207112;1.09200528507944E-07;0.004401746290284;0.033647816244823;6.79675773729105;0.000260777877192;0.003043568318105;4.83024382731984E-06;126644.699999971;1900;17;17;1;23854076.9202652;125354024.770602;4082.52;GPS;29;0;21220;46;0.64;0.004;0.256;7;#
280280
1900;126644.699999971;13.3737528739026;1.72540386355625E-05;52.5047361165634;3.72494489267877E-05;76.1002339315601;1.27300932889936E-05;1.23059283207112;1.09200528507944E-07;0.004401746290284;0.033647816244823;6.79675773729105;0.000260777877192;0.003043568318105;4.83024382731984E-06;126644.699999971;1900;17;17;1;39064388.9163814;205284744.111719;294.311;SBAS;120;0;25600;42;0.64;0.004;0.256;7;1
281281
1900;126644.899999971;13.373759111502;1.70330304243928E-05;52.5047474900436;3.00829323688218E-05;76.1027358006686;1.35879955988611E-05;1.231377550037;1.094744829659E-07;0.054022141182031;0.033659582420191;6.80412263056496;0.000263056312665;0.005455440172796;4.83037386163492E-06;126644.899999971;1900;17;18;1;19834455.0805021;104230753.810774;220.7175;GPS;12;0;64500;51;0.32;0.004;0.128;15;0
282282
1900;126644.899999971;13.373759111502;1.70330304243928E-05;52.5047474900436;3.00829323688218E-05;76.1027358006686;1.35879955988611E-05;1.231377550037;1.094744829659E-07;0.054022141182031;0.033659582420191;6.80412263056496;0.000263056312665;0.005455440172796;4.83037386163492E-06;126644.899999971;1900;17;18;1;19783308.0662142;105790245.956939;2210.978;Glonass;20;9;23800;44;1.28;0.008;0.512;7;0

gnss_lib_py/parsers/smart_loc.py

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ def postprocess(self):
6666
"GPSSecondsOfWeek [s]"
6767
],inplace=True)
6868

69+
# change all NLOS columns to be integers
70+
nlos_idx = 'NLOS (0 == no, 1 == yes, # == No Information)'
71+
nlos_new = 'NLOS (0 == no, 1 == yes, 2 == No Information)'
72+
if self.is_str(nlos_idx) and '#' in np.unique(self[nlos_idx]):
73+
# replace '#' values with 2 and convert to ints
74+
self[nlos_idx] = np.where(self[nlos_idx]=='#',
75+
'2',self[nlos_idx]).astype(int)
76+
self.rename({nlos_idx:nlos_new},inplace=True)
6977

7078
@staticmethod
7179
def _row_map():
@@ -100,7 +108,28 @@ def _row_map():
100108
return row_map
101109

102110
def remove_nlos(smartloc_raw):
103-
"""Remove NLOS measurements from SmartLoc data instance.
111+
"""Remove NLOS and 'no information' measurements from SmartLoc.
112+
113+
The dataset's paper[1]_ says the following about their NLOS
114+
classification process:
115+
"The NovAtel receiver is also able to provide raw measurement
116+
(pseudorange) information like the u-blox receiver. The
117+
u-blox receiver provide information about all received satellite
118+
signals. The NovAtel receiver seems to exclude some satellites
119+
in harsh environments, which might be affected by NLOS.
120+
NovAtel used for receiving a Pinwheel antenna and internally
121+
different algorithms. Hence, we use this information to build a
122+
NLOS detection based on different satellites availabilities in
123+
both receivers. Therefore, we remember the last received set
124+
of satellites from NovAtel and time of data. When we receive
125+
in next step a set of satellites from u-blox, we compare the
126+
availability of each satellite and time span since the last update
127+
from the NovAtel. If the time span is too high or the satellite
128+
was never seen before, the pseudorange measurement or satellite
129+
marked as NLOS. In the other case, the measurement marked
130+
as LOS. This approach gives a hint for the type of LOS or
131+
NLOS of a given measurement and we export this information
132+
to complete the datasets."
104133
105134
Parameters
106135
----------
@@ -112,9 +141,17 @@ def remove_nlos(smartloc_raw):
112141
smartloc_los : gnss_lib_py.parsers.navdata.NavData
113142
Instance of NavData containing only LOS labeled measurements
114143
144+
References
145+
----------
146+
.. [1] Reisdorf, Pierre, Tim Pfeifer, Julia Bressler, Sven Bauer,
147+
Peter Weissig, Sven Lange, Gerd Wanielik and Peter Protzel.
148+
The Problem of Comparable GNSS Results – An Approach for a
149+
Uniform Dataset with Low-Cost and Reference Data. Vehicular.
150+
2016.
151+
115152
"""
116-
smartloc_los = smartloc_raw.where('NLOS (0 == no, 1 == yes, # == No Information)',
117-
1, 'eq')
153+
smartloc_los = smartloc_raw.where('NLOS (0 == no, 1 == yes, 2 == No Information)',
154+
0, 'eq')
118155
return smartloc_los
119156

120157
def calculate_gt_ecef(smartloc_raw):
@@ -133,6 +170,7 @@ def calculate_gt_ecef(smartloc_raw):
133170
"""
134171
llh = smartloc_raw[['lat_rx_gt_deg', 'lon_rx_gt_deg', 'alt_rx_gt_m']]
135172
rx_ecef = geodetic_to_ecef(llh)
173+
smartloc_raw = smartloc_raw.copy()
136174
smartloc_raw['x_rx_gt_m'] = rx_ecef[0, :]
137175
smartloc_raw['y_rx_gt_m'] = rx_ecef[1, :]
138176
smartloc_raw['z_rx_gt_m'] = rx_ecef[2, :]
@@ -176,6 +214,7 @@ def calculate_gt_vel(smartloc_raw):
176214
vel_acc['ax_rx_gt_mps2'].extend(np.repeat(acc_ecef[0, 0], len(measure_frame)))
177215
vel_acc['ay_rx_gt_mps2'].extend(np.repeat(acc_ecef[1, 0], len(measure_frame)))
178216
vel_acc['az_rx_gt_mps2'].extend(np.repeat(acc_ecef[2, 0], len(measure_frame)))
217+
smartloc_raw = smartloc_raw.copy()
179218
for row, values in vel_acc.items():
180219
smartloc_raw[row] = values
181220
return smartloc_raw

tests/parsers/test_smart_loc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,12 @@ def test_smartloc_raw_df_equivalence(smartloc_raw, pd_df):
115115
measure_df["heading_rx_gt_rad"] = wrap_0_to_2pi(measure_df["heading_rx_gt_rad"])
116116
inverse_row_map = {v : k for k,v in smartloc_raw._row_map().items()}
117117
measure_df.rename(columns=inverse_row_map, inplace=True)
118+
nlos_idx = 'NLOS (0 == no, 1 == yes, # == No Information)'
119+
nlos_new = 'NLOS (0 == no, 1 == yes, 2 == No Information)'
120+
measure_df.rename(columns={nlos_new:nlos_idx}, inplace=True)
118121
measure_df.drop(columns='gps_millis',inplace=True)
119122
pd_df['GNSS identifier (gnssId) []'] = pd_df['GNSS identifier (gnssId) []'].str.lower()
123+
pd_df[nlos_idx] = pd.to_numeric(pd_df[nlos_idx].replace('#','2'))
120124
pd_df.drop(columns="GPSWeek [weeks]",inplace=True)
121125
pd_df.drop(columns="GPSSecondsOfWeek [s]",inplace=True)
122126
pd.testing.assert_frame_equal(pd_df.sort_index(axis=1),
@@ -227,8 +231,8 @@ def test_nlos_removal(smartloc_raw):
227231
new_shape = smartloc_los_new.shape
228232
# Ensure that size decreases on removing NLOS satellites
229233
assert first_shape[1] >= old_shape[1]
230-
# Ensure that only NLOS satellites remain in the new NavData
231-
assert np.sum(smartloc_los_new['NLOS (0 == no, 1 == yes, # == No Information)']) \
234+
# Ensure that only LOS satellites remain in the new NavData
235+
assert len(smartloc_los_new) - np.sum(smartloc_los_new['NLOS (0 == no, 1 == yes, 2 == No Information)']) \
232236
== new_shape[1]
233237
# Assert that no rows are removed when removing NLOS measurements
234238
np.testing.assert_equal(first_shape[0], old_shape[0])

0 commit comments

Comments
 (0)