rtkutils

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package rtkutils implements necessary functions to set and return NTRIP information here.

Package rtkutils implements functions that are used in the gpsrtkserial and gpsrtkpmtk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToVirtualBase added in v0.16.0

func ConnectToVirtualBase(ntripInfo *NtripInfo,
	logger logging.Logger,
) *bufio.ReadWriter

ConnectToVirtualBase is responsible for establishing a connection to a virtual base station using the NTRIP protocol.

func ContainsGGAMessage added in v0.16.0

func ContainsGGAMessage(data []byte) bool

ContainsGGAMessage returns true if data contains GGA message.

func FindLineWithMountPoint added in v0.16.0

func FindLineWithMountPoint(sourceTable *Sourcetable, mountPoint string) (bool, error)

FindLineWithMountPoint parses the given source-table returns the NMEA field associated with the given mountpoint.

func GetGGAMessage added in v0.16.0

func GetGGAMessage(correctionWriter io.ReadWriteCloser, logger logging.Logger) ([]byte, error)

GetGGAMessage checks if a GGA message exists in the buffer and returns it.

Types

type GPSData added in v0.22.0

type GPSData struct {
	Location   *geo.Point
	Alt        float64
	Speed      float64 // ground speed in m per sec
	VDOP       float64 // vertical accuracy
	HDOP       float64 // horizontal accuracy
	SatsInView int     // quantity satellites in view
	SatsInUse  int     // quantity satellites in view

	FixQuality     int
	CompassHeading float64 // true compass heading in degree
	// contains filtered or unexported fields
}

GPSData struct combines various attributes related to GPS.

func (*GPSData) ParseAndUpdate added in v0.22.0

func (g *GPSData) ParseAndUpdate(line string) error

ParseAndUpdate will attempt to parse a line to an NMEA sentence, and if valid, will try to update the given struct with the values for that line. Nothing will be updated if there is not a valid gps fix.

type NtripConfig

type NtripConfig struct {
	NtripURL             string `json:"ntrip_url"`
	NtripConnectAttempts int    `json:"ntrip_connect_attempts,omitempty"`
	NtripMountpoint      string `json:"ntrip_mountpoint,omitempty"`
	NtripUser            string `json:"ntrip_username,omitempty"`
	NtripPass            string `json:"ntrip_password,omitempty"`
}

NtripConfig is used for converting attributes for a correction source.

type NtripInfo

type NtripInfo struct {
	URL string

	MountPoint         string
	Client             *ntrip.Client
	Stream             io.ReadCloser
	MaxConnectAttempts int
	// contains filtered or unexported fields
}

NtripInfo contains the information necessary to connect to a mountpoint.

func NewNtripInfo

func NewNtripInfo(cfg *NtripConfig, logger logging.Logger) (*NtripInfo, error)

NewNtripInfo function validates and sets NtripConfig arributes and returns NtripInfo.

func (*NtripInfo) Connect added in v0.21.0

func (n *NtripInfo) Connect(ctx context.Context, logger logging.Logger) error

Connect attempts to initialize a new ntrip client. If we're unable to connect after multiple attempts, we return the last error.

func (*NtripInfo) ParseSourcetable added in v0.20.0

func (n *NtripInfo) ParseSourcetable(logger logging.Logger) (*Sourcetable, error)

ParseSourcetable gets the sourcetable and parses it.

type Sourcetable added in v0.20.0

type Sourcetable struct {
	Streams []Stream
}

Sourcetable struct contains the stream.

func (*Sourcetable) HasStream added in v0.20.0

func (st *Sourcetable) HasStream(mountpoint string) (Stream, bool)

HasStream checks if the sourcetable contains the given mountpoint in it's stream.

type Stream added in v0.20.0

type Stream struct {
	MP             string   // Datastream mountpoint
	Identifier     string   // Source identifier (most time nearest city)
	Format         string   // Data format of generic type (https://software.rtcm-ntrip.org/wiki/STR#DataFormats)
	FormatDetails  string   // Specifics of data format (https://software.rtcm-ntrip.org/wiki/STR#DataFormats)
	Carrier        int      // Phase information about GNSS correction (https://software.rtcm-ntrip.org/wiki/STR#Carrier)
	NavSystem      []string // Multiple navigation system (https://software.rtcm-ntrip.org/wiki/STR#NavigationSystem)
	Network        string   // Network record in sourcetable (https://software.rtcm-ntrip.org/wiki/NET)
	Country        string   // ISO 3166 country code (https://en.wikipedia.org/wiki/ISO_3166-1)
	Latitude       float32  // Position, Latitude in degree
	Longitude      float32  // Position, Longitude in degree
	Nmea           bool     // Caster requires NMEA input (1) or not (0)
	Solution       int      // Generated by single base (0) or network (1)
	Generator      string   // Generating soft- or hardware
	Compression    string   // Compression algorithm
	Authentication string   // Access protection for data streams None (N), Basic (B) or Digest (D)
	Fee            bool     // User fee for data access: yes (Y) or no (N)
	BitRate        int      // Datarate in bits per second
	Misc           string   // Miscellaneous information
}

Stream contrains a stream record in sourcetable. https://software.rtcm-ntrip.org/wiki/STR

Jump to

Keyboard shortcuts

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