NMEAParser.DTMType
struct DTM <: NMEAString

Datum Reference (DTM)

This NMEA data type represents information about a datum reference.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • local_datum_code::String: Local datum code.
  • local_datum_subcode::String: Local datum subcode.
  • lat_offset::Float64: Latitude offset in meters.
  • long_offset::Float64: Longitude offset in meters.
  • alt_offset::Float64: Altitude offset in meters.
  • ref_datum::String: Reference datum.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

DTM(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = DTM(["DTM", "W84", "W", "0.5", "W", "1.0", "M", "W84"])
NMEAParser.GBSType
struct GBS <: NMEAString

GNSS Satellite Fault Detection (GBS)

This NMEA data type represents information about satellite fault detection, including error estimates and probabilities.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • lat_error::Float64: Latitude error estimate.
  • long_error::Float64: Longitude error estimate.
  • alt_error::Float64: Altitude error estimate.
  • failed_PRN::Int: PRN of the failed satellite.
  • prob_of_missed::Float64: Probability of missed detection.
  • excluded_meas_err::Float64: Excluded measurement error.
  • standard_deviation::Float64: Standard deviation of the measurements.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

GBS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = GBS(["GBS", "123456", "0.1", "0.2", "0.3", "5", "0.01", "0.05", "0.02"])
NMEAParser.GGAType
struct GGA <: NMEAString

GPS Fix Data (GGA)

This NMEA data type represents information about the GPS fix, including latitude, longitude, altitude, number of satellites, and accuracy measures.

Fields

  • system::String: GPS, GLONASS, GALILEO, or Combined.
  • time::Float64: Time in seconds.
  • latitude::Float64: Latitude in decimal degrees.
  • longitude::Float64: Longitude in decimal degrees.
  • fix_quality::String: Quality of the fix.
  • num_sats::Int: Number of satellites used in the fix.
  • HDOP::Float64: Horizontal Dilution of Precision.
  • altitude::Float64: Altitude above mean sea level (MSL) in meters.
  • geoidal_separation::Float64: Geoidal separation in meters.
  • age_of_differential::Float64: Age of the differential data.
  • diff_reference_id::Int: Differential reference station ID.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

GGA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = GGA(["GGA", "123456", "123.456", "N", "987.654", "W", "1", "8", "0.9", "123.4", "M", "54.3", "M", "1"])
NMEAParser.GLLType
struct GLL <: NMEAString

Geographic Latitude and Longitude (GLL)

This NMEA data type represents information about geographic latitude and longitude.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • latitude::Float64: Latitude in decimal degrees.
  • longitude::Float64: Longitude in decimal degrees.
  • time::Float64: Time in seconds.
  • status::Bool: Status indicator (true if valid fix, false otherwise).
  • mode::Char: Mode indicator ('A' for autonomous mode).
  • valid::Bool: Flag indicating the validity of the data.

Constructor

GLL(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = GLL(["GLL", "12.3456", "N", "98.7654", "W", "123456", "A"])
NMEAParser.GSAType
struct GSA <: NMEAString

GNSS DOP and Active Satellites (GSA)

This NMEA data type represents information about the GNSS Dilution of Precision (DOP) and the active satellites used for navigation.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • mode::Char: Mode of operation (A = Automatic, M = Manual).
  • current_mode::Int: Operating mode (1 = Fix not available, 2 = 2D fix, 3 = 3D fix).
  • sat_ids::Vector{Int}: Vector of satellite IDs used in the fix.
  • PDOP::Float64: Position Dilution of Precision.
  • HDOP::Float64: Horizontal Dilution of Precision.
  • VDOP::Float64: Vertical Dilution of Precision.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

GSA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = GSA(["GSA", "M", "3", "1", "2", "3", "1.2", "0.9", "1.5"])
NMEAParser.GSVType
struct GSV <: NMEAString

Satellites in View (GSV)

This NMEA data type represents information about the satellites in view and their signal strength.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • msg_total::Int: Total number of GSV messages for this cycle.
  • msg_num::Int: Number of this GSV message.
  • sat_total::Int: Total number of satellites in view.
  • SV_data::Vector{SVData}: Vector of satellite data, each containing PRN, elevation, azimuth, and SNR.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

GSV(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = GSV(["GSV", "3", "1", "9", "1", "01", "30", "45", "20", "02", "60", "180", "25", "03", "15", "300", "15"])
NMEAParser.NMEADataType
NMEAData()

A mutable struct that stores the last parsed NMEA messages of different types.

Fields

  • last_GGA::Union{Nothing, GGA}: the last GGA message parsed, or nothing if none
  • last_RMC::Union{Nothing, RMC}: the last RMC message parsed, or nothing if none
  • last_GSA::Union{Nothing, GSA}: the last GSA message parsed, or nothing if none
  • last_GSV::Union{Nothing, GSV}: the last GSV message parsed, or nothing if none
  • last_GBS::Union{Nothing, GBS}: the last GBS message parsed, or nothing if none
  • last_VTG::Union{Nothing, VTG}: the last VTG message parsed, or nothing if none
  • last_GLL::Union{Nothing, GLL}: the last GLL message parsed, or nothing if none
  • last_ZDA::Union{Nothing, ZDA}: the last ZDA message parsed, or nothing if none
  • last_DTM::Union{Nothing, DTM}: the last DTM message parsed, or nothing if none
NMEAParser.PASHRType
struct PASHR <: NMEAString

Inertial Attitude Data (PASHR)

This NMEA data type represents inertial attitude data, including heading, roll, pitch, and heave.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • heading::Float64: Heading in decimal degrees.
  • heading_type::Bool: True heading indicator (true if heading is relative to true north).
  • roll::Float64: Roll in decimal degrees.
  • pitch::Float64: Pitch in decimal degrees.
  • heave::Float64: Heave in meters.
  • roll_accuracy::Float64: Roll accuracy (standard deviation in decimal degrees).
  • pitch_accuracy::Float64: Pitch accuracy (standard deviation in decimal degrees).
  • heading_accuracy::Float64: Heading accuracy (standard deviation in decimal degrees).
  • aiding_code::Int: GPS Update Quality Flag (0 = No position, 1 = Non-RTK fixed, 2 = RTK fixed).
  • ins_code::Int: INS Status Flag (0 = Pre-Alignment, 1 = Post-Alignment).
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PASHR(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PASHR(["PASHR", "123456", "45.0", "T", "15.0", "-10.0", "2.0", "0.1", "0.1", "0.2", "2", "1"])
NMEAParser.PTACCType
struct PTACC <: NMEAString

IMU Accelerometer (PTACC)

This NMEA data type represents inertial measurement unit (IMU) accelerometer information.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • x::Float64: Acceleration in the X-axis.
  • y::Float64: Acceleration in the Y-axis.
  • z::Float64: Acceleration in the Z-axis.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTACC(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTACC(["PTACC", "123456", "0.5", "1.0", "-0.2"])
NMEAParser.PTGYRType
struct PTGYR <: NMEAString

IMU Gyroscope (PTGYR)

This NMEA data type represents inertial measurement unit (IMU) gyroscope information.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • x::Float64: Angular velocity around the X-axis.
  • y::Float64: Angular velocity around the Y-axis.
  • z::Float64: Angular velocity around the Z-axis.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTGYR(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTGYR(["PTGYR", "123456", "0.1", "-0.2", "0.5"])
NMEAParser.PTWHPRType
struct PTWHPR <: NMEAString

IMU Heading Pitch Roll (PTWHPR)

This NMEA data type represents inertial measurement unit (IMU) information, including heading, pitch, and roll.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • heading::Float64: Heading in degrees.
  • pitch::Float64: Pitch in degrees.
  • roll::Float64: Roll in degrees.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTWHPR(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTWHPR(["PTWHPR", "123456", "90.0", "30.0", "-45.0"])
NMEAParser.PTWPLSType
struct PTWPLS <: NMEAString

Position in Pulses (PTWPLS)

This NMEA data type represents position information in pulses.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • x::Float64: X position in pulses.
  • y::Float64: Y position in pulses.
  • heading::Float64: Heading in degrees.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTWPLS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTWPLS(["PTWPLS", "123456", "500", "P", "750", "P", "90.0", "D"])
NMEAParser.PTWPOSType
struct PTWPOS <: NMEAString

Position (PTWPOS)

This NMEA data type represents position information.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • xpose::Float64: X position in meters.
  • ypose::Float64: Y position in meters.
  • zpose::Float64: Z position in meters.
  • distance::Float64: Distance in meters.
  • velocity::Float64: Velocity in kilometers per hour.
  • direction::Char: Direction indicator ('F' for forward, 'B' for backward).
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTWPOS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTWPOS(["PTWPOS", "123456", "45.678", "M", "123.456", "M", "789.012", "M", "456.789", "M", "5.0", "K", "F"])
NMEAParser.PTWVCTType
struct PTWVCT <: NMEAString

Movement Vector (PTWVCT)

This NMEA data type represents movement vector information.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • distance_derivative::Float64: Distance derivative in meters.
  • heading::Float64: Heading in radians.
  • distance::Float64: Distance in meters.
  • speed::Float64: Speed in meters per second.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTWVCT(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTWVCT(["PTWVCT", "123456", "2.0", "M", "1.5708", "R", "5.0", "M"])
NMEAParser.PTWWHEType
struct PTWWHE <: NMEAString

Wheels Information (PTWWHE)

This NMEA data type represents wheels information.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • lw_pulses::Float64: Left wheel pulses.
  • lw_distance::Float64: Left wheel distance in meters.
  • lw_direction::Char: Left wheel direction indicator ('F' for forward, 'B' for backward).
  • rw_pulses::Float64: Right wheel pulses.
  • rw_distance::Float64: Right wheel distance in meters.
  • rw_direction::Char: Right wheel direction indicator ('F' for forward, 'B' for backward).
  • heading::Float64: Heading.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

PTWWHE(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = PTWWHE(["PTWWHE", "123456", "500", "100.0", "M", "F", "750", "150.0", "M", "B", "90.0"])
NMEAParser.RMCType
struct RMC <: NMEAString

Recommended Minimum Navigation Information (RMC)

This NMEA data type represents recommended minimum navigation information.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • status::Bool: Status indicator (true if valid fix, false otherwise).
  • latitude::Float64: Latitude in decimal degrees.
  • longitude::Float64: Longitude in decimal degrees.
  • sog::Float64: Speed over ground in knots.
  • cog::Float64: Course over ground in degrees.
  • day::String: Day of the month.
  • month::String: Month of the year.
  • year::String: Year.
  • magvar::Float64: Magnetic variation.
  • mode::Char: Mode indicator ('A' for autonomous mode).
  • valid::Bool: Flag indicating the validity of the data.

Constructor

RMC(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = RMC(["RMC", "123456", "A", "12.3456", "N", "98.7654", "W", "5.0", "90.0", "150225", "5.0", "W", "A"])
NMEAParser.VTGType
struct VTG <: NMEAString

Track Made Good and Ground Speed (VTG)

This NMEA data type represents information about the track made good (course) and ground speed.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • CoG_true::Float64: Course over ground in true degrees.
  • CoG_mag::Float64: Course over ground in magnetic degrees.
  • SoG_knots::Float64: Speed over ground in knots.
  • SoG_kmhr::Float64: Speed over ground in kilometers per hour.
  • mode::Char: Mode indicator ('A' for autonomous mode).
  • valid::Bool: Flag indicating the validity of the data.

Constructor

VTG(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = VTG(["VTG", "90.0", "T", "45.0", "M", "5.0", "K", "A"])
NMEAParser.ZDAType
struct ZDA <: NMEAString

Time and Date (ZDA)

This NMEA data type represents information about the current time and date from a GNSS receiver.

Fields

  • system::String: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).
  • time::Float64: Time in seconds.
  • day::Int: Day of the month.
  • month::Int: Month of the year.
  • year::Int: Year.
  • zone_hrs::Int: Time zone offset in hours.
  • zone_mins::Int: Time zone offset in minutes.
  • valid::Bool: Flag indicating the validity of the data.

Constructor

ZDA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString

Examples

data = ZDA(["ZDA", "123456", "15", "02", "2024", "5", "30"])
Base.pop!Method
pop!(nmea_data::NMEAData, ::Type{T}) where T <: NMEAString

Pop the last received message of type T from the NMEAData object nmea_data and return it. If no message of type T has been received, throw an UndefVarError. This function extends the Base.pop! function for NMEAData objects.

NMEAParser._dms_to_ddMethod
_dms_to_dd(dms::SubString, hemi::SubString)

Converts a string representing degrees, minutes and seconds (DMS) to decimal degrees.

Arguments

  • dms: a substring representing degrees, minutes and seconds
  • hemi: a substring representing the hemisphere

Returns

  • dec_degrees: the decimal degree representation of the input DMS

Example

dms = "4807.038"
hemi = "N"
dec_degrees = _dms_to_dd(dms, hemi)
NMEAParser._hms_to_secsMethod
_hms_to_secs(hms::SubString)

Converts a string representing hours, minutes and seconds (HMS) to seconds.

Arguments

  • hms: a substring representing hours, minutes and seconds

Returns

  • seconds: the number of seconds represented by the input HMS

Example

hms = "123519"
seconds = _hms_to_secs(hms)
NMEAParser.get_systemMethod
get_system(mtype::SubString)

Determine the system type based on the input mtype.

Arguments

  • mtype: A SubString representing the message type.

Returns

  • A string representing the system type. Possible values are "GPS", "GLONASS", "GALILEO", "COMBINED", and "UNKNOWN".

Examples

get_system("$GPGGA") # "GPS"
get_system("$GLGSV") # "GLONASS"
get_system("$GAGGA") # "GALILEO"
get_system("$GNGNS") # "COMBINED"
get_system("$PMTK")  # "UNKNOWN"

TODO: update get_system to cover all common system types AI = Alarm Indicator, (AIS?) AP = Auto Pilot (pypilot?) BD = BeiDou (China) CD = Digital Selective Calling (DSC) EC = Electronic Chart Display & Information System (ECDIS) GA = Galileo Positioning System GB = BeiDou (China) GI = NavIC, IRNSS (India) GL = GLONASS, according to IEIC 61162-1 GN = Combination of multiple satellite systems (NMEA 1083) GP = Global Positioning System receiver GQ = QZSS regional GPS augmentation system (Japan) HC = Heading/Compass HE = Gyro, north seeking II = Integrated Instrumentation IN = Integrated Navigation LC = Loran-C receiver (obsolete) Pxxx = Proprietary (Vendor specific) PQ = QZSS (Quectel Quirk) QZ = QZSS regional GPS augmentation system (Japan) SD = Depth Sounder ST = Skytraq TI = Turn Indicator YX = Transducer WI = Weather Instrument

NMEAParser.is_string_supportedMethod
is_string_supported(nmea_string::AbstractString)

Check if the input NMEA string type is supported.

Arguments

  • nmea_string::AbstractString: The NMEA string to be checked.

Returns

  • Bool: true if the NMEA string is supported, false otherwise.

Example

julia> is_string_supported("$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47")
true
NMEAParser.nmea_parseMethod
nmea_parse(nmea_string::AbstractString; validate_checksum=true)

Parse an NMEA string and generate the corresponding NMEA type.

This function takes an NMEA sentence as input, validates the checksum if validate_checksum is set to true, and then parses the sentence based on the predefined headers and types in NMEA_TYPES.

Arguments

  • nmea_string::AbstractString: The NMEA sentence to parse.
  • validate_checksum::Bool: Flag to indicate whether to validate the checksum (default is true).

Returns

  • An instance of the appropriate NMEA type.

Examples

result = nmea_parse("$GGA,123456,123.456,N,987.654,W,1,8,0.9,123.4,M,54.3,M,1,")
NMEAParser.parse_msg!Method
parse_msg!(s::NMEAData, line::AbstractString)

Parse a line of NMEA 0183 data and update the state of an NMEAData object.

Arguments

s : NMEAData An object that stores the parsed data from NMEA messages. line : AbstractString A string that contains a valid NMEA 0183 message.

Returns

DataType The type of the parsed message, or Nothing if the message is not supported.

Errors

ArgumentError If the line is not a valid NMEA 0183 message.

Example

s = NMEAData()

julia> d = [ "$GPRMC,154925.820,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7E",
			"$GPGGA,154925.920,5209.732,N,00600.240,E,1,12,1.0,0.0,M,0.0,M,,*63",
			"$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30",
			"$GPRMC,154925.920,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7F"]
4-element Vector{String}:
 "$GPRMC,154925.820,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7E"
 "$GPGGA,154925.920,5209.732,N,00600.240,E,1,12,1.0,0.0,M,0.0,M,,*63"
 "$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30"
 "$GPRMC,154925.920,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7F"

 julia> for str in d
			msg_type = parse_msg!(s, str)
			println(msg_type)
		end
 RMC
 GGA
 GSA
 RMC

 julia> s.last_RMC
 RMC("GPS", 56965.92, true, 52.1622, 6.004, 1.9, 59.8, "04", "01", "23", -0.0, 'A', true)

 julia> s.last_GGA
 GGA("GPS", 56965.92, 52.1622, 6.004, "GPS (SPS)", 12, 1.0, 0.0, 0.0, 0.0, 0, true)
NMEAParser.pos_convertMethod
pos_convert(flag::Char, value::Float64)::Float64

A function that converts a position value from one unit to another.

Arguments

  • flag::Char: The flag that indicates the original unit of the position value. Possible values are 'F' for feet, 'N' for miles, 'K' for kilometers, and 'M' for meters.
  • value::Float64: The position value to be converted.

Returns

A Float64 that represents the position value in meters.

Errors

Throws an exception if the flag is not one of the supported values.

Algorithm

The function uses a simple formula to convert the position value based on the flag. For example, if the flag is 'F', it divides the value by 0.3048 to get the equivalent value in meters.

NMEAParser.update!Method
update!(s::NMEAData, msg)

Update the corresponding field of s with the given NMEA message msg.

Arguments

  • s::NMEAData: the NMEA data struct to be updated
  • msg: an NMEA message of type GGA, RMC, GSA, GSV, GBS, VTG, GLL, ZDA, DTM
NMEAParser.updateMethod
update(msg::T, s::NMEAData) where T <: NMEAString

Update the last received message of type T in the NMEAData object s with the given message msg. Return the updated NMEAData object s.

NMEAParser.vel_convertMethod
vel_convert(flag::Char, value::Float64)::Float64

A function that converts a velocity value from one unit to another.

Arguments

  • flag::Char: The flag that indicates the original unit of the velocity value. Possible values are 'N' for knots, 'K' for kilometers per hour, and 'M' for meters per second.
  • value::Float64: The velocity value to be converted.

Returns

A Float64 that represents the velocity value in meters per second.

Errors

Throws an exception if the flag is not one of the supported values.

Algorithm

The function uses a simple formula to convert the velocity value based on the flag.

NMEAParser.@do_parseMacro
@do_parse(headers, header_str, items, system, valid)

Macro for parsing NMEA sentences based on predefined headers.

This macro generates code to match the given header_str against a list of regular expressions provided in the headers tuple. For each matching header, it generates code to call the corresponding type constructor with the relevant information from the NMEA sentence.

Arguments

  • headers::Tuple: A tuple containing pairs of regular expressions and corresponding NMEA types.
  • header_str::AbstractString: The NMEA sentence header string.
  • items::AbstractString: The NMEA sentence items.
  • system::AbstractString: The system identifier.
  • valid::Bool: A boolean indicating whether the NMEA sentence is valid.

Examples

@do_parse NMEA_TYPES header items system valid