ppp-howto.adoc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. = Precise Point Positioning (PPP) HOWTO
  2. :description: This document is a guide getting high accuracy from your GPS using Precise Point Positioning (PPP).
  3. :keywords: Precise Point Positioning, PPP, GPSD, GPS
  4. Gary E. Miller <gem@rellim.com>
  5. Blursday 86 March 2020
  6. == WARNING
  7. This document assumes you are using gpsd versions 3.20 or git
  8. head. Using older versions will fail in strange ways.
  9. == Introduction
  10. This document is a guide getting high accuracy static positions from
  11. your GPS using Precise Point Positioning (PPP). The rare few that have a
  12. GPS that output raw measurement data for L1 and L2 can achieve absolute
  13. accuracy of around 3 cm. The u-blox ZED-F9P and ZED-F9T can be better
  14. than 1 cm. The lucky owners of an L1 GPS that outputs raw measurements
  15. can get about 0.5 m. The majority will only be able to get somewhat
  16. better than 1.5 m using simple averaging.
  17. Patience is required. For best results 6 to 24 hours of data is
  18. required. Post processing time may double that.
  19. This document is not about getting high precision dynamic positions from
  20. your GPS. This is about after the fact Post Processed Positions (PPP).
  21. High precision real time dynamic positions requires Real Time Kinematic
  22. (RTK) which will not be discussed here. RTK users may still want to
  23. read this document. The RTK Best practice is to determine the position
  24. of the base using PPP before sending the RTK data from the base to its
  25. rovers.
  26. == Background
  27. To compute a location fix a GNSS receiver takes measurements (raw data)
  28. of the relative time of arrival of signals broadcast from the GNSS
  29. satellites. The receiver also knows the predicted orbit (ephemeris) of
  30. each satellite. The collection of ephemeris from all the satellites is
  31. known as the ephemerides. With these two sets of data, the CPU in the
  32. receiver can compute a fix in position in time and space using iterative
  33. techniques.
  34. A major problem is that the predicted orbits are often off by one meter
  35. or more. Ground stations bounce lasers off the individual satellites as
  36. they pass overhead and use this new data to compute the actual orbits
  37. of the satellites. Using this new ephemeris data, when it becomes
  38. available, combined with the receiver's raw data, better fixes can be
  39. computed. This is the basis of PPP.
  40. There are other smaller error sources that PPP can reduce. The effects of
  41. ocean tides on the Earth's crust, Clock drift of the satellite clocks.
  42. Troposphere and Ionosphere effects, and more.
  43. The first take on the actual epherides may take 90 minutes to be published.
  44. The ephemerides may be further refined for up to three weeks.
  45. There are two flavors of PPP: static, and kinematic. Kinematic PPP
  46. simply takes an existing time series of measurements and computes a new
  47. time series of fixes using the actual orbits, instead of the predicted
  48. orbits. Static PPP assumes all the raw measurements were taken at the
  49. same location over a long duration. Long is typically 15 minutes to
  50. 48 hours. All the computed fixes are then averaged to result in one
  51. precise location for the receiver's antenna.
  52. Now in 2020, most PPP services only use ephermides from GPS satellites,
  53. with more and more adding GLONASS. As time passes, more constellations
  54. will be used, leading to slightly increased accuracy.
  55. The earth revolves around its axis every 24 hours, give or take a few
  56. milli seconds. GPS satellites revolve around the Earth's axis about
  57. every 12 hours, give or take. PPP will provide best results if your
  58. data is 12, 24 or 36 hours. This allows some orbital errors to average
  59. out.
  60. == Requirements
  61. This document assumes that you have installed gpsd version 3.19 or 3.20, basic
  62. knowledge of how to use _gpsd_. Before continuing you should know how
  63. to start and stop _gpsd_, and how to use _cgps_ to see you current
  64. position and fix status.
  65. This document also assumes that you have a GNSS receiver connected to a
  66. local GPSD demon and that _cgps_ shows a stable 3D fix. This will allow
  67. Simple Averaging. You will also need Python and _gnuplot_ installed. The
  68. Python and _gnuplot_ do not need to be installed on the host that is
  69. connected to the GPS, they are merely needed for post processing.
  70. For basic PPP (0.5 m) you will need a GPS that outputs L1 raw
  71. measurement data that _gpsd_ understands. Currently that limits you to a
  72. Javad GPS that support the GREIS language, or a u-blox GPS that support
  73. the UBX-RXM-RAWX messages.
  74. u-blox GPS known to support UBX-RXM-RAWX are: -M8T,-M8F, ZED-F9P and
  75. ZED-F9T.
  76. For advanced PPP (3 cm) you will need a GPS that outputs L1 and L2 raw
  77. measurement data that _gpsd_ understands. Currently that limits you to a
  78. Javad GPS that support the GREIS language or the u-blox 9 series.
  79. Finally, patience is required.
  80. == Results
  81. The end goal of this process is to determine the latitude, longitude and
  82. altitude of your GPS antenna as precisely as possible. Additionally
  83. the Circular Error of Probability (CEP) will be determined.
  84. CEP, also known as the CEP(50), is the radius of a circle, centered on
  85. the mean, whose boundary includes 50% of the GPS positions. You probably
  86. do not want to base any navigation or surveying on a 50% probability.
  87. More interesting is the CEP(95) which includes 95% of the measurements.
  88. == ITRF00, WGS84, NAD83 and Ellipsoids
  89. Ever noticed how two "accurate" GPS placed side by side can give wildly
  90. different latitude, longitude, and especially altitude for the same
  91. spot?
  92. All GNSS systems compute positions using ECEF (earth-centered,
  93. earth-fixed) coordinates. After an ECEF position is calculated, it is
  94. converted into latitude and longitude using a datum. So many to
  95. choose from. You've probably heard of WGS84, NAD83, and maybe ITRF.
  96. NAD83 is pinned to the North American tectonic plate. WGS84 is pinned
  97. to the Reference Meridian (near the Greenwich Meridian). NAD83 is the
  98. official datum in the USA and Canada, and is used by the FAA. WGS84 is
  99. the official datum of GPS and the US Department of Defense.
  100. In 1987 the difference between NAD83 and WGS84 was not measurable. Since
  101. then the tectonic plates have moved. In 2018 the two datums can differ
  102. by more than 2 meters in the continental USA.
  103. It is common when using NAD83 to also specify the year (epoch) of the
  104. measurements. This allows archival, and current, data to be used
  105. to similar accuracy.
  106. It gets worse. Most PPP services support the International Terrestrial
  107. Reference Frame (ITRF). ITRF is pinned to a Celestial Reference Plane
  108. (CRF).
  109. It gets worse. There is not one WGS84, but many: WGS 1984 (ORIG),
  110. WGS84(G730), WGS84(G873), WGS84(G1150), WKID: 4326, and more. There is
  111. not one ITRF but many: ITRF91/92, ITRF94/96, ITRF00, ITRF08 and more.
  112. Original ITRF and WGS84 differ by less than 1 meter, which is huge
  113. for the purposes here. ITRF2014 and WGS84(G1762) differ by a few
  114. centimeters.
  115. It gets worse. Two expensive GPS often differ in altitude by over 60
  116. feet. The Earth is not a perfect sphere. It is more pear shaped. GPS
  117. approximate this with an ellipsoid, usually some version WGS84. Then
  118. altitude is calculated as height above the ellipsoid (HAE).
  119. Most people do not consider the altitude as the height above the
  120. ellipsoid, but as the height above Mean Sea Level. MSL is the same
  121. as pressure altitude (when corrected for temperature and barometric
  122. pressure), but different from HAE.
  123. Mean Sea Level has had nothing to with the level of the sea, it relates
  124. to some stakes driven into the ground 100 hundred years ago that seemed
  125. at the time to be roughly mean sea level at that point.
  126. Pressure altitude is not some sort of absolute geometric altitude,
  127. it is related to the gravity under the position being measured. So
  128. local gravity affects local MSL, but not local HAE. If the measured
  129. position is over a high density rock, like iron ore, then the gravity is
  130. higher, and the pressure is increased over the simple HAE. Conversely
  131. ocean water is less dense and has the opposite effect. This is very
  132. noticeable in the Hawaiian Islands.
  133. Fun fact: gravity is at its maximum at 'sea level'.
  134. Many different datums can be used to calculate height. These datums
  135. are based on different ellipsoids used to approximate sea level. The
  136. two used by CSRS-PPP are CGVD2013 and CGDV28(HT2_0). GCVD2013 is the
  137. standard datum in Canada since 2013. The standard in the USA is the
  138. North American Vertical Datum of 1988 (NAVD 88). Many GPS use the WGS84
  139. Ellipsoid as the vertical datum. The WGS84 Ellipsoid is from the same
  140. organization as the WGS84 coordinate system, but not part of WGS84.
  141. More refined datums, like the World Gravity Model, WGM2012, also take
  142. into account more gravitation effects.
  143. Clearly there is no point knowing your precise position to a few cm
  144. if you are not certain of your datum and vertical datum (ellipsoid),
  145. with epoch. This will be important later as you are asked to input your
  146. choice of horizontal and vertical datums to your PPP service.
  147. == Averaging
  148. The first technique covered, Simple Averaging, works with any GPS that
  149. is supported by _gpsd_. For best results a minimum of 6 hours, and
  150. preferably 24 hours, of continuous observations are required.
  151. _gpsprof_ will be used to gather 24 hours of position data and then
  152. output a plot file. The plot file is fed into _gnuplot_ to turn it
  153. into a png image file. The image will contain a scatter plot of all
  154. the positions reported by your GPS, as well as summary statistics. The
  155. statistics include the mean latitude, mean longitude, mean altitude and
  156. other computed values.
  157. The procedure is simple:
  158. . Verify your GPS is communicating with _gpsd_ by running _cgps_ and
  159. confirming that you have a stable 3D fix.
  160. . Collect 24 hours of data in a plot file: `gpsprof -n 2880 -T pngcairo > scatter.plot`
  161. . Convert the plot to a png: `gnuplot < scatter.plot > scatter.png`
  162. . Display the png with your favorite image viewer. To use _display_
  163. from _Imagemagick_: `display scatter.png`
  164. There are many possible adjustments to the above procedure.
  165. Maybe you want to collect just 10 minutes of data (20 epochs at 30 second
  166. interval) to verify that your
  167. tool-chain is working before doing a 24 hour run. Simple, just change
  168. `gpsprof -n 2880` to `gpsprof -n 20` and then proceed as above.
  169. Maybe your _gpsd_ host does not have Python installed. Just run _gpsprof_
  170. remotely. On the host you will need to run _gpsd_ with the `-g` parameter so
  171. that it can be accessed over the network. Then run _gpsprof_ on a
  172. remote host that supports Python this way:
  173. `gpsprof -n 2880 -T pngcairo [hostname] > scatter.plot`
  174. Depending on your GPS, your GPS antenna, and your sky view, you may get
  175. a CEP(95) of around 1.5 m.
  176. == Precise Point Positioning (PPP)
  177. Plain GPS determine their position by measuring the distance to several
  178. GPS satellites and calculating a position solution. The main limitation
  179. is that the position of any GPS satellite is not known to better than a
  180. meter or two in real time.
  181. PPP uses the raw GPS measurements from a worldwide network of precisely
  182. fixed ground receivers to precisely calculate the actual orbits of
  183. all the satellites. "Ultra Rapid" orbits take about 90 minutes to be
  184. available. "Rapid" orbits take a day. The most accurate orbits ("Final")
  185. take around 14 days to determine.
  186. To use these orbits you need to collect the raw measurements from your
  187. GPS, then upload them to a service to compute a more precise fix.
  188. Receiver Independent Exchange Format (RINEX) files are the standard
  189. for sending your raw measurement data. _gpsd_ uses RINEX Version 3
  190. (RINEX 3).
  191. Most PPP services have many limitations making them unsuitable for
  192. our purposes. Some limitations include: open only to paid subscribers,
  193. require L1 and L2 raw data, and/or use proprietary data formats.
  194. There is one online service that is free to all (requires registration),
  195. accepts L1 only raw data, and accepts RINEX 3 files: Natural Resources
  196. Canada (NRCAN). Their tool is at https://webapp.geod.nrcan.gc.ca/geod/tools-outils/ppp.php
  197. Trimble has a free to all (requires registration) service that requires
  198. L1 and L2 observations in RINEX 3.
  199. Their
  200. tool is at: https://trimblertx.com/Home.aspx
  201. == PPP Configuration
  202. Before you can collect raw data from you GPS, you must configure it to
  203. output raw data. This configuration will not be the default configuration
  204. that _gpsd_ applies to your GPS by default.
  205. The raw data can be quite large, so be sure your GPS serial port speed
  206. is set to 57,600, or higher.
  207. Many of the configuration steps are order dependent. If in doubt, start
  208. over from the beginning. Be sure that _gpsd_ is running and that _cgps_
  209. shows that you have a stable 3D fix.
  210. === u-blox configuration
  211. This section is only for u-blox users.
  212. Be sure your serial port speed is high enough:
  213. ...................................
  214. $ gpsctl -s 115200
  215. ...................................
  216. Disable all NMEA messages, and enable binary messages:
  217. ...................................
  218. $ ubxtool -d NMEA
  219. $ ubxtool -e BINARY
  220. ...................................
  221. To start simple, disable all constellations, except GPS (and QZSS):
  222. ...................................
  223. $ ubxtool -d GLONASS
  224. $ ubxtool -d BEIDOU
  225. $ ubxtool -d GALILEO
  226. $ ubxtool -d SBAS
  227. $ ubxtool -e GPS
  228. ...................................
  229. Verify that only GPS and QZSS are enabled. Otherwise the u-blox 8 will
  230. not output raw measurement data. You may enable the other constellations
  231. with a u-blox 9, but support for non-GPS in PPP services is limited.
  232. ...................................
  233. $ ubxtool -p CFG-GNSS
  234. [...]
  235. UBX-CFG-GNSS:
  236. Ver: 0 ChHw; 20 ChUse: 20, Blocks: 7
  237. gnssId: GPS TrkCh: 8 maxTrCh: 16, Flags: 0x1 01 00 01
  238. L1C/A enabled
  239. gnssId: SBAS TrkCh: 1 maxTrCh: 3, Flags: 0x1 01 00 00
  240. L1C/A
  241. gnssId: Galileo TrkCh: 4 maxTrCh: 8, Flags: 0x1 01 00 00
  242. E1OS
  243. gnssId: BeiDou TrkCh: 8 maxTrCh: 16, Flags: 0x1 01 00 00
  244. B1I
  245. gnssId: IMES TrkCh: 0 maxTrCh: 8, Flags: 0x3 01 00 00
  246. L1
  247. gnssId: QZSS TrkCh: 0 maxTrCh: 3, Flags: 0x5 01 00 01
  248. L1C/A enabled
  249. gnssId: GLONASS TrkCh: 8 maxTrCh: 14, Flags: 0x1 01 00 00
  250. L1OF
  251. [...]
  252. ...................................
  253. Enable the good stuff, the raw measurement messages:
  254. ...................................
  255. $ ubxtool -e RAWX
  256. ...................................
  257. Verify raw data messages are being sent:
  258. ...................................
  259. $ ubxtool | fgrep RAWX
  260. ...................................
  261. You should see this output that confirms you are seeing raw measurement
  262. data from the GPS:
  263. ...................................
  264. UBX-RXM-RAWX:
  265. UBX-RXM-RAWX:
  266. ...................................
  267. After you have completed these steps, do not restart _gpsd_. If you restart
  268. _gpsd_ then you must restart the configuration from the beginning.
  269. === Javad (GREIS) configuration
  270. The section is only for users of Javad GPS supporting the GREIS
  271. language.
  272. Be sure your serial port speed is high enough. use _zerk_, _gpsctl_
  273. may be flaky:
  274. ...................................
  275. $ zerk -S 115200
  276. ...................................
  277. Disable all messages, then enable raw data messages:
  278. ...................................
  279. $ zerk -p DM
  280. $ zerk -e RAW
  281. ...................................
  282. GREIS will happily send data for all satellites seen, but PPP services
  283. only use GPS and maybe GLONASS. Disable all constellations, except GPS
  284. and QZSS:
  285. ...................................
  286. $ zerk -d COMPASS
  287. $ zerk -d GALILEO
  288. $ zerk -d SBAS
  289. $ zerk -e GPS
  290. ...................................
  291. Verify that only GPS and QZSS are enabled:
  292. ...................................
  293. $ zerk -p CONS
  294. zerk: poll CONS
  295. RE: %cons%/par/pos/sys={gps=y,glo=y,gal=n,sbas=n,qzss=n,comp=n,irnss=n}
  296. ...................................
  297. Verify raw data messages are being sent:
  298. ...................................
  299. $ zerk -v 2 | fgrep '[PC]'
  300. ...................................
  301. You should see this output that confirms you are seeing raw measurement
  302. data from the GPS:
  303. ...................................
  304. [PC] cp 199266957.2307 113917941.9777 122453730.9966 108761050.8140 105892190.3611 199725013.5654 117456220.7611 125484683.4227 199977132.8627 126963987.0936 121945102.6244 114688862.4874 140928054.2405 128350477.4361 129924383.6416 199424925.2522 126077127.2204 126780423.4782 120799412.3999
  305. [PC] cp 199266051.1359 113915242.3018 122452018.0540 108761104.8641 105890706.6420 199724109.4819 117454519.9705 125481341.1019 199976227.8647 126966862.6124 121942821.9832 114690162.3442 140924407.3081 128351475.5908 129920370.5866 199424017.5063 126073289.2387 126782833.2288 120800324.7775
  306. ...................................
  307. After you have completed these steps, do not retart _gpsd_. If you restart
  308. _gpsd_ then you must restart the configuration from the beginning.
  309. == Acquire the Raw Data
  310. Configuration complete. Collect 24 hours of samples at 30 second
  311. intervals, save the raw data as RINEX 3 format in the file _today.obs_.
  312. Collecting data at a rate faster than 30 second intervals may degrade
  313. your results. Trimble will average data to 10 second intervals if
  314. the data rate is faster than 10 seconds. Start the long process:
  315. ...................................
  316. $ gpsrinex -i 30 -n 2880 -f today.obs
  317. ...................................
  318. Now is a good time to go the NRCAN's CSRS-PPP page and sign up
  319. for a free account. You need this account to be able to upload the
  320. RINEX 3 file _today.obs_ to their free PPP service for processing.
  321. https://webapp.geod.nrcan.gc.ca/geod/tools-outils/ppp.php
  322. Take a break. You now have 24 hours to contemplate the answer to the
  323. ultimate question of life, the universe, and everything.
  324. == Post Process the Raw Data
  325. More waiting. Before you can post process your data, the PPP service
  326. must be ready for it. Depending on the service it can take from 10 to
  327. 60 minutes before you can upload your new data. For best results you
  328. should wait 2 weeks.
  329. The following two services are known to work with _gpsrinex_. CSRS-PPP
  330. will accept L1 only data, trimble RTX requires L1 and L2 data. Try
  331. both, with the same data set, if you can. That will show you that their
  332. sigma's are "optimistic".
  333. === CSRS-PPP
  334. After _gpsrinex_ is complete, you need to login to CSRS-PPP and
  335. upload the RINEX 3 file. After login you will be taken to the upload
  336. page. Enter your email address, so the results can be emailed to you.
  337. Select processing mode of Static, using the ITRF datum. Use the "Browse"
  338. button to select the _today.obs_ file with your raw observations. Then
  339. push "Submit to PPP".
  340. All done, except for more waiting. You will receive an email from NRCAN
  341. maybe within minutes, maybe up to 36 hours later, with a link to a file
  342. called: full_output.zip. Unzip, and Voila! Inside is a PDF file with
  343. your precise position, and other goodies.
  344. === Trimble RTX
  345. Before uploading today.obs to Trimble you will need to change the _.obs_
  346. extension to _.YYo_, where YY is the 2-digit year. Then proceed as
  347. above with CSRS-PPP.
  348. === GAPS
  349. The University of New Brunswich has an online PPP service. They call
  350. it GNSS Analysis and Positioning Software (GAPS). GAPS requires
  351. observations from the L2 P signal or L5 signal. No u-blox chip
  352. follows the L2 P signal.
  353. == References
  354. Wikipedia has a little information on PPP:
  355. https://en.wikipedia.org/wiki/Precise_Point_Positioning
  356. Information on how different datums differ:
  357. https://confluence.qps.nl/qinsy/en/world-geodetic-system-1984-wgs84-29855173.html
  358. Information on vertical datums:
  359. https://www.nrcan.gc.ca/earth-sciences/geomatics/geodetic-reference-systems/9054#_Toc372901506
  360. One service known to work with gpsrinex output is CSRS-PPP at NRCAN:
  361. https://webapp.geod.nrcan.gc.ca/geod/tools-outils/ppp.php
  362. Another service known to work with gpsrinex output is Trimble RTX
  363. from Trimble. They require dual frequency (L1 and L2) raw data:
  364. https://trimblertx.com/Home.aspx
  365. GAPS requires L2 P or L5 I+Q signals, and is not supported by gpsd:
  366. http://gaps.gge.unb.ca/
  367. OPUS requires L1/L2 frequency observation files, and has limited geographic
  368. coverage:
  369. https://www.ngs.noaa.gov/OPUS/
  370. The curious can find the RINEX 3.04 format described here:
  371. ftp://ftp.igs.org/pub/data/format/rinex304.pdf
  372. // vim: set syntax=asciidoc: