ppp-howto.adoc 18 KB

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