This project aims to implement GPS positioning from scratch with some simplifying assumptions.
The scripts in this project depend on the pyrtcm library for parsing the RTCM3 messages, which is installed with:
pip install pyrtcm
The project also depends on the numpy library for vector and matrix operations:
pip install numpy
For plotting graphs matplotlib is used:
pip install matplotlib
And finally, basemap is used to plot data on maps:
pip install basemap
To run this project, place your RTCM file in the "data" directory and run the Python file "gps_from_scratch.py" in the "src" directory. This action will create some plots from the data in the "plots" directory.
This project uses the RTCM3 protocol to encode the raw GPS data sent by the GPS satellites in messages 1002 and 1019.
Message 1002 contains information about the pseudorange, which is the approximate distance from the receiver to the satellites.
Message 1019 contains information about the orbit of the satellites, including the Keplerian elements used to calculate the position of the satellite at any given time.
To implement GPS positioning in a more approachable manner, some simplifying assumptions were made:
-
Pseudoranges are not corrected for any error except for the clock bias in the receiver. Most importantly, this means that effects such as atmospheric effects are ignored.
-
The satellite orbits are based only on Kepler's laws and are not corrected. This means that relativistic effects on orbits are ignored, due to their eccentricity being more than zero.
-
The earth is assumed to be perfectly spherical with its center of mass in the center of the sphere, instead of approximating it as an ellipsoid. This simplification means there will be an error in mapping ECEF coordinates to spherical coordinates.
The following map shows the distribution of calculated positions based on each measurement:
As we can see, the points are scattered a lot due to our simplifying assumptions while being clustered around Denmark, where the RTCM data was recorded. Therefore, we know that we have successfully implemented the elementary mechanisms of GPS positioning.
This plot shows the raw pseudorange measurements of different GPS satellites during the recording. It is possible to see when satellites gain and lose connection to the receiver:
This plot shows the extrapolated orbits in an ECI frame of the GPS satellites whose Keplerian parameters were received during the recording:
See other plots in the "plots" directory.