Now Reading
Calculating Place from Uncooked GPS Information

Calculating Place from Uncooked GPS Information

2023-04-12 21:58:59

We’re all conversant in GPS (International Positioning System) and its myriad functions. From getting instructions utilizing Google maps to hailing a experience utilizing a experience sharing app, numerous people and companies depend on correct place estimation utilizing GPS. Place estimation utilizing GPS is now so correct that GPS is getting used for measuring plate tectonics and continental drift. Certainly, GPS is a lot part of our lives that few of us cease and surprise the way it really works. The aim of this put up is to indicate you the way.  Extra particularly, we’ll first find out how place is calculated from vary measurements to GPS satellites after which take into account a concrete instance the place we’ll course of uncooked knowledge collected by a industrial GPS receiver to acquire consumer place estimates.

GPS is owned by the US authorities and operated by the US air pressure. As such, entry to GPS knowledge may be degraded or denied to different nations as a result of geopolitical issues. For instance, in line with this wikipedia article, entry to GPS knowledge was denied to the Indian navy throughout the Kargil battle. Different international locations subsequently determined to implement their very own GPS like methods. Examples are GLONASS by Russia, Galileo by the European Union and BeiDou by China. This may increasingly appear to be a waste of sources, however many of those methods function utilizing the identical requirements as GPS and are interoperable. For instance, newest GPS receivers can obtain indicators from each GPS and GLONASS satellites, bettering positioning accuracy. The wikipedia article referenced above additionally gives an fascinating historical past of the origins of the GPS system courting again to Sputnik, the primary artificial satellite tv for pc launched in area.

The put up is split into 3 elements – the primary half describes the varied coordinate methods used to specific place. An understanding of those coordinate methods is important for understanding how GPS works and is beneficial in its personal proper. For instance, the idea of top above the earth floor is one thing that folks intuitively perceive, however seems to be tough concept to exactly outline. The second half describes the essential precept of triangulation utilized by GPS to calculate place and develops the arithmetic for calculating the consumer place from satellite tv for pc measurements. An off-the-cuff consumer, taken with a normal data of how GPS operates however not within the particulars can learn half 1 and the primary few sections of half 2 earlier than the maths begins.  Lastly, the appendix gives the Matlab code for implementing varied concepts mentioned on this put up.

Many of the data on this put up derives from the ebook “International Positioning Programs: Alerts, Measurements and Efficiency” 1, a superb ebook about GPS methods. The matlab code introduced on this put up was written as options to the assorted finish of chapter issues within the ebook. I additionally make use of fabric within the GPS Interface Specification doc2. My contribution is to current the keys concepts associated to GPS in a (hopefully) clear and concise method and present the Matlab code that implements the positioning algorithms on actual world knowledge collected utilizing industrial GPS receivers that may be bought from the web. After studying this put up, an off-the-cuff reader ought to have a greater understanding of GPS, so the subsequent time they use Google maps on their cellphone, they’re conscious of the wonderful technical infrastructure that makes positioning and navigation functions doable. A extra technical reader ought to be capable of replicate my experiments by gathering their very own knowledge and working the Matlab code.

Half 1

The basic activity of a GPS system is to calculate place. To take action, we should first outline what place means. Most individuals take into consideration latitude/longitude and top when they consider place. Whereas latitude/longitude are helpful to signify a place on the earth floor, they aren’t appropriate for mathematical calculations as they don’t present a cartesian coordinate system. The bodily distance represented by a unit distinction between two longitudes isn’t fixed, and depends upon the place. For instance, the space between two longitudes one diploma aside is biggest on the equator and approaches 0 on the poles.

To be helpful for mathematical calculations, a coordinate system the place a unit distinction between coordinates represents a relentless bodily distance is required. A household of such coordinate methods may be created by defining a set of perpendicular axes intersecting at an origin that’s rigidly connected to the earth. Such coordinate methods are referred to as “ECEF” (Earth Centered, Earth Fastened). These coordinate methods work nicely to specific the place of a consumer on earth as they rotate with the earth and the place of a stationary consumer on the earth floor is fixed.

Essentially the most generally used ECEF coordinate system is known as the WGS 1984 system developed by the division of protection. WGS 84 is an ECEF body, outlined as follows:

  • Origin on the middle of mass of the earth
  • z axis passing by means of the CTP (Standard Terrestrial Pole). CTP is the typical of the earth’s pole’s place between the years 1900 and 1905. A mean must be used because the place of the pole isn’t mounted and wanders round in a circle of radius ~15m.
  • x axis passing by means of the intersection of the CTP’s equatorial airplane and a reference meridian, usually referred to as the Imply Greenwich Meridian

ECEF frames are handy to signify positions with respect to the earth, however they aren’t inertial as they’re rigidly connected to a spinning earth. To formulate the issue of satellite tv for pc movement across the earth in accordance with Newton’s legal guidelines of movement, we’d like an inertial coordinate system wherein to specific acceleration, place and velocity vectors.

An inertial body may be outlined in a way much like the ECEF body besides that the x-axis factors to the vernal equinox (the route of intersection of the equatorial airplane of the earth with the airplane of the earth’s orbit across the solar). Strictly talking, this body isn’t inertial both because the earth is transferring across the solar. Nevertheless, it may be thought-about inertial over quick intervals (simply because the ECEF body may be thought-about inertial for analyzing the motion of a physique on earth over a brief interval).

In the remainder of this put up, we’ll be utilizing the WGS 84 ECEF body to specific the consumer and satellite tv for pc place. That is doable as a result of the GPS interface specification document (known as GPS-IS in the remainder of this put up) gives a step-by-step process to calculate the satellite tv for pc place within the ECEF body at a given time instantaneous that accounts for the non-inertial nature of the ECEF body. That is lucky as a result of ECEF frames are splendid to specific the place of a consumer on the floor of the earth as they rotate with the earth and thus the place of a stationary consumer is fixed, as one would anticipate. This could not be the case if an inertial reference body is used to specific place as such a body could be mounted in area, and thus would seem rotating with respect to the earth.

Let’s now flip to the difficulty of defining top that we alluded to earlier. The important thing query that must be answered when defining top is “with respect to what”? Take into account for instance the peak of a degree in a desert. If we outline top to be the space of the purpose from the “floor”, then such a top would change continuously as the extent of the bottom itself modifications as a result of pure phenomenon (for instance, the wind depositing extra sand).  Thus, to outline top, we should first outline “floor” (observe that strictly talking, this subject doesn’t come up in a ECEF reference body, as all distances are measured with respect to the middle of mass of the earth. Nevertheless typically persons are not taken with distance from the middle of the earth, however from the native earth floor). To outline “floor” in a constant method, we’d like a mannequin for the floor of the earth. Two fashions are typically used:

Mannequin 1: Reference Ellipsoid

The floor of the earth is modeled as an oblate ellipse referred to as the “reference ellipsoid”, centered on the earth’s middle with the axis of revolution coincident with the z axis of an ECEF body. The lengths of the semi-major and semi-minor axes (denoted as a and b) are a = 6378137m and b = 6357002m. As anticipated, the worth typically used for earth’s radius (with the earth modeled as a sphere) is 6371Km which lies between the lengths of the semi-major and minor-axis. The reference ellipsoid is merely an abstraction for the form of the earth. It doesn’t have any bodily significance. An precise level on the earth floor will normally lie above or beneath the reference ellipsoid.

Mannequin 2: Geoid

One other floor generally used to measure top that does have bodily significance is known as the geoid. This floor is outlined because the locus of all factors with the identical worth of the gravitational potential. If the earth was a sphere with a uniform composition, this floor could be an everyday floor that may be parameterized as a mathematical operate. Nevertheless because the earth is neither spherical nor uniform, the geoid is normally specified as a sequence of heights above the reference ellipsoid. Top relative to the geoid is known as the orthometric top, or top above the imply sea stage (MSL). This is smart as if the oceans lined the floor of the earth, the form of the oceans could be a detailed approximation to the geoid. Strictly talking, the form of the geoid itself isn’t mounted because the floor of the earth is consistently altering as a result of human actions and pure phenomenon. Nevertheless given the majority of the earth, these solely have a negligible affect on the earth’s gravitational area and thus on the form of the geoid.

Word that the peak of the geoid is specified with respect to the reference ellipsoid and the peak of a given level may be specified with respect to both. The connection between the ellipsoid, geoid and the precise floor of the earth is proven beneath.

Latitude and Longitude

Armed with an ellipsoidal illustration of the form of the earth and with an ECEF coordinate system, we will outline the place of a degree P in ellipsoidal coordinates (generally generally known as latitude, longitude and top) as follows:

  • Geodetic Latitude (phi): angle measured within the meridian airplane by means of the purpose P between the equatorial airplane of the ellipsoid and the road perpendicular to the floor of the ellipsoid at P (optimistic north from the equator, damaging south)
  • Geodetic Longitude (lambda): angle measured within the equitorial airplane between the reference meridian and the meridian airplane by means of P (optimistic east from the zero meridian)
  • Geodetic top (h): measured alongside the traditional to the ellipsoid by means of P.

Word that the latitude is the angle between the equatorial airplane and the road perpendicular to the floor of the ellipse at level P, not the road becoming a member of level P and the earth middle (origin of the ECEF body). Angle between the equatorial airplane and the road becoming a member of level P and the earth middle is known as the geocentric (versus geodetic) latitude. If the earth have been an ideal sphere, the traditional to some extent would move by means of the earth middle and the geocentric and geodetic latitude would coincide.

Conversion between Geodetic (Ellipsoidal) and Cartesion Coordinates

Conversion from ellipsoidal to cartesian coordinates is simple and may be applied in a single step.

begin{bmatrix}x  y  z end{bmatrix} = begin{bmatrix}(N+h)cos(phi)cos(lambda)  (N+h)cos(phi)sin(lambda)  (N(1-e^2)+h)sin(phi) end{bmatrix}

Going from cartesian to ellipsoidal is trickier and includes an iterative process that shortly converges. See Appendix 4.A of 1  for particulars. The corresponding Matlab code is listed in part 1.e of the appendix. The extra widespread use case is to transform ECEF coordinates to ellipsoidal because the enter and output of GPS processing algorithms are normally in ECEF coordinates.

Native Coordinate Programs

Up to now, we now have largely talked about “world” coordinate methods, centered on the earth middle. In some functions, it’s extra handy to make use of native coordinate methods, centered on the consumer’s place. These coordinate methods are referred to as East-North-Up (ENU) methods. Given the consumer’s place in elliptical coordinates (phi: latitude, lambda: longitude), consumer coordinates may be simply transformed from a ECEF body to an area ENU body utilizing the next matrix multiplication.

R_{ENU} = begin{bmatrix}-sin(lambda) & cos(lambda) & 0  -sin(phi)cos(lambda) & -sin(phi)sin(lambda) & cos(phi)  -cos(phi)cos(lambda) & cos(phi)sin(lambda) & sin(phi)end{bmatrix}R_{ECEF}

We’ll see an utility of ECEF to ENU conversion once we compute the azimuth and elevation of one of many GPS satellites later.

Half 2: Utilizing GPS to Calculate Consumer Place

Figuring out the place of a consumer utilizing GPS is basically a triangulation downside. If the space of the consumer from three or extra satellites is thought, then the 3D place may be calculated utilizing triangulation. The fundamental concept in 2 dimensions is proven beneath.

The issue of finding the consumer can thus may be divided into two subproblems:

  1. Discovering the space of the consumer from every satellite tv for pc
  2. Figuring out the place of this satellite tv for pc within the consumer’s coordinate system

Let’s take a look at every of those issues step-by-step.

Step 1: Figuring out the Place of a Satellite tv for pc

The perfect satellite tv for pc orbit is an elliptical orbit and specified fully by 5 Keplerian parameters 5 of which decide the dimensions and form of the ellipse and the orientation of the orbital airplane relative to the mounted stars (i.e., an inertial reference body). The sixth parameter specifies the place of the satellite tv for pc at a specific time instantaneous of epoch. Given the six components, the satellite tv for pc place and velocity may be computed at another epoch.

The orbit of a satellite tv for pc isn’t a precise ellipse nevertheless because the earth isn’t uniform in composition and the motion of a satellite tv for pc is perturbed by the gravitational forces of the solar and the moon. The ensuing perturbations are small, however should be accounted for to acquire correct place. GPS accounts for these perturbations by transmitting an expanded set of 16 orbital parameters that can be utilized to precisely compute the place of a satellite tv for pc at a given time instantaneous. We gained’t go into the main points of how these corrections are utilized. The step-by-step process to compute the satellite tv for pc place (together with making use of the orbital corrections) is described in desk 20-IV within the GPS IS. The Matlab code that implements this process is proven in part 1.b of the appendix.

Rotating the Satellite tv for pc Reference Body

The consumer place is being calculated at time t. The GPS sign left the satellite tv for pc at time t-tau and arrives on the consumer tau seconds later. Whereas calculating the consumer’s place, we’ll calculate the satellite tv for pc positions at t-tau, the time of sign transmission. In time interval tau nevertheless, the earth has rotated by omega_Etau the place omega_E is the rotation charge of the earth. We should rotate the satellite tv for pc place vectors by the identical quantity, in order that they’re expressed within the consumer’s reference body, i.e., ECEF body at time t. That is carried out by multiplying the satellite tv for pc place vector x^k(t-tau) by the next rotation matrix:

x^k(t) = begin{bmatrix} cos(omega_Etau) & sin(omega_Etau) & 0  -sin(omega_Etau) & cos(omega_Etau) & 0  0 & 0 & 1 end{bmatrix}x^k(t-tau)

Word that that is not equal to calculating the place of the satellites at time t!

Step 2: Computing the Distance of the Consumer from the Satellite tv for pc

The satellite tv for pc sign acquired by a GPS receiver bears the time stamp at which the sign was despatched from the satellite tv for pc. By taking the distinction between its personal time and the timestamp of the GPS sign and multiplying by the pace of sunshine, the receiver calculates a tough measure of the space between the receiver and the satellite tv for pc. This measure is known as the pseudorange. If the clock on the satellite tv for pc and the receiver have been completely in sync and the GPS sign traveled in a straight line on the pace of sunshine, then this measure could be the true distance between the satellite tv for pc and the receiver. This nevertheless isn’t the case and the distinction between the satellite tv for pc and consumer clocks in addition to the delays attributable to the environment should be modeled to calculate an correct place of the consumer.

Let’s take into account first the impact of the offset between the consumer and satellite tv for pc clocks. Let’s denote the transmission time from the satellite tv for pc to the consumer by tau and a standard time reference (known as GPS Time (GPST)) by t. Denoting the receiver clock bias at time t by delta{t}_u(t) and satellite tv for pc clock bias at time t-tau by delta{t}_s(t-tau), the pseudorange rho(t) measured by the GPS receiver is given as:

(1)   begin{equation*} rho(t) = c[t+delta{t}_u(t)-(t-tau+delta{t}_s(t))] + epsilon_rho(t) = ctau + c[delta{t}_u(t)-delta{t}_s(t)] + epsilon_rho(t) end{equation*}

If there wasn’t a layer of environment between the satellite tv for pc and the consumer, the satellite tv for pc sign would journey alongside a straight line with the pace of sunshine. Thus, the space to the satellite tv for pc at time t denoted by r(t, t-tau) could be equal to ctau.

In actuality (fortunately), there’s thick layer of environment within the path of the satellite tv for pc sign which slows it down and bends its path. The change within the path size as a result of bending of the sign ray is usually not important. Nevertheless the change within the pace of propagation may be important and can lead to positioning errors of a number of meters or extra. This transformation in pace has two parts – I_rho arising from the propagation of the sign by means of the ionosphere and T_rho arising from the propagation of the sign by means of the troposphere (see appendix for extra details about these delays and the way they are often estimated). Thus,

ctau = r(t, t-tau) + I_rho + I_rho

Combining the above two equations and dropping the reference to measurement epoch t,

(2)   begin{equation*} rho(t)  = r(t, t-tau) + I_rho + I_rho + c[delta{t}_u(t)-delta{t}_s(t)] + epsilon_rho(t) end{equation*}

Thus, the true vary (precise distance of the consumer from a satellite tv for pc) may be calculated from the uncooked pseudo ranges output by the GPS gadget by first subtracting the consumer’s estimate of the Tropo and Iono delays after which adjusting for the satellite tv for pc clock offset. The Iono and the Tropo delay typically result in a place error of ~25m and ~2m respectively. Extra details about tips on how to estimate these delays are offered within the appendix. In the remainder of our evaluation on this weblog, we’ll ignore these delays.

Estimating the Satellite tv for pc Clock Bias

The satellite tv for pc clock bias is vital to estimate as it will possibly end result ready error of hundreds of meters. The process to calculate the satellite tv for pc clock bias is described on web page 96 of the GPS Interface Specification doc. The process consists of evaluating a polynomial whose coefficients are offered within the GPS ephemeris message and including a relativistic time period. The polynomial gives many of the correction, with the relativistic impact contributing about 1-10 m relying on the place of the satellite tv for pc. The code for calculating the satellite tv for pc clock bias is given in part 1.d of the appendix.

Consumer Clock Bias

The consumer clock bias is an unknown amount, similar to the consumer place. The consumer clock bias can be estimated together with the consumer place.

Step 3: Consumer Place and Clock Bias Estimation

We are actually prepared to have a look at the algorithm used to compute the consumer place. A fast level in regards to the notation earlier than we take a look at the maths. Usually, vector portions are expressed utilizing boldface (boldsymbol{x}) and scalar portions with out emphasis. Nevertheless within the math proven beneath, (largely as a result of laziness), I’m skipping making this distinction. I feel it’s clear from the context which portions are vectors and which of them should not.

As soon as the satellite tv for pc clock bias has been accounted for and all out there corrections have been utilized, the corrected pseudorange measurement for satellite tv for pc k may be written as

(3)   begin{equation*} rho^k = r^k + cdelta{t}_u + epsilon^k end{equation*}

Right here r^k is the true distance between the consumer and the satellite tv for pc and epsilon^k denotes the mixed impact of the unmodeled errors. Word that every one components on this equation are distances. Now we have transformed the receiver clock bias delta{t}_u right into a distance by multiplying by the pace of sunshine c. Additionally observe that every one of those calculations are carried out at time t and all place vectors are expressed within the ECEF body at time t. We drop express reference to time for comfort.

Let the place of the consumer within the ECEF body be denoted by x, and the place of satellite tv for pc k by x^k. Then,

r^k = lVert x^k - xrVert


rho_k = lVert x^k - xrVert + b + epsilon^k

We use b = cdelta{t}_u to signify the consumer clock bias in models of distance

We want to decide x and b that reduce the distinction between the measured and the estimated pseudorange for every satellite tv for pc. In different phrases, our activity is to find out x and b such that

(4)   begin{equation*}delta{rho}^k = rho^k -  (lVert x^k - xrVert + b) end{equation*}

is minimized for all satellites k.

This downside is solved utilizing an iterative process by beginning with an estimate of x and b and discovering the corrections that reduce the equation above. Let our preliminary estimates be denoted by x_0 and b_0. We want to discover delta{x} and delta{b} such that the true consumer place x = x_0 + delta{x} and the true clock bias b = b_0 + delta{b} reduce

(5)   begin{equation*} begin{split} delta{rho}^k &= rho^k -  rho_0^k   &= lVert x^k - xrVert + b - lVert x^k - x_0rVert - b_0 + epsilon^k &= lVert x^k - x_0 - delta{x}rVert + b - lVert x^k - x_0rVert - b_0 + epsilon^k  &approx lVert x^k - x_0rVert -frac{x^k -x_0}{lVert x^k - x_0rVert}cdotdelta{x}+ b - lVert x^k - x_0rVert - b_0 + epsilon^k  &= -frac{x^k -x_0}{lVert x^k - x_0rVert}cdotdelta{x} + delta{b} + epsilon^k  &= -hat{x}_{uk}cdotdelta{x} + delta{b} + epsilon^k  &= begin{bmatrix}-hat{x}_{uk} &  1end{bmatrix}begin{bmatrix}delta{x}  delta{b}end{bmatrix} + epsilon^k end{split} end{equation*}

Right here hat{x}_{uk} is the unit vector from the consumer to satellite tv for pc k and we used the Taylor sequence growth of the vector norm (see appendix) to specific the delta pseudorange as a matrix multiplication between recognized and unknown portions. Concatenating the linear equation developed above for K satellites,

boldsymbol{delta{rho}} = begin{bmatrix}delta{rho}^1  delta{rho}^2  vdots  delta{rho}^K end{bmatrix}  = begin{bmatrix} -hat{x}_{u1} &1  -hat{x}_{u2} &1  vdots  -hat{x}_{uK} &1end{bmatrix} begin{bmatrix}boldsymbol{delta{x}}  delta{b} end{bmatrix} + boldsymbol{epsilon}


 boldsymbol{G}  = begin{bmatrix} -hat{x}_{u1} &1  -hat{x}_{u2} &1  vdots  -hat{x}_{uK} &1end{bmatrix}

The expression above may be written extra compactly as

boldsymbol{delta{rho}} = boldsymbol{G}begin{bmatrix}boldsymbol{delta{x}}  delta{b} end{bmatrix} + boldsymbol{epsilon}

For a non-degenerate (hat{x}_{uk} are non-coplanar) configuration of K=4 satellites, the equation above may be solved instantly. Typically, if the sky isn’t obstructed, many extra satellites are seen, and a actual resolution isn’t out there. We will use linear algebra methods to discover a least squares resolution:

begin{bmatrix}boldsymbol{delta{hat{x}}}  delta{hat{b}} end{bmatrix}  = (boldsymbol{G^T}boldsymbol{G})^{-1}boldsymbol{G}^Tboldsymbol{delta{rho}}

The hat above the estimated portions signifies that they’re a least squares resolution, not a precise resolution.

The whole process to calculate the consumer place and clock bias is as follows.

Word in regards to the Matlab Code

It’s value noting that whereas many of the equations within the Matlab code proven within the Appendix contain analysis of expressions the place the recognized portions are on the appropriate hand aspect and unknown portions on the left hand aspect (and thus may be evaluated in a single step), there are a couple of that requires invocation of a solver. One instance is the calculation of the eccentric anomaly (E) from the imply anomaly (M) required throughout the calculation of the satellite tv for pc place from ephemeris parameters. The relation between the 2 is expressed as:

M = E-eSin(E)

the place e is the eccentricity of the earth’s orbit. Sometimes, M is calculated first, and calculating E from M can’t be carried out in closed kind and requires the usage of a solver. A part of the code is proven beneath.

Experimental Setup

On this part, I’ll describe the {hardware} setup I used to gather uncooked GPS knowledge which was then processed utilizing the algorithms described above to calculate consumer place and clock bias. An consumer ought to be capable of simply replicate my setup utilizing low cost and commercially out there GPS receivers and open supply software program.

The determine above reveals the primary steps concerned in my setup. For gathering uncooked GPS knowledge, particular GPS models that output “timing” data consisting of uncooked pseudoranges and satellite tv for pc ephemeris data should be used. Common GPS models calculate the consumer place internally and don’t output the uncooked knowledge we have to calculate the consumer place utilizing the algorithm described above. The NEO-M8T and 6T chips from u-blox match our wants. Full {hardware} assemblies with the GPS unit, antennae and serial output port may be bought from Amazon for ~40 {dollars}.

In an effort to obtain and save the uncooked GPS sign, I take advantage of the STRSVR utility in RTKLib (RTKLIB is an open supply program package deal for normal and exact positioning that helps all widespread International Navigation Satellite tv for pc Programs (GNSS) – GPS, Glonass, Galileo, Baidu and so on. See: STRSVR takes the customized u-blox formatted output from the u-blox receiver and converts it into RTCM commonplace format. RTCM (Radio Technical Fee for Maritime Companies, see:–dgnss–requirements.html) is a normal for GNSS knowledge and content material designed to assist a wide range of GNSS functions in air/land/sea navigation, surveying, radio navigation/location and so on.

RTCM commonplace gives the definition of varied messages that present particular GPS data. The data we’re taken with are the uncooked pseudoranges and satellite tv for pc ephemeris. This data is contained in messages 1002 and 1019.

A part of GPS 1019 message content material

We should request the u-blox receiver to ship 1002 and 1019 message data as a part of the info it sends to STRSVR. That is carried out through the use of the next instructions within the Cmd window:

The primary command units the replace charge to 1Hz and the opposite two allow RAW messages. The small print on how this occurs are a bit murky. I attempted going by means of elements of the UBX documentation to grasp this higher however quickly acquired misplaced. Suffices to say that the above instructions work and trigger the receiver to ship the info we’d like.

I configure the STRSVR utility to obtain knowledge from the serial port at 9600 Baud and save the info to a file in RTCM 3 format.

To gather the info, I went to the roof of my house constructing and positioned the GPS receiver at a location the place it may get an unobstructed view of the sky. I used the u-blox configuration software program ( to confirm {that a} adequate variety of satellites have been seen and a superb place repair might be obtained. I then used STRSVR to gather about an hour of uncooked GPS knowledge and saved the info to a file.

Processing Uncooked GPS Information

STRSVR saves the uncooked GPS knowledge into binary RTCM3 format. We should decode the RTCM3 knowledge to create Matlab knowledge buildings out of it. I thought-about writing my very own RTCM decoder, however then discovered a superb Matlab library referred to as goGPS ( that gives many helpful routines to learn and course of GPS knowledge. I used the load_stream operate that reads an RTCM formatted file and extracts the RTCM messages (line 95 in my model of goGPS). I then saved the extracted knowledge to a .mat file to function enter to my the place calculation algorithm that implements the equations above. The Matlab code is proven within the part 1.a of the appendix. I’m additionally attaching the rtcm_data since many individuals have requested for it. I modified the file extension from .mat to .txt as a result of wordpress safety restrictions. Rename the file again to .mat whenever you obtain it.

Evaluation of Outcomes

On this part, I’ll analyze the positions and clock bias computed by my algorithms. We are going to take a look at the variation of the north/east/up parts of the place with time, variation of the clock bias with time and introduce the idea of Dilution of Precision (DOP), a standard metric used to measure the standard of GPS place estimates. Because the GPS receiver was stationary throughout knowledge assortment, the variation of the calculated place displays the true efficiency of the algorithm used to calculate the place.

East North Up
Std-Dev 14.00 39.88 47.35

The plot of E/N/U parts of the consumer place in a consumer centered ENU body together with the place scatter plot are proven above. As anticipated, the variation in place is round 30m within the East and North route and barely greater alongside the Up route. We’ll clarify the rationale for this throughout the dialogue about DOP (Dilution of Precision) beneath.

Clock Bias Drift

The variation of the receiver clock bias towards time is proven beneath. Word that the clock bias b used within the algorithm above is within the unit of distance. Within the plot beneath, the bias has been transformed into unit of time by dividing by the pace of sunshine.

We will see that the clock bias isn’t a relentless however drifts linearly with time. The quantity of drift is 4.27 e-7sec/sec.

Computing the Satellite tv for pc Azimuth/Elevation

As an train, let’s compute the azimuth and elevation of all of the satellites seen at a given time instantaneous. This may neatly tie in most of the concepts mentioned above and likewise present a superb segue to discussing DOP.

Azimuth and elevation angles are calculated from the attitude of the consumer. Thus, they’re expressed in an ENU body centered in regards to the consumer place.

If the place of the satellite tv for pc within the consumer centered ENU body is (x_s, y_s, z_s), then the azimuth (az) and elevation (el) is given by:

tan(az) = frac{x_E}{x_N}

sin(el) = frac{x_U}{sqrt{x_E^2 + x_N^2 + x_U^2}}

The process to extract azimuth and elevation from satellite tv for pc and consumer positions (calculated within the ECEF body) is as follows:

  1. Calculate the place vector from the consumer to the satellite tv for pc (in ECEF body)
  2. Calculate the consumer place in Ellipsoidal coordinates (lat/lng)
  3. Rotate the place vector to the ENU body centered in regards to the consumer place
  4. Calculate azimuth/elevation utilizing equations above)

The Matlab code is proven beneath:

The computed azimuth and elevations at a given epoch are proven within the desk and the corresponding 3D positions within the ENU body are proven within the plot beneath

Azimuth Elevation
69.68 62.89
-20.46 81.63
96.38 16.91
34.71 5.21
-145.06 12.59
-165.22 7.44
-110.29 39.03
-49.30 43.11


As may be seen the azimuth angles are each optimistic and damaging, whereas the elevations are solely optimistic. This is smart because the consumer can’t see the satellites beneath the horizon.

You’ll have seen satellite tv for pc observe charts that many GPS processing software program output as a visualization assist. These charts are created by calculating the satellite tv for pc positions utilizing the process described right here at a number of epochs.

Dilution of Precision (DOP)

DOP helps us reply the query, “how good are my place estimates”? There are two parts of the errors in our place estimate. The primary one is the measurement noise, which is apparent. The noisier our measurements (pseudorange, satellite tv for pc place and so on), greater are the anticipated place errors. Nevertheless, there’s one other, much less apparent part of the positioning errors. This part is the user-satellite geometry. As defined in chapter 6 of 1, it the best to see this in a 2D instance.

A consumer measures his distance from a pair of sign sources S1 and S2 at recognized places. If the vary measurements have been excellent, the consumer may decide his place precisely as mendacity on the intersection of two circles centered on S1 and S2 and radii equal to the measured ranges. The measurements nevertheless are imperfect and have a most uncertainty of pmepsilon. The determine beneath reveals how the user-source geometry impacts the quantity of uncertainty within the consumer place.

The uncertainty within the place and clock bias is measured by the covariance of the estimated place and clock bias error. Representing the true place and clock bias by x and b, the place and clock bias estimation errors are given as:

delta{x} = hat{x}-x

delta{b} = hat{b}-b

The place hat{x} and hat{b} are our estimates of the consumer place and clock bias (calculated utilizing the algorithm above). As proven in chapter 6 of 1, the covariance matrix of place and clock bias is given as:

Covbegin{bmatrix}delta{x}  delta{b} end{bmatrix} = sigma^2(G^{T}G)^{-1}

Right here sigma is the “consumer vary error” which captures the uncertainty within the pseudoranges and satellite tv for pc positions. The G matrix is the matrix consisting of the unit vectors from the consumer to the satellite tv for pc that we noticed earlier. This matrix relies upon fully on the user-satellite geometry. Thus, the covariance may be neatly factored right into a product of measurement uncertainty and a operate of the user-satellite geometry matrix. The weather of the G matrix are expressed within the ECEF body. It’s extra handy to rotate it into the consumer’s native ENU body. Let R_L be the required rotation matrix and tilde{G} be the ensuing geometry matrix.

tilde{G} = [G(1:N, 1:3)R_L^{T}, ones(N,1)]

Right here N is the variety of satellites. The rotation is utilized to the place parts of the geometry matrix. it may be simply proven that

Covbegin{bmatrix}delta{x_{ENU}}  delta{b}end{bmatrix} = sigma^2(tilde{G^{T}}tilde{G})^{-1}


H =  (tilde{G^{T}}tilde{G})^{-1},

The East, North and Up parts of DOP are outlined as

sigma_E^2 = H_{11}, sigma_N^2 = H_{22}, sigma_U^2 = H_{33}

We will additional outline a horizontal DOP (HDOP) by combining the E and N time period (because the East and North instructions outline the horizontal airplane on the consumer’s location) and vertical DOP (VDOP) consisting of the U time period.

HDOP = sqrt{sigma_E^2 + sigma_N^2}

VDOP = sqrt{sigma_U^2}

DOP gives a easy characterization of the user-satellite geometry. The extra beneficial the geometry, the decrease the DOP. Extra beneficial means the satellites are unfold aside in azimuth and elevation. The decrease the DOP and consumer vary error (sigma), the higher the standard of the place estimate. To grasp the connection between DOP and satellite tv for pc geometry higher, lets take into account two easy examples. The primary instance seems to be on the variation between DOP and the angle between the satellite tv for pc vectors in a 3 satellite tv for pc configuration proven within the determine beneath. The primary satellite tv for pc is situated alongside the y axis and the opposite two are situated symmetrically in regards to the y axis, at an angle theta from the x-axis. The G matrix and the plot of DOP towards angle theta is proven beneath.

The minimal DOP happens at theta = -30^o. This makes intuitive sense as at this angle, the satellites are maximally separated from one another. Word that the DOP doesn’t range symmetrically with optimistic and damaging theta. It is because for a given theta, the separation between the satellite tv for pc vectors is greater for a damaging worth than for a optimistic worth.

Subsequent let’s take a look at a extra sensible instance of 4 satellites situated in 3D. First satellite tv for pc is situated on the zenith and the others three are situated 120 levels aside in azimuth and at an elevation of theta (identical for the three satellites). We’ll take a look at the variation of VDOP with the elevation angle.


As anticipated, the VDOP decreases with growing elevation angle, because the satellites get farther aside from one another. It continues to lower because the elevation goes previous the horizon (elevation = 90 levels). Since a consumer situated on the earth floor can’t observe satellites beneath the horizon (actually, sign from satellites < 10 levels above the horizon are too noisy and usually not used), the minimal worth of VDOP isn’t achievable. This instance demonstrates why VDOP is usually greater than HDOP.

Let’s now take a look at the variation of HDOP and VDOP with time calculated by our place algorithm on actual knowledge.

No surprises right here. The HDOP/VDOP values are typically < 2.5, which is taken into account ample and as anticipated, VDOP is greater than HDOP.

This concludes the put up! I hope that subsequent time you utilize Google maps to get instructions, you’ll take into consideration the unbelievable scientists, engineers and coverage makers who’ve given us this unbelievable system that makes doable so many functions that we now take with no consideration. In line with 1, the GPS constellation price about 30 billion {dollars} to place in place and prices the US authorities about 1B yearly to keep up. The valuation of Uber alone, which wouldn’t exist with out GPS is upwards of 70B {dollars}. While you embody all the different wonderful functions made doable by GPS, the general public funding in GPS seems to be among the finest public investments ever made! ????


1.a Code for Calculating Consumer Place and Clock Bias

1.b Code for Calculating Satellite tv for pc Place

1.c Code for Computing the Least Squares Answer for Consumer Place and Clock Bias

1.d Code for Calculating Satellite tv for pc Clock Bias

1.e Code for changing ECEF (WGS84) to Ellipsoidal Coordinates

1.f format_ephemeris3.m

2.a Taylor Collection Enlargement of Vector Modulus

Within the derivation of the place estimation system, we used the taylor sequence growth of the modulus operate. The proof is as follows:

lVert x rVert = (xcdot{x})^{1/2}

First two phrases of the taylor sequence growth of lVert x rVert about x are:

lVert x + delta{x}rVert = lVert x rVert + frac{partial{lVert x rVert }}{partial{x}}cdot{delta{x}}

 frac{partial{lVert x rVert }}{partial{x}} = frac{1}{2}(xcdot{x})^{-frac{1}{2}}2x

 frac{partial{lVert x rVert }}{partial{x}} = frac{x}{lVert x rVert }

2.b Ionospheric and Tropospheric Delay

The passage of the satellite tv for pc sign by means of the earth’s environment modifications the pace of the sign and bends the sign path. These results end result within the distance to the satellite tv for pc calculated by multiplying the time delay between sign transmission and reception with the pace of sunshine to be completely different from the true distance. Estimating the impact of the environment is vital to calculate correct pseudoranges and thus correct consumer place. Within the therapy above, we uncared for the atmospheric results. On this part, we’ll present some details about atmospheric results and the way they’re sometimes modeled. The reader is referred to chapter 5 of 1 for particulars.

For the aim of analyzing its interplay with GPS indicators, the earth’s environment may be break up into two elements – troposphere and the ionosphere. The ionosphere extends from a top of about 50km to about 1000km above the earth is a area of ionized gases. The ionization is attributable to the solar’s radiation and the state of the ionosphere is decided primarily by the depth of photo voltaic exercise. Electron density typically builds up throughout the day because the solar rises, peaking at round 2 PM native time after which begins declining. There may be appreciable variability from day after day relying upon the photo voltaic exercise. The pace of propagation of the sign within the ionosphere relies upon upon the variety of free electrons within the path of the sign, outlined because the whole electron depend (TEC). The variety of electrons in a tube of 1m^2 cross part extending from the receiver to the satellite tv for pc is given as:

TEC = int_S^R n_e(l)dl

the place n_e(l) is the electron density alongside the sign path and the integral is alongside the sign path from the satellite tv for pc to the receiver. The trail size by means of the ionospheric is shortest within the zenith route (when the satellite tv for pc is instantly overhead) and longest when the satellite tv for pc is near the horizon.

Typically, ionosphere delays are onerous to mannequin as photo voltaic flares and magnetic storms can giant and quickly various fluctuations in electron densities. Two strategies are primarily used to estimate ionospheric delays. The primary methodology makes use of twin frequency GPS measurements and the truth that the ionospheric delay is inversely proportional to the sq. of the frequency. This permits us to arrange a system of equations to estimate the ionosphere free pseudoranges from the noisy pseudoranges.

Receivers restricted to single frequency measurements can use an empirical mannequin referred to as the Klobuchar mannequin parameterized by the consumer’s latitude, longitude, satellite tv for pc azimuth/elevation, native time and a set of parameters broadcast by the satellites. A step-by-step implementation of this mannequin is detailed within the GPS Interface Specification and may be simply applied in Matlab or C.

The troposphere extends to about 16 Km above the equator and accommodates roughly three quarters of the gaseous mass of the environment. The troposphere is primarily composed of the dry gasses – nitrogen and oxygen, and water vapour. The first impact of the troposphere on GPS sign propagation is to delay it barely, inflicting the obvious vary to the satellite tv for pc to look longer by about 2.5m, relying on the satellite tv for pc elevation angle. Not like the ionosphere, the troposphere is non-dispersive for GPS frequencies, and thus the tropospheric impact can’t be estimated by twin frequency measurements. The quantity of delay attributable to the troposphere depends upon the strain, temperature and humidity. Varied fashions exist to calculate the delay from meteorological measurements. Seek advice from chapter 5 of 1 for particulars.

2.c Plotting code

Some individuals have requested for the plotting code – here it’s.



Misra P, Enge P. International Positioning System. Vol 0. 0th ed. Ganga-Jamuna Press; 2011.


None S. International Positioning System Interface Specification. International Place Programs Directorate; 2013:213.

Source Link

What's Your Reaction?
In Love
Not Sure
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top