NMEAParser
Documentation for NMEAParser.
NMEAParser.DTM
NMEAParser.GBS
NMEAParser.GGA
NMEAParser.GLL
NMEAParser.GSA
NMEAParser.GSV
NMEAParser.NMEAData
NMEAParser.PASHR
NMEAParser.RMC
NMEAParser.SVData
NMEAParser.TWPOS
NMEAParser.VTG
NMEAParser.ZDA
Base.parse
Base.pop!
NMEAParser._dms_to_dd
NMEAParser._hms_to_secs
NMEAParser.get_system
NMEAParser.is_string_supported
NMEAParser.parse_msg!
NMEAParser.pos_convert
NMEAParser.update
NMEAParser.update!
NMEAParser.vel_convert
NMEAParser.DTM
— TypeDTM <: NMEAString
A type that represents a Datum reference (DTM) message, which is one of the types of NMEA messages. NMEA stands for National Marine Electronics Association, and it is a standard protocol for communication between marine electronic devices. A DTM message identifies the local geodetic datum and datum offsets from a reference datum. This sentence is used to define the datum to which a position location, and geographic locations in subsequent sentences, is referenced[^1^][1].
Fields
system::String
: The system identifier, indicating the source of the message (e.g. "GPS", "GLONASS", "UNKNOWN").local_datum_code::String
: The local datum code (CCC), which can be one of the following values[^1^][1]:- W84 – WGS-84
- W72 – WGS-72
- S85 – SGS85
- P90 – PE90
- 999 – User-defined IHO datum code
local_datum_subcode::String
: The local datum subdivision code (x).lat_offset::Float64
: The latitude offset, in minutes (x.x). A negative value indicates south and a positive value indicates north.long_offset::Float64
: The longitude offset, in minutes (x.x). A negative value indicates west and a positive value indicates east.alt_offset::Float64
: The altitude offset, in meters (x.x).ref_datum::String
: The reference datum code (CCC), which can be one of the following values[^1^][1]:- W84 – WGS-84
- W72 – WGS-72
- S85 – SGS85
- P90 – PE90
- 999 – User-defined IHO datum code
valid::Bool
: A flag indicating whether the message is valid or not.
Constructor
The constructor takes an array of strings as an argument, which are the items of a DTM sentence. It also takes an optional keyword argument system
, which specifies the system identifier. If not given, it defaults to "UNKNOWN". Another optional keyword argument is valid
, which specifies whether the message is valid or not. If not given, it defaults to true.
Example
$GPDTM,W84,,0.000000,N,0.000000,E,0.0,W84*6F
NMEAParser.GBS
— TypeGBS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true)
A struct that represents a GBS NMEA string, which is a message that contains the error estimates of the position fix from a global navigation satellite system (GNSS).
Fields
system::String
: The name of the system that produced the message.time::Float64
: The time of the message in seconds since midnight UTC.lat_error::Float64
: The expected error in latitude in meters.long_error::Float64
: The expected error in longitude in meters.alt_error::Float64
: The expected error in altitude in meters.failed_PRN::Int
: The pseudo-random noise (PRN) number of the satellite that has failed or is likely to fail.prob_of_missed::Float64
: The probability of missed detection for the failed satellite.excluded_meas_err::Float64
: The estimated error caused by excluding the measurement from the failed satellite.standard_deviation::Float64
: The standard deviation of the residual errors for all satellites used in the position fix.valid::Bool
: A flag that indicates whether the message is valid or not.
Constructor
The constructor takes an array of strings as an argument, which are the items in the GBS NMEA string. It also takes optional keyword arguments for the system name and the validity flag. It parses the items and assigns them to the corresponding fields.
NMEAParser.GGA
— TypeGGA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true)
A struct that represents a Global Positioning System Fix Data (GGA) sentence from the NMEA protocol. It contains information about the GPS system, time, location, fix quality, number of satellites, horizontal dilution of precision (HDOP), altitude, geoidal separation, age of differential corrections, and differential reference station ID.
Arguments
items::Array{D}
: An array of strings that contains the fields of the GGA sentence, separated by commas.system::AbstractString
: An optional keyword argument that specifies the type of GPS system used. It can be "GPS", "GLONASS", "GALILEO", or "Combined". The default value is "UNKNOWN".valid::Bool
: An optional keyword argument that indicates whether the GGA sentence is valid or not. The default value is true.
Returns
- A
GGA
object with the following fields:system::String
: The type of GPS system used.time::Float64
: The UTC time of the fix in seconds.latitude::Float64
: The latitude of the position in decimal degrees.longitude::Float64
: The longitude of the position in decimal degrees.fix_quality::String
: The quality of the fix. It can be one of the following values: "INVALID", "GPS (SPS)", "DGPS", "PPS", "REAL TIME KINEMATIC", "FLOAT RTK", "DEAD RECKONING", "MANUAL INPUT", or "SIMULATION".num_sats::Int
: The number of satellites used in the fix.HDOP::Float64
: The horizontal dilution of precision (HDOP) of the fix.altitude::Float64
: The altitude above mean sea level (MSL) in meters.geoidal_seperation::Float64
: The difference between the WGS-84 earth ellipsoid and mean sea level (MSL) in meters.age_of_differential::Float64
: The time since the last SC104 type 1 or 9 update in seconds. A value of 0 means no differential GPS correction is available.diff_reference_id::Int
: The differential reference station ID.valid::Bool
: Whether the GGA sentence is valid or not.
The GGA sentence is one of the most common sentences used with GPS receivers. It contains information about position, elevation, time, number of satellites used, fix type, and correction age. The message ID for the GGA sentence is “GGA”. Here is an example of a GGA sentence:
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
This means that the GPS receiver reported its position as 48 degrees 7.038 minutes north latitude and 11 degrees 31.000 minutes east longitude at 12:35:19 UTC on the current date. The fix type was GPS (SPS), with 8 satellites used and a horizontal dilution of precision (HDOP) of 0.9. The altitude above mean sea level (MSL) was 545.4 meters, and the geoidal separation was 46.9 meters
NMEAParser.GLL
— TypeGLL <: NMEAString
A struct for handling NMEA message data of type GLL, which contains geographic position and time information.
Fields
system::String
: the name of the GNSS system that produced the data (e.g. "GPS", "GLONASS", etc.)latitude::Float64
: the latitude of the position in decimal degreeslongitude::Float64
: the longitude of the position in decimal degreestime::Float64
: the UTC time of the position in secondsstatus::Bool
: whether the position is valid (true
) or not (false
)mode::Char
: the mode indicator of the position fix (e.g. 'A' for autonomous, 'D' for differential, etc.)valid::Bool
: whether the message data is valid (true
) or not (false
)
Constructor
The constructor takes an array of strings as an argument, which should contain the fields of the GLL message in order, separated by commas. Optionally, a keyword argument system
can be given to specify the GNSS system name, and a keyword argument valid
can be given to indicate the validity of the message data. If not given, these arguments default to "UNKNOWN" and true
, respectively.
The GLL message contains the latitude, longitude, time, and status of the position fix obtained by the receiver. The status indicates whether the position is valid or not, and the mode indicates whether the position is obtained autonomously, differentially, or by other means. The GLL message is useful for applications that need to know the exact location and time of the receiver.
NMEAParser.GSA
— TypeGSA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true)
A struct that represents a GNSS DOP and Active Satellites (GSA) sentence from the NMEA protocol. It contains information about the GPS system, mode, current mode, satellite IDs, position dilution of precision (PDOP), horizontal dilution of precision (HDOP), and vertical dilution of precision (VDOP).
Arguments
items::Array{D}
: An array of strings that contains the fields of the GSA sentence, separated by commas.system::AbstractString
: An optional keyword argument that specifies the type of GPS system used.
It can be "GPS", "GLONASS", "GALILEO", or "Combined". The default value is "UNKNOWN".
valid::Bool
: An optional keyword argument that indicates whether the GSA sentence is valid or not. The default value is true.
Returns
- A
GSA
object with the following fields:system::String
: The type of GPS system used.mode::Char
: The mode of operation. It can be 'A' for automatic or 'M' for manual.current_mode::Int
: The current mode of operation. It can be one of the following values: 1 for no fix, 2 for 2D fix, or 3 for 3D fix.sat_ids::Vector{Int}
: A vector of integers that contains the IDs of the satellites used in the fix.PDOP::Float64
: The position dilution of precision (PDOP) of the fix.HDOP::Float64
: The horizontal dilution of precision (HDOP) of the fix.VDOP::Float64
: The vertical dilution of precision (VDOP) of the fix.valid::Bool
: Whether the GSA sentence is valid or not.
The GSA sentence contains information about the GNSS DOP and active satellites. It indicates the mode of operation, the current mode of operation, the satellite IDs used in the fix, and the position dilution of precision (PDOP), horizontal dilution of precision (HDOP), and vertical dilution of precision (VDOP). The message ID for the GSA sentence is “GSA”. Here is an example of a GSA sentence:
$GNGSA,A,3,21,5,29,25,12,10,26,2,,,,,1.2,0.7,1.0*27
This means that the GNSS receiver was in automatic mode and had a 3D fix using satellites with IDs 21, 5, 29, 25, 12, 10, 26, and 2. The PDOP was 1.2, the HDOP was 0.7, and the VDOP was 1.0
NMEAParser.GSV
— TypeGSV <: NMEAString
A struct for handling NMEA message data of type GSV, which contains information about the GNSS satellites in view.
Fields
system::String
: the name of the GNSS system that produced the data (e.g. "GPS", "GLONASS", etc.)msg_total::Int
: the total number of GSV messages in this cyclemsg_num::Int
: the sequence number of this message in this cyclesat_total::Int
: the total number of satellites in viewSV_data::Vector{Int}
: an array of SVData structs, each containing information about one satellite in viewvalid::Bool
: whether the message data is valid (true
) or not (false
)
Constructor
The constructor takes an array of strings as an argument, which should contain the fields of the GSV message in order, separated by commas. Optionally, a keyword argument system
can be given to specify the GNSS system name, and a keyword argument valid
can be given to indicate the validity of the message data. If not given, these arguments default to "UNKNOWN" and true
, respectively.
The GSV message contains information about the satellites that are in view of the receiver, such as their PRN numbers, elevations, azimuths, and signal-to-noise ratios. The PRN number identifies the satellite uniquely within its system, and the elevation and azimuth indicate the direction of the satellite relative to the receiver. The signal-to-noise ratio measures the quality of the signal received from the satellite. The GSV message is useful for applications that need to know the availability and quality of the satellites that can be used for positioning
NMEAParser.NMEAData
— TypeNMEAData()
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 nonelast_RMC::Union{Nothing, RMC}
: the last RMC message parsed, or nothing if nonelast_GSA::Union{Nothing, GSA}
: the last GSA message parsed, or nothing if nonelast_GSV::Union{Nothing, GSV}
: the last GSV message parsed, or nothing if nonelast_GBS::Union{Nothing, GBS}
: the last GBS message parsed, or nothing if nonelast_VTG::Union{Nothing, VTG}
: the last VTG message parsed, or nothing if nonelast_GLL::Union{Nothing, GLL}
: the last GLL message parsed, or nothing if nonelast_ZDA::Union{Nothing, ZDA}
: the last ZDA message parsed, or nothing if nonelast_DTM::Union{Nothing, DTM}
: the last DTM message parsed, or nothing if nonelast_PASHR::Union{Nothing, PASHR}
: the last PASHR message parsed, or nothing if nonelast_TWPOS::Union{Nothing, TWPOS}
: the last TWPOS message parsed, or nothing if none
NMEAParser.PASHR
— TypePASHR(system, time, heading, heading_type, roll, pitch, heave, roll_accuracy,
pitch_accuracy, heading_accuracy, aiding_code, ins_code, valid)
A struct that represents a PASHR NMEA string, which is a message that contains position and attitude data from an inertial navigation system (INS).
Fields
system::String
: The name of the system that produced the message.time::Float64
: The time of the message in seconds since midnight UTC.heading::Float64
: The heading angle in degrees clockwise from north.heading_type::Char
: The type of heading: 'T' for true or 'M' for magnetic.roll::Float64
: The roll angle in degrees. Positive values indicate right roll.pitch::Float64
: The pitch angle in degrees. Positive values indicate nose up.heave::Float64
: The heave displacement in meters. Positive values indicate upward motion.roll_accuracy::Float64
: The standard deviation of the roll angle in degrees.pitch_accuracy::Float64
: The standard deviation of the pitch angle in degrees.heading_accuracy::Float64
: The standard deviation of the heading angle in degrees.aiding_code::Int
: A code that indicates the type of aiding used by the INS.ins_code::Int
: A code that indicates the status of the INS.valid::Bool
: A flag that indicates whether the message is valid or not.
Constructor
The constructor takes an array of strings as an argument, which are the items in the PASHR NMEA string. It also takes optional keyword arguments for the system name and the validity flag. It parses the items and assigns them to the corresponding fields.
Example
$PASHR,154155.50,153.17,T,9.68,2.29,-0.07,0.502,0.502,0.959,1*19
NMEAParser.RMC
— TypeRMC <: NMEAString
A type that represents a Recommended Minimum Navigation Information (RMC) message, which is one of the most common types of NMEA messages. NMEA stands for National Marine Electronics Association, and it is a standard protocol for communication between marine electronic devices. An RMC message provides information about the position, velocity, time, date, and magnetic variation of a GPS receiver.
Fields
system::String
: The system identifier, indicating the source of the message (e.g. "GPS", "GLONASS", "UNKNOWN").time::Float64
: The UTC time of the position fix, in seconds since midnight.status::Bool
: The status indicator, either true for active or false for void (invalid).latitude::Float64
: The latitude of the position, in decimal degrees.longitude::Float64
: The longitude of the position, in decimal degrees.sog::Float64
: The speed over ground, in knots.cog::Float64
: The track angle, in degrees true (not magnetic).day::String
: The day of the position fix, in two digits.month::String
: The month of the position fix, in two digits.year::String
: The year of the position fix, in two digits.magvar::Float64
: The magnetic variation, in degrees. A negative value indicates west and a positive value indicates east.mode::Char
: The mode indicator, indicating the type of fix. It can be one of the following values:- 'A' for autonomous (GPS only)
- 'D' for differential (DGPS)
- 'E' for estimated
- 'F' for float RTK
- 'M' for manual input
- 'N' for no fix
- 'P' for precise
- 'R' for real time kinematic
- 'S' for simulator
valid::Bool
: A flag indicating whether the message is valid or not.
Constructor
The constructor takes an array of strings as an argument, which are the items of an RMC sentence. It also takes an optional keyword argument system
, which specifies the system identifier. If not given, it defaults to "UNKNOWN". Another optional keyword argument is valid
, which specifies whether the message is valid or not. If not given, it defaults to true.
NMEAParser.SVData
— TypeSVData <: NMEAString
A struct for handling NMEA message data of type SVData, which contains information about one satellite in view of a GNSS receiver.
Fields
PRN::Int
: the PRN number of the satellite, which identifies it uniquely within its systemelevation::Int
: the elevation angle of the satellite in degrees, relative to the horizonazimuth::Int
: the azimuth angle of the satellite in degrees, relative to the true northSNR::Int
: the signal-to-noise ratio of the satellite in decibels, which measures the quality of the signal received from the satellite
The SVData struct is used to store and process information about one satellite that is in view of a GNSS receiver. It is usually part of a GSV message, which contains information about all the satellites in view. The SVData struct can be used to determine the availability and quality of the satellites that can be used for positioning.
NMEAParser.TWPOS
— TypeTWPOS(system, time, xpose, ypose, zpose, distance, velocity, valid)
A struct that represents a TWPOS NMEA string, which is a message that contains the position and velocity data from a transponder.
Fields
system::String
: The name of the system that produced the message.time::Float64
: The time of the message in seconds since midnight UTC.xpose::Float64
: The x-coordinate of the position in meters.ypose::Float64
: The y-coordinate of the position in meters.zpose::Float64
: The z-coordinate of the position in meters.distance::Float64
: The distance from the origin in meters.velocity::Float64
: The velocity in meters per second.valid::Bool
: A flag that indicates whether the message is valid or not.
Constructor
The constructor takes an array of strings as an argument, which are the items in the TWPOS NMEA string. It also takes optional keyword arguments for the system name and the validity flag. It parses the items and converts them to the appropriate units and assigns them to the corresponding fields.
NMEAParser.VTG
— TypeVTG <: NMEAString
A type that represents a Track made good and speed over ground (VTG) message, which is one of the types of NMEA messages. NMEA stands for National Marine Electronics Association, and it is a standard protocol for communication between marine electronic devices. A VTG message provides information about the actual track made good and speed over ground of a GPS receiver.
Fields
system::String
: The system identifier, indicating the source of the message (e.g. "GPS", "GLONASS", "UNKNOWN").CoG_true::Float64
: The track made good (degrees true).CoG_mag::Float64
: The track made good (degrees magnetic).SoG_knots::Float64
: The speed over ground, in knots.SoG_kmhr::Float64
: The speed over ground, in kilometers per hour (kph).mode::Char
: The mode indicator, indicating the type of fix. It can be one of the following values:- 'A' for autonomous (GPS only)
- 'D' for differential (DGPS)
- 'E' for estimated (dead reckoning) mode
- 'M' for manual input mode
- 'S' for simulator mode
- 'N' for data not valid
valid::Bool
: A flag indicating whether the message is valid or not.
Constructor
The constructor takes an array of strings as an argument, which are the items of a VTG sentence. It also takes an optional keyword argument system
, which specifies the system identifier. If not given, it defaults to "UNKNOWN". Another optional keyword argument is valid
, which specifies whether the message is valid or not. If not given, it defaults to true.
Example
A message has the following format: $GPVTG,x.x,T,x.x,M,x.x,N,x.x,K,m*hh
For example, the following VTG message:
$GPVTG,140.88,T,M,8.04,N,14.89,K,D*05
Means that:
- The track made good is 140.88 degrees true.
- The track made good is not available in degrees magnetic.
- The speed over ground is 8.04 knots.
- The speed over ground is 14.89 kph.
- The mode indicator is differential (DGPS).
- The checksum data is 05.
NMEAParser.ZDA
— TypeZDA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true)
A struct that represents a Time and Date (ZDA) sentence from the NMEA protocol. It contains information about the GPS system, time, date, and local time zone.
Arguments
items::Array{D}
: An array of strings that contains the fields of the ZDA sentence, separated by commas.system::AbstractString
: An optional keyword argument that specifies the type of GPS system used. It can be "GPS", "GLONASS", "GALILEO", or "Combined". The default value is "UNKNOWN".valid::Bool
: An optional keyword argument that indicates whether the ZDA sentence is valid or not. The default value is true.
Returns
- A
ZDA
object with the following fields:system::String
: The type of GPS system used.time::Float64
: The UTC time of the fix in seconds.day::Int
: The day of the month (1-31).month::Int
: The month of the year (1-12).year::Int
: The year (four digits).zone_hrs::Int
: The local time zone offset from UTC in hours.zone_mins::Int
: The local time zone offset from UTC in minutes.valid::Bool
: Whether the ZDA sentence is valid or not.
An example of a ZDA sentence is:
$GPZDA,201530.00,04,07,2002,00,00*60
This means that the GPS system reported the date and time as 20:15:30.00 UTC on July 4th, 2002, with no local time zone offset1.
The purpose of the ZDA sentence is to provide a reliable and accurate source of date and time information for applications that require synchronization or logging. For example, some scientific instruments or sensors may need to record the exact time of their measurements or events. The ZDA sentence can also be used to adjust the internal clock of the receiver or other devices
Base.parse
— Methodparse(nmea_string::AbstractString)
A function that parses a NMEA string, which is a standard format for data transmission from marine and navigation devices.
Arguments
nmea_string::AbstractString
: The NMEA string to be parsed.
Returns
A struct that represents the type and content of the NMEA string, such as DTM, GBS, GGA, GLL, GSA, GSV, RMC, VTG, ZDA, PASHR, or TWPOS. The struct has fields that correspond to the items in the NMEA string.
Errors
Throws an ArgumentError
if the NMEA string is not supported or has an invalid format.
Algorithm
The function splits the NMEA string by the '*' character and checks the checksum of the message. It then splits the message by the ',' character and extracts the header and the items. It determines the system name from the header and calls the appropriate constructor for the corresponding struct type. If no matching struct type is found, it throws an ArgumentError
.
Base.pop!
— Methodpop!(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_dd
— Method_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 secondshemi
: 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_secs
— Method_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_system
— Methodget_system(mtype::SubString)
Determine the system type based on the input mtype
.
Arguments
mtype
: ASubString
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_supported
— Methodis_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.parse_msg!
— Methodparse_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_convert
— Methodpos_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!
— Methodupdate!(s::NMEAData, msg)
Update the corresponding field of s
with the given NMEA message msg
.
Arguments
s::NMEAData
: the NMEA data struct to be updatedmsg
: an NMEA message of type GGA, RMC, GSA, GSV, GBS, VTG, GLL, ZDA, DTM, PASHR or TWPOS
NMEAParser.update
— Methodupdate(s::NMEAData, msg::T) 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_convert
— Methodvel_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. For example, if the flag is 'N', it multiplies the value by 1.94384449244 to get the equivalent value in meters per second.