ppp-howto.adoc 20 KB

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