gps_helper¶

class
gps_helper.gps_helper.
GPSDataSource
(gps_tle_file, rx_sv_list=('PRN 03', 'PRN 09', 'PRN 22', 'PRN 26'), ref_lla=(38.8454167, 104.7215556, 1903.0), ts=1.0, tle_source='celestrak')[source]¶ Obtain GPS SV position in ECEF via TLEs and SGP4 orbit propagation. Additionally integrate user trajectories in ENU about an input lla location. The resulting data sets
Mark Wickert January 2018

Rx_sv_list
= None¶ Perform coordinate conversion

create_sv_data_set
(yr2, mon, day, hr, minute, sec=0)[source]¶ This method returns a numpy ndarrays containing target TDOA in seconds, FDOA in Hz, and the time span in minutes
Parameters:  yr2 (year as two digit integer, added to year 2000 (e.g., 2018 <=> 18)) –
 mon (month as two digit integer) –
 day (day as two digits, but can include fractional values) –
 hr (hour as two digits, but can include fractional values) –
 minute (minute as two digits, but can include fractional values) –
 sec (second as two digit integer, but can include fractional values; seconds default is 0) –
Returns:  SV_Pos (A 3D ndarray containing the SV (x,y,x) position values (columns) for each of 4) – satellites (rows) in meters corresponding to the times in t (slice)
 SV_Vel (A 3D ndarray containing the SV (x,y,x) velocity values (columns) for each of 4) – satellites (rows) in meters corresponding to the times in t (slice)
Notes
This function requires N_sim_steps to be initialized for the SV_Pos and SV_Vel arrays to be created, and t_delta needs to be precalculated so that offsets can be passed to
GPSDataSource.propagate_ecef()
.Examples

days2mdh
(year, days)[source]¶ This function converts the day of the year, days, to the equivalent month day, hour, minute and second. From Vallado’s original code translated to Python.
Parameters:  year (The year as a four digit number, e.g., 2013) –
 days (day of the year as a decimal number) –
Returns:  mo (month as two digit integer)
 day (day as two digits)
 hour (hour as two digits)
 minute (minute as two digits,)
 sec (second as two digit integer, but can include fractional values)
Notes
A support function in the class, currently not utilized by any methods.

gstime
(jdut1)[source]¶ This method converts the Julian date to Greenwich sidereal time (gst)
Parameters: jut1 (Julian date) – Returns: gst Return type: Greenwich sidereal time Notes
A support function from the original David Vallado SGP4 recoded to Python. This is a private method.
Examples
>>> # Inside propagate_ecf() make this call: >>> gst = self.gstime(jday(year,mon,day,hr,minute,sec));

propagate_ecef
(satellite, year, mon, day, hr, minute, sec)[source]¶ This method is responsible for propagating the satellite object, denoted satellite, to a specified GMT time. Coded to Python from the work of Charles Rino, (c) 2010, in MATLAB. See the function body details.
Parameters:  satellite (Input satellite object created by the sgp4 method twolinerv()) –
 year (year as four digit integer, e.g., 2013) –
 mon (month as two digit integer) –
 day (day as two digits, but can include fractional values) –
 hr (hour as two digits, but can include fractional values) –
 minute (minute as two digits, but can include fractional values) –
 sec (second as two digit integer, but can include fractional values) –
Returns:  xsat_ecef (Satellite position in ECF coordinates)
 vsat_ecef (Satellite velocity in ECF coordinates)
 gst (Greenwich sidereal time)
Notes
This is a private function used only by the class. When the class constructor is called, primary and secondary satellite objects are created using the input TLEs, e.g., self.sat_primary = twoline2rv(self.tle_primary[0],
self.tle_primary[1],wgs84)self.sat_secondary = twoline2rv(self.tle_secondary[0],self.tle_secondary[1],wgs84) The function propagate_ecf is used in all calculations where TDOA and FDOA are calculated.
Examples
>>> # As called from r_r_dot_ecf >>> position, velocity, gst = self.propagate_ecef(sv,2000+yr2, mon,day,hr, minute,sec)

ref_ecef
= None¶ Read GPS TLEs into dictionary


gps_helper.gps_helper.
earth_model
()[source]¶ Define the constants from the WGS84 ellipsoidal Earth model.
Parameters: None – Returns:  a (semimajor axis of the Earth ellipsoid model)
 f (flattening)
Notes
The World Geodetic System (WGS) is a standard for use in cartography, geodesy, and navigation. The latest revision is WGS84.

gps_helper.gps_helper.
ecef2enu
(r_ecef, r_ref, phi_ref, lam_ref)[source]¶ Convert ECEF coordinates to ENU using an ECEF reference location r_ref having lat = phi_ref and lon = lam_ref

gps_helper.gps_helper.
enu2ecef
(r_enu, r_ref, phi_ref, lam_ref)[source]¶ Convert ENU coordinates to ECEF using an ECEF reference location r_ref having lat = phi_ref and lon = lam_ref

gps_helper.gps_helper.
llh2ecef
(llh)[source]¶ Convert lat,lon,hgt geographic coords to X,Y,Z Earth Centered Earth Fixed (ecef) or just (ecf) coords.
Parameters: llh (A three element ndarray containing latitude(lat), longitude (lon), and altitude (a) or height (hgt), all in meters) – Returns:  x (The ecef x coordinate)
 y (The ecef y coordinate)
 z (The ecef z coordinate)
Notes
This is a function that computes: N = a/sqrt( 1  f*(2f)*sin(lat)*sin(lat) ) X = (N + h)*cos(lat)*cos(lon) Y = (N + h)*cos(lat)*sin(lon) Z = ((1f)^2 * N + h)*sin(lat) by also calling EarthModel()
Examples

gps_helper.gps_helper.
sv_user_traj_3d
(gps_ds, sv_pos, user_pos, ele=10, azim=20)[source]¶ Parameters:  gps_ds –
 sv_pos – Satellite position locations in ECEF
 user_pos – User position locations in ECEF
 ele – Elevation for the camera/view angle (the default is 20)
 azim – Azimuth for the camera/view angle (the default is 20)
Returns:

gps_helper.gps_helper.
sv_user_traj_3d_interactive
(gps_ds, sv_pos, user_pos, ele=10.0, azim=20.0)[source]¶ This method will provide an interactive 3d model plotted using mayavi to show all trajectories.
Parameters:  gps_ds –
 sv_pos – Satellite position locations in ECEF
 user_pos – User position locations in ECEF
Returns: