"Initial commit to Gerrit"
[profile/ivi/gpsd.git] / rtcm-104.xml
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!--
3 This file is Copyright (c) 2010 by the GPSD project
4 BSD terms apply: see the file COPYING in the distribution root for details.
5 -->
6 <!DOCTYPE refentry PUBLIC 
7    "-//OASIS//DTD DocBook XML V4.1.2//EN"
8    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
9 <refentry id='rtcm104.5'>
10 <refentryinfo><date>27 Aug 2009</date></refentryinfo>
11 <refmeta>
12 <refentrytitle>rtcm-104</refentrytitle>
13 <manvolnum>5</manvolnum>
14 <refmiscinfo class="source">The GPSD Project</refmiscinfo>
15 <refmiscinfo class="manual">GPSD Documentation</refmiscinfo>
16 </refmeta>
17 <refnamediv id='name'>
18 <refname>rtcm-104</refname>
19 <refpurpose>RTCM-104 dump format emitted by GPSD tools</refpurpose>
20 </refnamediv>
21
22 <refsect1 id='overview'><title>OVERVIEW</title>
23
24 <para>RTCM-104 is a family of serial protocols used for broadcasting pseudorange
25 corrections from differential-GPS reference stations.  This manual
26 page describes some aspects of the RTCM protocol, mainly in order to
27 explain the RTCM-104 dump formats emitted by
28 <citerefentry><refentrytitle>gpsdecode</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
29 It describes that dump format completely.</para>
30
31 <para>RTCM-104 comes in two major and incompatible flavors, 2.x and
32 3.x.  Each major flavor has minor (compatible) revisions.</para>
33
34 <para>The applicable standard for RTCM Version 2.x is <citetitle>RTCM
35 Recommended Standards for Differential NAVSTAR GPS Service</citetitle>
36 RTCM Paper 194-93/SC 104-STD. For RTCM 3.1 it is <citetitle>RTCM Paper
37 177-2006-SC104-STD</citetitle>.  Ordering instructions for both
38 standards are accessible from the website of the <ulink
39 url='http://www.rtcm.org/'>Radio Technical Commission for Maritime
40 Services</ulink> under "Publications".</para>
41
42 </refsect1>
43 <refsect1 id='wire-format'><title>RTCM WIRE TRANSMISSIONS</title>
44
45 <para>Differential-GPS correction stations consist of a GPS reference
46 receiver coupled to a low frequency (LF) transmitter.  The GPS
47 reference receiver is a survey-grade GPS that does GPS carrier
48 tracking and can work out its own position to a few millimeters.  It
49 generates range and range-rate corrections and encodes them into
50 RTCM104. It ships the RTCM104 to the LF transmitter over serial rs-232
51 signal at 100 baud or 200 baud depending on the requirements of the
52 transmitter.</para>
53
54 <para>The LF transmitter broadcasts the the approximately 300khz radio
55 signal that differential-GPS radio receivers pick up.  Transmitters
56 that are meant to have a higher range will need to transmit at the
57 slower rate.  The higher the data rate the harder it will be for the
58 remote radio receiver to receive with a good signal-to-noise ration.
59 (Higher data rate signals can't be averaged over as long a time frame,
60 hence they appear noisier.)</para>
61
62 </refsect1>
63 <refsect1 id='rtcm-wire-format'><title>RTCM WIRE FORMATS</title>
64
65 <para>An RTCM 2.x message consists of a sequence of up to 33 30-bit
66 words. The 24 most significant bits of each word are data and the six
67 least significant bits are parity. The parity algorithm used is the
68 same ISGPS-2000 as that used on GPS satellite downlinks.  Each RTCM
69 2.x message consists of two header words followed by zero or more data
70 words, depending upon message type.</para>
71
72 <para>An RTCM 3.x message begins with a fixed leader byte 0xD3.  That
73 is followed by six bits of version information and 10 bits of payload
74 length information.  Following that is the payload; following the 
75 payload is a 3-byte checksum of the payload using the Qualcomm CRC-24Q
76 algorithm.</para>
77
78 </refsect1>
79 <refsect1 id='sager-dump-format2'><title>SAGER RTCM2 DUMP FORMAT</title>
80
81 <para>For each message, the header is listed first, followed by zero
82 or more lines containing the specific data for that message, followed
83 by a trailing sentinel line containing a single dot. The general format is a
84 line beginning with a capital letter, followed by a tab, followed by
85 the fields of the message separated by tabs, terminated by a
86 newline.</para>
87
88 <refsect2><title>Header message (H)</title>
89
90 <literallayout>
91 H &lt;message type&gt; &lt;reference station id&gt; &lt;modified z_count&gt; &lt;sequence number&gt;
92   &lt;message length&gt; &lt;station health&gt; [T &lt;useful length&gt;]
93 </literallayout>
94
95 <para>Here is an example:</para>
96
97 <informalexample><literallayout>
98 H       9       268     249.6   1       5       0
99 S       13      0       3       249.6   -26.120 0.068
100 S       2       0       73      249.6   1.220   -0.080
101 S       8       0       22      249.6   23.760  0.030
102 .
103 </literallayout></informalexample>
104
105 <para>&lt;message type&gt; is one of</para>
106
107 <variablelist>
108 <varlistentry>
109 <term>1</term>
110 <listitem><para>full corrections - one message containing corrections for
111 all satellites in view. This is not common.</para></listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term>3</term>
116 <listitem><para>reference station parameters - the position of the
117 reference station GPS antenna.</para></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term>4</term>
122 <listitem><para>datum &mdash; the datum to which the DGPS data is
123 referred.</para></listitem>
124 </varlistentry>
125
126 <varlistentry>
127 <term>5</term>
128 <listitem><para>constellation health &mdash; information about the
129 satellites the beacon can see</para></listitem>
130 </varlistentry>
131
132 <varlistentry>
133 <term>6</term>
134 <listitem><para>null message &mdash; just a filler.</para></listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term>7</term>
139 <listitem><para>radio beacon almanac &mdash; information about this or other beacons.</para></listitem>
140 </varlistentry>
141
142 <varlistentry>
143 <term>9</term>
144 <listitem><para>subset corrections &mdash; a message containing corrections
145 for only a subset of the satellites in view.</para></listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term>16</term>
150 <listitem><para>special message &mdash; a text message from the beacon
151 operator.</para></listitem>
152 </varlistentry>
153 </variablelist>
154
155 <para>&lt;reference station id&gt; is the id of the GPS reference receiver. The
156 LF transmitters also have (different) id numbers.</para>
157
158 <para>&lt;modified z_count&gt; is the reference time of the
159 corrections in the message in seconds within the current hour. Note
160 that it is in GPS time, which is some seconds ahead of UTC (see the
161 U.S. Naval Observatory's <ulink
162 url="ftp://maia.usno.navy.mil/ser7/tai-utc.dat">table of leap second
163 corrections</ulink>).</para>
164
165 <para>&lt;sequence no&gt; is a number which increments, modulo 8, for each
166 message transmitted.</para>
167
168 <para>&lt;message length&gt; is the number of words after the header that
169 comprise the message.</para>
170
171 <para>&lt;station health&gt; indicates the health of the beacon as a
172 reference source.  Any nonzero value means the satellite is probably
173 transmitting bad data and should not be used in a fix. 6 means the
174 transmission is unmonitored. 7 means the station is not working
175 properly. Other values are defined by the beacon operator.
176 </para>
177
178 <para>If the message contains a parity error after the header but before
179 the end of the message, then the extra fields [T &lt;useful length&gt;]
180 are appended to indicate a truncated message.</para>
181
182 <para>Here is an example:</para>
183
184 <informalexample><literallayout>
185 H       9       687     331.8   1       5       0       T       4
186 </literallayout></informalexample>
187
188 <para>&lt;useful length&gt; indicates the number of useful words before the
189 parity error. Depending on the message type, useful information
190 may still be extracted.</para>
191
192 </refsect2>
193 <refsect2><title>Correction data (S)</title>
194
195 <para>One or more of these follow the header for type 1 or type 9
196 messages. Here is the format:</para>
197
198 <literallayout>
199 S &lt;satellite&gt; &lt;udre&gt; &lt;iod&gt; &lt;modified z_count&gt; &lt;range error&gt;
200   &lt;range error rate&gt;
201 </literallayout>
202
203 <para>Here is an example:</para>
204
205 <informalexample><literallayout>
206 S       7       0       199     331.8   -12.160 0.288
207 </literallayout></informalexample>
208
209 <para>&lt;satellite&gt; is the PRN number of the satellite for which this is
210 correction data.</para>
211
212 <para>&lt;udre&gt; is User Differential Range Error with the following
213 values:</para>
214
215 <literallayout>
216 0       1-sigma error   &lt;= 1m
217 1       1-sigma error   &lt;= 4m
218 2       1-sigma error   &lt;= 8m
219 3       1-sigma error   &gt;  8m
220 </literallayout>
221
222 <para>&lt;iod&gt; is Issue Of Data, matching the IOD for the current
223 ephemeris of this satellite, as transmitted by the satellite.  The IOD
224 is a unique tag that identifies the ephemeris; the GPS using the DGPS
225 correction and the DGPS generating the data must use the same orbital
226 positions for the satellite.</para>
227
228 <para>&lt;modified z_count&gt; is just a copy of the same field from
229 the header.</para>
230
231 <para>&lt;range error&gt; is the pseudorange error in meters for this satellite
232 as measured by the beacon reference receiver at the epoch indicated
233 by &lt;modified z_count&gt;</para>
234
235 <para>&lt;range error rate&gt; is the rate of change of pseudorange error in
236 meters/sec for this satellite as measured by the beacon reference
237 receiver at the epoch indicated by &lt;modified z_count&gt;. This is
238 used to calculate pseudorange errors at other epochs, if
239 required by the GPS receiver.</para>
240
241 </refsect2>
242 <refsect2><title>Reference Station Parameters (R)</title>
243
244 <para>Here is the format:</para>
245
246 <literallayout>
247 R &lt;X-coordinate&gt; &lt;Y-coordinate&gt; &lt;Z-coordinate&gt;
248 </literallayout>
249
250 <para>Here is an example:</para>
251
252 <informalexample><literallayout>
253 R       3746729.40      -5086.23        5144450.67
254 </literallayout></informalexample>
255
256 <para>The coordinates are the position of the station, in meters to two
257 decimal places, in Earth Centred Earth Fixed coordinates.
258 These are usually referred to the WGS84 reference frame, but may
259 be referred to NAD83 in the US (essentially identical to WGS84 for
260 all except geodesists), or to some other reference frame in other
261 parts of the world.</para>
262
263 </refsect2>
264 <refsect2><title>Datum (D)</title>
265
266 <para>Here is the format:</para>
267
268 <literallayout>
269 D &lt;dgnss type&gt; &lt;dat&gt; &lt;datum name&gt; [ &lt;dx&gt; &lt;dy&gt; &lt;dz&gt; ]
270 </literallayout>
271
272 <para>Here is an (artificial) example:</para>
273
274 <informalexample><literallayout>
275 D       GPS     0       ABC12   25.8    30.5    33.0
276 </literallayout></informalexample>
277
278 <para>&lt;dgnss type&gt; is either GPS or GLONASS.</para>
279
280 <para>&lt;dat&gt; is 0 or 1 and indicates the sense of the offset
281 shift given by dx, dy, dz. dat = 0 means that the station coordinates
282 (in the reference message) are referred to a local datum and that
283 adding dx, dy, dz to that position will render it in GNSS coordinates
284 (WGS84 for GPS). If dat = 1 then the ref station position is in GNSS
285 coordinates and adding dx, dy, dz will give it referred to the local
286 datum.</para>
287
288 <para>&lt;datum name&gt; is a standard name for the datum.</para>
289
290 <para>&lt;dx&gt; &lt;dy&gt; &lt;dz&gt; are offsets to convert from
291 local datum to GNSS datum or vice versa. These fields are
292 optional.</para>
293
294 </refsect2>
295 <refsect2><title>Constellation Health (C)</title>
296
297 <para>One or more of these follow the header for type 5 messages &mdash; one
298 for each satellite.</para>
299
300 <para>Here is the format:</para>
301
302 <literallayout>
303 C &lt;sat&gt; &lt;iodl&gt; &lt;health&gt; &lt;snr&gt; &lt;hlth en&gt; &lt;new data&gt; &lt;los warning&gt;
304   &lt;time to unhealthy&gt;
305 </literallayout>
306
307 <para>Here is an example:</para>
308
309 <informalexample><literallayout>
310 C       29      0  0    53      0  0  0  0
311 </literallayout></informalexample>
312
313 <para>&lt;sat&gt; is the PRN number of the satellite.</para>
314
315 <para>&lt;iodl&gt; is 1 bit. 0 indicates that this information relates to the
316 satellite information in an accompanying type 1 or type 9 message.</para>
317
318 <para>&lt;health&gt; 0 indicates that the satellite is healthy. Any other value
319 indicates a problem (coding is not known).</para>
320
321 <para>&lt;snr&gt; gives the carrier/noise ratio of the received signal in the
322 range 25 to 55 dB(Hz).</para>
323
324 <para>&lt;health en&gt; is 1 bit. If set to 1 it indicates that the
325 satellite is healthy even if the satellite navigation data says it is
326 unhealthy.</para>
327
328 <para>&lt;new data&gt; is 1 bit. a 1 indicates that the IOD for this
329 satellite will soon be updated in type 1 or 9 messages.</para>
330
331 <para>&lt;los warning&gt; is 1 bit. a 1 indicates that the satellite
332 will shortly go unhealthy. The healthy time remaining is given in the
333 &lt;time to unhealthy&gt; field.</para>
334
335 </refsect2>
336 <refsect2><title>Radio Beacon Almanac (A)</title>
337
338 <para>Here is the format:</para>
339
340 <literallayout>
341 A &lt;latitude&gt; &lt;longitude&gt; &lt;range&gt; &lt;frequency&gt; &lt;health&gt; &lt;station id&gt;
342   &lt;bitrate&gt;
343 </literallayout>
344
345 <para>Here is an example:</para>
346
347 <informalexample><literallayout>
348 A       54.1176 -0.0714 100     302.5   0       447     2
349 </literallayout></informalexample>
350
351 <para>&lt;latitude&gt; and &lt;longitude&gt; give the position, in
352 degrees, of the LF transmitter antenna for the station for which this
353 is an almanac.  North and East are positive.</para>
354
355 <para>&lt;range&gt; is the published range of the station in km.</para>
356
357 <para>&lt;frequency&gt; is the broadcast frequency in kHz.</para>
358
359 <para>&lt;health&gt; is the health of the station for which this is an
360 almanac. If it is non-zero, the station is issuing suspect data and
361 should not be used for fixes.  The ITU and RTCM104 standards differ
362 about the mode detailed interpretation of
363 the &lt;health&gt; field and even about its bit width.
364 <!--
365 From itu p.9 just under the type7 msg figure:
366  
367     *** Radiobeacon health:
368                   00     (0) Radiobeacon operation normal
369                   01     (1) No integrity monitor operating
370                   10     (2) No information available
371                   11     (3) Do not use this radiobeacon
372 RTCM104, in the other hand, makes it 3 bits wide.
373
374 The Sager documentation said health has the same meaning as in the header.
375 but this cannot be true unless the field is 3 bits wide.
376 -->
377 </para>
378
379 <para>&lt;station id&gt; is the id of the transmitter. This is not the same
380 as the reference id in the header, the latter being the id of
381 the reference receiver. 
382 <!-- John Sager noted: "However I know of at least one station
383 that gets it wrong." --></para>
384
385 <para>&lt;bitrate&gt; indicates the transmitted bitrate.</para>
386
387 </refsect2>
388 <refsect2><title>Special Message (T)</title>
389
390 <para>Here is the format:</para>
391
392 <literallayout>
393 T &lt;text&gt;
394 </literallayout>
395
396 <para>Here is an example:</para>
397
398 <informalexample><literallayout>
399 T       THLS TRIAL SERVICE
400 </literallayout></informalexample>
401
402 <para>&lt;text&gt; is just a text message sent by the beacon operator.</para>
403
404 </refsect2>
405 <refsect2><title>Null (N)</title>
406
407 <para>This just indicates a null message. There are no fields.</para>
408 </refsect2>
409 <refsect2><title>Unknown message (U)</title>
410 <!-- The Sager decoder didn't have this -->
411
412 <para>This is used to dump message words in hexadecimal when the
413 message type field doesn't match any of the known ones.</para>
414
415 <para>Here is the format:</para>
416
417 <literallayout>
418 U &lt;hex-literal&gt;
419 </literallayout>
420
421 <para>Here is an example:</para>
422
423 <informalexample><literallayout>
424 U       0x76423055
425 </literallayout></informalexample>
426
427 <para>The &lt;hex-literal&gt; will represent 32 bits of information,
428 after parity checks and inversion.  The high two bits should be
429 ignored.</para>
430
431 </refsect2>
432 <refsect2><title>Null (N)</title>
433
434 <para>This just indicates a null message. There are no fields.</para>
435 </refsect2>
436
437 <!--
438 Decoder Status Messages (M)
439
440 format:
441
442 M &lt;type&gt;: &lt;information&gt;
443
444 examples:
445
446 M       state change: NO_SYNC -&gt; WORD_SYNCING
447 M       sync_bit: 5
448
449 &lt;type&gt; indicates textually the type of message. There are
450 only the two types shown above.
451
452 &lt;information&gt;
453 For &lt;type&gt; = state change it describes the internal state
454 transition of the decoder when it changes state as a result
455 of the incoming data.
456
457 For &lt;type&gt; = sync_bit this indicates the bit position in the
458 serial data stream which is a word boundary.
459 -->
460
461 </refsect1>
462 <refsect1 id='json-dump-format2'><title>JSON RTCM2 DUMP FORMAT</title>
463
464 <para>Fields are dumped in the order and with the conversions
465 described above, except that they are wrapped in a single JSON
466 object per message and appear as attributes of that object.  Arrays of
467 satellite, station, and constellation statistics become arrays of
468 JSON sub-objects.</para>
469
470 <para>(One exception: The zcount field included in the Sager-format
471 per-satellite reports in type 1 and 9 messages is omitted from the 
472 JSON version, as it is redundant with the zcount attribute of the
473 parent object.)</para>
474
475 </refsect1>
476 <refsect1 id='dump-format3'><title>RTCM3 DUMP FORMAT</title>
477
478 <para>The support for RTCM104v3 dumping is still incomplete and
479 buggy. Anyone interested in it should read the source code.</para>
480
481 </refsect1>
482 <refsect1 id='see_also'><title>SEE ALSO</title>
483 <para>
484 <citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
485 <citerefentry><refentrytitle>gps</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
486 <citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
487 <citerefentry><refentrytitle>libgpsd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
488 <citerefentry><refentrytitle>gpsprof</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
489 <citerefentry><refentrytitle>gpsfake</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
490 </para>
491 </refsect1>
492
493 <refsect1 id='compatibility'><title>COMPATIBILITY NOTE</title> 
494
495 <para>In versions of the RTCM2 dump format prior to gpsd 2.28, there was
496 no trailing sentinel line after each stanza of the Sager-format dump.</para>
497
498 </refsect1>
499 <refsect1 id='maintainer'><title>AUTHOR</title> 
500
501 <para>Much of the portion of this text describing RTCM2 was originally
502 written by John Sager <email>john.sager@btinternet.com</email> in
503 association with his RTCM2 decoder. Other material comes from the GPSD
504 project.  There is a project page for <application>gpsd</application>
505 <ulink url="http://gpsd.berlios.de/">here</ulink>.</para>
506
507 </refsect1>
508
509 </refentry>