Skip to content

asv-soft/asv-gnss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

246 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asv.Gnss

Build and Publish Release Version Deploy debug Nuget for Windows

Asv.Gnss is a .NET library for parsing GNSS, aviation, and receiver-control protocols. The project is distributed as the Asv.Gnss NuGet package and also includes console tools for RTCM v3 and ASTERIX stream diagnostics.

Features

  • Parse and serialize NMEA 0183 messages: GBS, GGA, GLL, GSA, GST, GSV, RMC, VTG, ZDA.
  • Parse RTCM v2 and RTCM v3, including legacy messages, ephemeris, stationary RTK, GLONASS bias, and MSM3/MSM4/MSM5/MSM7 messages.
  • Support u-blox UBX messages: ACK, CFG, INF, MON, NAV, RXM.
  • Parse ASTERIX categories 001, 002, 004, 010, 020, 021, 034, 048, and 247.
  • Additional protocols and parsers: ADS-B, ASV, Raw GPS, Raw GLONASS, SBF, ComNav, and Javad.
  • Integration with Asv.IO: protocol registration, routers, ports, GNSS device discovery, and NMEA/RTCM/UBX microservices.

Requirements

  • .NET SDK 10.0.
  • Windows, Linux, or macOS for the library. The local publishing batch scripts require Windows.
  • Visual Studio, JetBrains Rider, or another IDE with SDK-style .NET project support.

Check the installed SDK version:

dotnet --version

Installation

Using the .NET CLI:

dotnet add package Asv.Gnss

Using NuGet Package Manager:

Install-Package Asv.Gnss

Quick Start

The example below creates an Asv.IO protocol, registers GNSS protocols, and opens a port:

using Asv.Gnss;
using Asv.IO;
using R3;

var protocol = Protocol.Create(builder =>
{
    builder.Protocols.RegisterNmeaProtocol();
    builder.Protocols.RegisterRtcmV2Protocol();
    builder.Protocols.RegisterRtcmV3Protocol();
    builder.Protocols.RegisterUbxProtocol();
    builder.Protocols.RegisterAsterixProtocol();
    builder.Features.RegisterBroadcastAllFeature();
    builder.Features.RegisterEndpointIdTagFeature();
});

var router = protocol.CreateRouter("GNSS");
router.AddPort("serial:COM4?br=115200&enabled=true");

using var subscription = router.OnRxMessage.Subscribe(packet =>
{
    Console.WriteLine(packet);
});

Connection string examples supported by the Asv.IO transport layer:

tcp://127.0.0.1:9002
tcps://127.0.0.1:9002
udp://127.0.0.1:1234?rhost=127.0.0.1&rport=1235
serial:COM4?br=115200
serial:/dev/ttyACM0?br=115200

TCP uses separate schemes for client and server ports:

  • tcp://host:port creates a TCP client port that connects to a remote endpoint.
  • tcps://host:port creates a TCP server port that listens for incoming clients.

Register the GNSS device factory:

var explorer = DeviceExplorer.Create(router, builder =>
{
    builder.Factories.RegisterGnssDevice();
});

UBX Helper API

The UBX microservice provides helper methods for u-blox devices:

await ubx.GetMonVer(cancel);
await ubx.GetNavPvt(cancel);
await ubx.SetSurveyInMode(minDuration: 60, positionAccuracyLimit: 2, cancel: cancel);
await ubx.SetupRtcmMSM4Rate(msgRate: 1, cancel: cancel);
await ubx.TurnOffNmea(cancel);
await ubx.RebootReceiver(cancel);

Console Tools

The Asv.Gnss.Shell project contains diagnostic commands.

Read an RTCM v3 stream:

dotnet run --project src/Asv.Gnss.Shell -- rtcm --cs "tcp://172.16.0.1:30"

Use tcps://0.0.0.0:7341 when the shell should listen for incoming TCP clients instead of connecting as a TCP client.

Parse an ASTERIX stream file:

dotnet run --project src/Asv.Gnss.Shell -- asterix-stream --file "path/to/input.stream"

Export CAT021 tracks from an ASTERIX stream to KML:

dotnet run --project src/Asv.Gnss.Shell -- asterix-stream --file "path/to/input.stream" --kml "tracks.kml" --min-track-points 2

The nmea command exists in the codebase, but it is currently not registered in Program.cs.

Build and Test

Restore dependencies:

dotnet restore src/Asv.Gnss.sln

Build the solution:

dotnet build src/Asv.Gnss.sln

Run tests:

dotnet test src/Asv.Gnss.sln

Build the library NuGet package:

dotnet pack src/Asv.Gnss/Asv.Gnss.csproj -c Release

On Windows, you can use the root build script:

build.bat

The script reads the version from git describe --tags, applies it with dotnet-setversion, builds the projects, and runs dotnet pack.

Repository Structure

asv-gnss/
  README.md
  LICENSE
  build.bat
  publish_nuget.bat
  src/
    Asv.Gnss.sln
    Directory.Build.props
    Asv.Gnss/
      Devices/
      Microservices/
      Parsers/
      Protocols/
    Asv.Gnss.Shell/
    Asv.Gnss.Test/

Main projects:

  • Asv.Gnss - protocol, message, parser, GNSS device factory, and microservice library.
  • Asv.Gnss.Shell - console commands for working with data streams and ASTERIX stream files.
  • Asv.Gnss.Test - xUnit v3 protocol tests and binary RTCM/ASTERIX test resources.

Product version, target framework, and shared dependency versions are defined in src/Directory.Build.props.

Publishing

The publish_nuget.bat script publishes the Asv.Gnss package to NuGet.org and GitHub Packages:

publish_nuget.bat

Before publishing, build a Release package whose version matches git describe --tags.

License

This project is licensed under the MIT License. See LICENSE.

Links

About

GNSS library for parsing RTCMv2, RTCMv3, NMEA and control recievers througt SBF, ComNav, UBX protocols for .NET

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages