1414import pandas as pd
1515
1616from gnss_lib_py .parsers .navdata import NavData
17+ from gnss_lib_py .utils .coordinates import wrap_0_to_2pi
1718from gnss_lib_py .utils .coordinates import geodetic_to_ecef
1819from gnss_lib_py .utils .coordinates import ecef_to_geodetic
1920from gnss_lib_py .utils .time_conversions import unix_to_gps_millis
@@ -271,14 +272,18 @@ def postprocess(self):
271272 https://www.kaggle.com/code/gymf123/tips-notes-from-the-competition-hosts
272273 """
273274 # Correcting reported altitude
274- self ['alt_gt_m ' ] = self ['alt_gt_m ' ] - 61.
275- gt_lla = np .transpose (np .vstack ([self ['lat_gt_deg ' ],
276- self ['lon_gt_deg ' ],
277- self ['alt_gt_m ' ]]))
275+ self ['alt_rx_gt_m ' ] = self ['alt_rx_gt_m ' ] - 61.
276+ gt_lla = np .transpose (np .vstack ([self ['lat_rx_gt_deg ' ],
277+ self ['lon_rx_gt_deg ' ],
278+ self ['alt_rx_gt_m ' ]]))
278279 gt_ecef = geodetic_to_ecef (gt_lla )
279- self ["x_gt_m" ] = gt_ecef [:,0 ]
280- self ["y_gt_m" ] = gt_ecef [:,1 ]
281- self ["z_gt_m" ] = gt_ecef [:,2 ]
280+ self ["x_rx_gt_m" ] = gt_ecef [:,0 ]
281+ self ["y_rx_gt_m" ] = gt_ecef [:,1 ]
282+ self ["z_rx_gt_m" ] = gt_ecef [:,2 ]
283+
284+ # convert bearing degrees to heading in radians
285+ self ["heading_rx_gt_rad" ] = np .deg2rad (self ["heading_rx_gt_rad" ])
286+ self ["heading_rx_gt_rad" ] = wrap_0_to_2pi (self ["heading_rx_gt_rad" ])
282287
283288 @staticmethod
284289 def _row_map ():
@@ -289,10 +294,12 @@ def _row_map():
289294 row_map : Dict
290295 Dictionary of the form {old_name : new_name}
291296 """
292- row_map = {'latDeg' : 'lat_gt_deg' ,
293- 'lngDeg' : 'lon_gt_deg' ,
294- 'heightAboveWgs84EllipsoidM' : 'alt_gt_m' ,
295- 'millisSinceGpsEpoch' : 'gps_millis'
297+ row_map = {'latDeg' : 'lat_rx_gt_deg' ,
298+ 'lngDeg' : 'lon_rx_gt_deg' ,
299+ 'heightAboveWgs84EllipsoidM' : 'alt_rx_gt_m' ,
300+ 'millisSinceGpsEpoch' : 'gps_millis' ,
301+ 'speedMps' : 'v_rx_gt_mps' ,
302+ 'courseDegree' : 'heading_rx_gt_rad' ,
296303 }
297304 return row_map
298305
@@ -309,20 +316,24 @@ def postprocess(self):
309316 Notes
310317 -----
311318 """
312- if np .any (np .isnan (self ['alt_gt_m ' ])):
319+ if np .any (np .isnan (self ['alt_rx_gt_m ' ])):
313320 warnings .warn ("Some altitude values were missing, using 0m " , RuntimeWarning )
314- self ['alt_gt_m ' ] = np .nan_to_num (self ['alt_gt_m ' ])
315- gt_lla = np .transpose (np .vstack ([self ['lat_gt_deg ' ],
316- self ['lon_gt_deg ' ],
317- self ['alt_gt_m ' ]]))
321+ self ['alt_rx_gt_m ' ] = np .nan_to_num (self ['alt_rx_gt_m ' ])
322+ gt_lla = np .transpose (np .vstack ([self ['lat_rx_gt_deg ' ],
323+ self ['lon_rx_gt_deg ' ],
324+ self ['alt_rx_gt_m ' ]]))
318325 gt_ecef = geodetic_to_ecef (gt_lla )
319- self ["x_gt_m " ] = gt_ecef [:,0 ]
320- self ["y_gt_m " ] = gt_ecef [:,1 ]
321- self ["z_gt_m " ] = gt_ecef [:,2 ]
326+ self ["x_rx_gt_m " ] = gt_ecef [:,0 ]
327+ self ["y_rx_gt_m " ] = gt_ecef [:,1 ]
328+ self ["z_rx_gt_m " ] = gt_ecef [:,2 ]
322329
323330 # add gps milliseconds
324331 self ["gps_millis" ] = unix_to_gps_millis (self ['unix_millis' ])
325332
333+ # convert bearing degrees to heading in radians
334+ self ["heading_rx_gt_rad" ] = np .deg2rad (self ["heading_rx_gt_rad" ])
335+ self ["heading_rx_gt_rad" ] = wrap_0_to_2pi (self ["heading_rx_gt_rad" ])
336+
326337 @staticmethod
327338 def _row_map ():
328339 """Map row names from loaded data to gnss_lib_py standard
@@ -332,10 +343,13 @@ def _row_map():
332343 row_map : Dict
333344 Dictionary of the form {old_name : new_name}
334345 """
335- row_map = {'LatitudeDegrees' : 'lat_gt_deg' ,
336- 'LongitudeDegrees' : 'lon_gt_deg' ,
337- 'AltitudeMeters' : 'alt_gt_m' ,
338- 'UnixTimeMillis' : 'unix_millis'
346+ row_map = {'LatitudeDegrees' : 'lat_rx_gt_deg' ,
347+ 'LongitudeDegrees' : 'lon_rx_gt_deg' ,
348+ 'AltitudeMeters' : 'alt_rx_gt_m' ,
349+ 'SpeedMps' : 'v_rx_gt_mps' ,
350+ 'BearingDegrees' : 'heading_rx_gt_rad' ,
351+ 'UnixTimeMillis' : 'unix_millis' ,
352+
339353 }
340354 return row_map
341355
0 commit comments