TU Chemnitz SmartLoc

Open In Colab

This tutorial shows how to load data from TU Chemnitz’s smartLoc GNSS Dataset.

Load gnss_lib_py into the Python workspace

[1]:
import gnss_lib_py as glp
[2]:
# download cropped SmartLoc data file
glp.make_dir("../data")
!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/smartloc/tu_chemnitz_berlin_1_raw.csv --quiet -nc -O "../data/smartloc.csv"

# load smartLoc data into NavData object
smartloc_data = glp.SmartLocRaw("../data/smartloc.csv")
[3]:
# plot the pseudorange over time of each individual satellite
# SBAS 120 is the outlier with its larger orbit
fig = glp.plot_metric(smartloc_data, "gps_millis","raw_pr_m", groupby="sv_id")
../../_images/tutorials_parsers_tutorials_smartloc_notebook_6_0.png
[4]:
# show the ground truth smartLoc data on a map
fig = glp.plot_map(smartloc_data)
fig.show()

We have also implemented some helper functions to process SmartlocRaw instances. 1. NLOS measurements, as specified in the measurements, can be removed easily using the remove_nlos method. 2. The ground truth measurements are in WGS-84 frame of reference by default and they can be converted to ECEF using calculate_gt_ecef. 3. Ground truth velocity and acceleration values are given as a set of local body-frame scalar value, combined with the heading angle of the vehicle. This can be easily converted to ECEF values using calculate_gt_vel.

All of these methods create a copy of the SmartLocRaw instance, which is a NavData instance with the additional rows calculated.

[5]:
# Remove NLOS
import gnss_lib_py.parsers.smartloc as sl
print('Total measurement instances:', len(smartloc_data))
smartloc_data_no_nlos = sl.remove_nlos(smartloc_data)
print('LOS measurement instances', len(smartloc_data_no_nlos))
Total measurement instances: 545
LOS measurement instances 279
[6]:
# Use wildcard index to show ECEF position row does not exist
try:
    glp.find_wildcard_indexes(smartloc_data, "x_*_m")
except KeyError as no_row_exp:
    print(no_row_exp)

# Compute ECEF ground truth position and show that row exists
smartloc_ecef_gt = sl.calculate_gt_ecef(smartloc_data)
print(glp.find_wildcard_indexes(smartloc_ecef_gt, "x_*_m"))
'Missing x_*_m row.'
{'x_*_m': ['x_rx_gt_m']}
[7]:
# Use wildcard index to show that ECEF velocity rows do not exist
try:
    glp.find_wildcard_indexes(smartloc_data, "vx_*_mps")
except KeyError as no_row_exp:
    print(no_row_exp)

# Use wildcard index to show that body frame velocity exists
print(glp.find_wildcard_indexes(smartloc_data, "v_*_mps"))

# Compute ECEF ground truth velocity and verify row exists
smartloc_vel_gt = sl.calculate_gt_vel(smartloc_data)
print(glp.find_wildcard_indexes(smartloc_vel_gt, "vx_*_mps"))
'Missing vx_*_mps row.'
{'v_*_mps': ['v_rx_gt_mps']}
{'vx_*_mps': ['vx_rx_gt_mps']}
[8]:
print(smartloc_data.rows)
['lon_rx_gt_deg', 'lon_sigma_rx_gt_deg', 'lat_rx_gt_deg', 'lat_sigma_rx_gt_deg', 'alt_rx_gt_m', 'alt_sigma_rx_gt_m', 'heading_rx_gt_rad', 'Heading Cov (0° = East, counterclockwise) - (GT Heading) [rad]', 'a_rx_gt_mps2', 'Acceleration Cov (GT Acceleration) [ms^2]', 'v_rx_gt_mps', 'Velocity Cov (GT Velocity) [m/s]', 'Yaw-Rate (GT Yaw-rate) [rad/s]', 'Yaw-Rate Cov (GT Yaw-rate) [rad/s]', 'gps_tow', 'gps_week', 'GPS leap seconds (leapS) [s]', 'Number of measurements to follow (numMeas) []', 'Receiver tracking status (recStat) []', 'raw_pr_m', 'Carrier phase measurement (cpMes) [cycles]', 'doppler_hz', 'gnss_id', 'sv_id', 'Frequency slot - only Glonass (freqId) []', 'Carrier phase locktime counter (locktime) [ms]', 'cn0_dbhz', 'raw_pr_sigma_m', 'Estimated carrier phase measurement standard deviation (cpStdev) [cycles]', 'doppler_sigma_hz', 'Tracking status (trkStat) []', 'gps_millis', 'NLOS (0 == no, 1 == yes, 2 == No Information)']