feat: 导入 NMEA-0183 GPS 协议解析库(node-nmea)
NMEA-0183 语句解析器,含 21 个语句类型 codec 与配套单元测试。 - codecs/:APB/BWC/DBT/GGA/GLL/GRMT/GSA/GSV/HDG/HDM/HDT/MWV/RDID/ RMB/RMC/ROT/RSA/TXT/VTG/VWR/ZDA - test/:各 codec 对应的 mocha 用例 - .github/workflows/:node与 npm-publish 流水线 许可证:MIT(原作者 James Penn)
This commit is contained in:
51
codecs/RMB.js
Normal file
51
codecs/RMB.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
=== RMB Recommended Minimum Navigation Information ===
|
||||
|
||||
To be sent by a navigation receiver when a destination waypoint is active.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
||||
| | | | | | | | | | | | | |
|
||||
$--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A*hh
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Field Number:
|
||||
|
||||
1) Status, V = Navigation receiver warning
|
||||
2) Cross Track error - nautical miles
|
||||
3) Direction to Steer, Left or Right
|
||||
4) FROM Waypoint ID
|
||||
5) TO Waypoint ID
|
||||
6) Destination Waypoint Latitude
|
||||
7) N or S
|
||||
8) Destination Waypoint Longitude
|
||||
9) E or W
|
||||
10) Range to destination in nautical miles
|
||||
11) Bearing to destination in degrees True
|
||||
12) Destination closing velocity in knots
|
||||
13) Arrival Status, A = Arrival Circle Entered
|
||||
14) Checksum
|
||||
|
||||
*/
|
||||
exports.TYPE = 'nav-info-waypoint';
|
||||
exports.ID = 'RMB';
|
||||
|
||||
exports.decode = function(fields) {
|
||||
return {
|
||||
sentence: exports.ID,
|
||||
type: exports.TYPE,
|
||||
status: fields[1] == 'V' ? 'warning' : 'valid',
|
||||
crossTrackError: +fields[2],
|
||||
steer: fields[3],
|
||||
fromWaypoint: fields[4],
|
||||
toWaypoint: fields[5],
|
||||
lat: fields[6],
|
||||
latPole: fields[7],
|
||||
lon: fields[8],
|
||||
lonPole: fields[9],
|
||||
range: +fields[10],
|
||||
bearing: +fields[11],
|
||||
vmg: +fields[12],
|
||||
arrived: fields[13] == 'A' ? true : false
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user