Giter Site home page Giter Site logo

node-ntrip / rtcm Goto Github PK

View Code? Open in Web Editor NEW
35.0 7.0 21.0 521 KB

Decoder/encoder for all RTCM 3 message types up to RTCM 3.3 Amendment 1 (c10403.3).

Home Page: https://www.npmjs.com/package/@gnss/rtcm

License: GNU General Public License v3.0

TypeScript 99.97% JavaScript 0.03%
rtcm

rtcm's Introduction

RTCM 3 Decoder/Encoder

Decoder/encoder for all RTCM 3 message types up to RTCM 3.3 Amendment 1 (c10403.3).

Installing

npm install -S @gnss/rtcm

Basic Usage

Decoding

let buffer: Buffer = ...; // Raw bytes of message to be decoded
let message: RtcmMessage; // Decoded message
let length: number; // Length of decoded message in bytes
[message, length] = RtcmTransport.decode(buffer);
// ...
buffer = buffer.slice(length); // Move to next message

Encoding

let message = ...; // Message to be encoded
let buffer: Buffer = Buffer.allocUnsafe(RtcmTransport.MAX_PACKET_SIZE);
let length: number; // Length of encoded message in bytes
length = RtcmTransport.encode(message, buffer);
// ...
buffer = buffer.slice(0, length); // Encoded message

Creating

Messages can be manually constructed using RtcmMessage???.construct({}), which requires all message properties to be provided.

RtcmMessagePhysicalReferenceStationPosition.construct({
    nonPhysicalReferenceStationId: 1,
    physicalReferenceStationId: 0,
    itrfEpochYear: 0,
    arpEcefX: 37927650000,
    arpEcefY: -4160650000,
    arpEcefZ: 50938770000
})

Streams

Transform streams to convert from RtcmMessages to raw bytes and vice-versa.

let input: stream.Readable = ...;
let output: stream.Writable = ...;
input                                      // Stream of raw data
    .pipe(new RtcmDecodeTransformStream()) // Stream of RtcmMessage objects
    .pipe(new RtcmEncodeTransformStream()) // Stream of (identical) raw data
    .pipe(output);

RtcmDecodeTransformStream can optionally synchronize with the raw data stream e.g. if it starts receiving data from the middle of a message.

Messages Supported

  • MT1001 (RtcmMessageGpsL1Observables)
  • MT1002 (RtcmMessageGpsL1ObservablesExtended)
  • MT1003 (RtcmMessageGpsL1L2Observables)
  • MT1004 (RtcmMessageGpsL1L2ObservablesExtended)
  • MT1005 (RtcmMessageStationaryArp)
  • MT1006 (RtcmMessageStationaryArpHeight)
  • MT1007 (RtcmMessageAntennaDescriptor)
  • MT1008 (RtcmMessageAntennaDescriptorSerial)
  • MT1009 (RtcmMessageGlonassL1Observables)
  • MT1010 (RtcmMessageGlonassL1ObservablesExtended)
  • MT1011 (RtcmMessageGlonassL1L2Observables)
  • MT1012 (RtcmMessageGlonassL1L2ObservablesExtended)
  • MT1013 (RtcmMessageAuxiliaryOperationInformation)
  • MT1014 (RtcmMessageNetworkAuxiliaryStationData)
  • MT1015 (RtcmMessageGpsIonosphericCorrectionDifferences)
  • MT1016 (RtcmMessageGpsGeometricCorrectionDifferences)
  • MT1017 (RtcmMessageGpsCombinedCorrectionDifferences)
  • MT1019 (RtcmMessageGpsSatelliteEphemeris)
  • MT1020 (RtcmMessageGlonassSatelliteEphemerisData)
  • MT1021 (RtcmMessageHelmertAbridgedMolodenskiTransformationParameters)
  • MT1022 (RtcmMessageMolodenskiBadekasTransformationParameters)
  • MT1023 (RtcmMessageResidualsEllipsoidalGridRepresentation)
  • MT1024 (RtcmMessageResidualsPlaneGridRepresentation)
  • MT1025 (RtcmMessageProjectionParametersExceptLcc2spOm)
  • MT1026 (RtcmMessageProjectionParametersLcc2sp)
  • MT1027 (RtcmMessageProjectionParametersOm)
  • MT1029 (RtcmMessageUnicodeTextString)
  • MT1030 (RtcmMessageGpsNetworkRtkResidual)
  • MT1031 (RtcmMessageGlonassNetworkRtkResidual)
  • MT1032 (RtcmMessagePhysicalReferenceStationPosition)
  • MT1033 (RtcmMessageReceiverAntennaDescriptor)
  • MT1034 (RtcmMessageGpsNetworkFkpGradient)
  • MT1035 (RtcmMessageGlonassNetworkFkpGradient)
  • MT1037 (RtcmMessageGlonassIonosphericCorrectionDifferences)
  • MT1038 (RtcmMessageGlonassGeometricCorrectionDifferences)
  • MT1039 (RtcmMessageGlonassCombinedCorrectionDifferences)
  • MT1041 (RtcmMessageIrnssSatelliteEphemerisData)
  • MT1042 (RtcmMessageBdsSatelliteEphemerisData)
  • MT1044 (RtcmMessageQzssSatelliteEphemerisData)
  • MT1045 (RtcmMessageGalileoFNavSatelliteEphemerisData)
  • MT1046 (RtcmMessageGalileoINavSatelliteEphemerisData)
  • MT1057 (RtcmMessageSsrGpsOrbitCorrection)
  • MT1058 (RtcmMessageSsrGpsClockCorrection)
  • MT1059 (RtcmMessageSsrGpsCodeBias)
  • MT1060 (RtcmMessageSsrGpsCombinedCorrection)
  • MT1061 (RtcmMessageSsrGpsUra)
  • MT1062 (RtcmMessageSsrGpsHighRateClockCorrection)
  • MT1063 (RtcmMessageSsrGlonassOrbitCorrection)
  • MT1064 (RtcmMessageSsrGlonassClockCorrection)
  • MT1065 (RtcmMessageSsrGlonassCodeBias)
  • MT1066 (RtcmMessageSsrGlonassCombinedCorrection)
  • MT1067 (RtcmMessageSsrGlonassUra)
  • MT1068 (RtcmMessageSsrGlonassHighRateClockCorrection)
  • MT1071 (RtcmMessageMsm1Gps)
  • MT1072 (RtcmMessageMsm2Gps)
  • MT1073 (RtcmMessageMsm3Gps)
  • MT1074 (RtcmMessageMsm4Gps)
  • MT1075 (RtcmMessageMsm5Gps)
  • MT1076 (RtcmMessageMsm6Gps)
  • MT1077 (RtcmMessageMsm7Gps)
  • MT1081 (RtcmMessageMsm1Glonass)
  • MT1082 (RtcmMessageMsm2Glonass)
  • MT1083 (RtcmMessageMsm3Glonass)
  • MT1084 (RtcmMessageMsm4Glonass)
  • MT1085 (RtcmMessageMsm5Glonass)
  • MT1086 (RtcmMessageMsm6Glonass)
  • MT1087 (RtcmMessageMsm7Glonass)
  • MT1091 (RtcmMessageMsm1Galileo)
  • MT1092 (RtcmMessageMsm2Galileo)
  • MT1093 (RtcmMessageMsm3Galileo)
  • MT1094 (RtcmMessageMsm4Galileo)
  • MT1095 (RtcmMessageMsm5Galileo)
  • MT1096 (RtcmMessageMsm6Galileo)
  • MT1097 (RtcmMessageMsm7Galileo)
  • MT1101 (RtcmMessageMsm1Sbas)
  • MT1102 (RtcmMessageMsm2Sbas)
  • MT1103 (RtcmMessageMsm3Sbas)
  • MT1104 (RtcmMessageMsm4Sbas)
  • MT1105 (RtcmMessageMsm5Sbas)
  • MT1106 (RtcmMessageMsm6Sbas)
  • MT1107 (RtcmMessageMsm7Sbas)
  • MT1111 (RtcmMessageMsm1Qzss)
  • MT1112 (RtcmMessageMsm2Qzss)
  • MT1113 (RtcmMessageMsm3Qzss)
  • MT1114 (RtcmMessageMsm4Qzss)
  • MT1115 (RtcmMessageMsm5Qzss)
  • MT1116 (RtcmMessageMsm6Qzss)
  • MT1117 (RtcmMessageMsm7Qzss)
  • MT1121 (RtcmMessageMsm1Bds)
  • MT1122 (RtcmMessageMsm2Bds)
  • MT1123 (RtcmMessageMsm3Bds)
  • MT1124 (RtcmMessageMsm4Bds)
  • MT1125 (RtcmMessageMsm5Bds)
  • MT1126 (RtcmMessageMsm6Bds)
  • MT1127 (RtcmMessageMsm7Bds)
  • MT1131 (RtcmMessageMsm1Irnss)
  • MT1132 (RtcmMessageMsm2Irnss)
  • MT1133 (RtcmMessageMsm3Irnss)
  • MT1134 (RtcmMessageMsm4Irnss)
  • MT1135 (RtcmMessageMsm5Irnss)
  • MT1136 (RtcmMessageMsm6Irnss)
  • MT1137 (RtcmMessageMsm7Irnss)
  • MT1230 (RtcmMessageGlonassL1L2CodePhaseBiases)

Testing

npm test

License

GPLv3

Contributions

Contributions of new message types, bug fixes and general improvements via pull requests are welcome. Please ensure that code style matches that of the existing files.

rtcm's People

Contributors

nebkat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtcm's Issues

targetStart out of range in Buffer.copy() line 70 in stream.ts

var this.index can be negative (line 110 - with "this.index -= potential")

when this.index is negative, line 70 crash.
chunk.copy(this.buffer, this.index, chunkOffset, chunkOffset + copyBytes);

with this test after line 110, I have no crash:
if (this.index < 0) {
this.index = 0
}

translate message types

I have a NTRIP source that only sends message types 1004 (RtcmMessageGpsL1L2ObservablesExtended) and 1012 (RtcmMessageGlonassL1L2ObservablesExtended).

Unfortunately, the u-blox ZED-F9P receiver does not support these message types, but only 1005, 1006, 1007, 1033, 1074, 1075, 1077, 1084, 1085, 1087, 1094, 1095, 1097, 1124, 1125, 1127, 1230.

It seems that the equivalent to 1014 is 1077 (RtcmMessageMsm7Gps) or 1074 (RtcmMessageMsm4Gps) and the equivalent to 1012 is 1087 (RtcmMessageMsm7Glonass) or 1084 (RtcmMessageMsm5Glonass).

Is there any hope I can use this repo to translate 1014 messages to 1077/1074 and 1012 to 1087/1084?

I had a look at the source code but since I'm not a RTCM expert, I'm having difficulties to find an answer.

Thanks!

ReferenceError: TextDecoder is not defined

The decode-encode.js file is using TextDecoder and TextEncoder without import and may provoc crash on few devices.
To fix it i simply add the import TextDecoder = require("util").TextDecoder;

SO: Ubuntu 20.04.2 LTS
Node version: v10.19.0
Npm: 6.14.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.