rtcm

package
v0.807.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rtcm decodes the RTCM 3.x differential-GNSS message framing — the protocol a GNSS base station broadcasts (over radio, NTRIP or a serial link) to feed real-time corrections to rovers. It is the third protocol in the GNSS triad alongside internal/nmea (gps_nmea_decode, the text output) and internal/ubx (ubx_decode, the u-blox binary input): a u-blox / Septentrio / Trimble receiver in a base/rover RTK setup emits RTCM3.

The GNSS-integrity angle: injecting forged RTCM corrections (a false 1005 reference-station position, or fabricated observables) is a known way to pull an RTK rover off its true fix. Decoding an RTCM stream lets an analyst see the reference-station id, the broadcast base-station ECEF position, and which message types / constellations a stream carries — surfacing an anomalous or spoofed correction source.

Wrap-vs-native judgement

Native. The RTCM3 transport frame is a fixed, fully-public wire
format (a 0xD3 preamble, 6 reserved bits, a 10-bit payload
length, the payload, and a 24-bit CRC-24Q parity) defined in
the RTCM 10403.x standard; the CRC-24Q polynomial (0x1864CFB)
is the same Qualcomm CRC used across GNSS. Frame parsing + a
bit reader + a CRC loop is a few hundred lines, so a runtime
dependency would not be justified. stdlib only, no new go.mod
dep.

What this package covers

  • RTCM3 transport framing: the 0xD3 preamble, 10-bit length, and the CRC-24Q (poly 0x1864CFB) over the whole frame, validated. A stream of back-to-back frames decodes to a list; leading non-preamble bytes are skipped so a mid-stream capture still parses. A frame whose CRC fails is surfaced with checksum_ok=false rather than dropped.
  • Message-type identification (DF002, the first 12 payload bits) with a name for the common types: the 1001-1004 / 1009-1012 legacy RTK observables, 1005/1006 station ARP, 1007/1008/1033 antenna & receiver descriptors, 1019/1020/ 1042-1046 ephemerides, the 107x-112x MSM (multiple-signal message) families per constellation, and 1230 GLONASS code- phase biases. The reference-station id (DF003) is surfaced for the message types that carry it at bits 12-23.
  • 1005 / 1006 Stationary RTK Reference Station ARP — the base-station antenna reference point as ECEF X / Y / Z (in metres, from the 38-bit 0.0001 m fields), the GPS / GLONASS / Galileo service indicators, and (1006 only) the antenna height. This is the message a spoofed-correction attack would tamper with, so it is bodied out.

What this package does NOT cover (deliberately out of scope)

  • The observable / ephemeris / MSM message bodies — these carry per-satellite pseudorange / carrier-phase / orbit data whose decode is large and constellation-specific; the frame is CRC-validated and the type + station id surfaced, with the payload left as raw hex rather than guessed. The station-ARP messages (1005/1006) are the ones bodied out because they carry the base position an integrity check cares about.
  • RTCM 2.x (the older word-based framing) — a different, legacy protocol.
  • NTRIP transport (the HTTP-like caster protocol that carries RTCM over the internet) — separate layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	MessageType        int         `json:"message_type"`
	TypeName           string      `json:"type_name"`
	Length             int         `json:"payload_length"`
	ChecksumOK         bool        `json:"checksum_ok"`
	ReferenceStationID *int        `json:"reference_station_id,omitempty"`
	StationARP         *StationARP `json:"station_arp,omitempty"`
	PayloadHex         string      `json:"payload_hex,omitempty"`
	Notes              []string    `json:"notes,omitempty"`
}

Message is one decoded RTCM3 frame.

func Decode

func Decode(input string) ([]Message, error)

Decode parses every RTCM3 frame found in the input. The input is a hex string (whitespace / ':' / '-' / '_' separators and a '0x' prefix tolerated) carrying one or more back-to-back RTCM3 frames.

type StationARP

type StationARP struct {
	ECEFXm         float64  `json:"ecef_x_m"`
	ECEFYm         float64  `json:"ecef_y_m"`
	ECEFZm         float64  `json:"ecef_z_m"`
	GPSSupported   bool     `json:"gps_supported"`
	GLONASSSupport bool     `json:"glonass_supported"`
	GalileoSupport bool     `json:"galileo_supported"`
	AntennaHeightM *float64 `json:"antenna_height_m,omitempty"`
}

StationARP is the decoded 1005 / 1006 Stationary RTK Reference Station Antenna Reference Point.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL