Functions | Variables
libnmea_navsat_driver.parser Namespace Reference

Functions

def convert_deg_to_rads (degs)
 
def convert_knots_to_mps (knots)
 
def convert_latitude (field)
 
def convert_longitude (field)
 
def convert_status_flag (status_flag)
 
def convert_time (nmea_utc)
 
def convert_time_rmc (date_str, time_str)
 
def parse_nmea_sentence (nmea_sentence)
 
def safe_float (field)
 
def safe_int (field)
 

Variables

 logger = logging.getLogger('rosout')
 
dictionary parse_maps
 

Function Documentation

◆ convert_deg_to_rads()

def libnmea_navsat_driver.parser.convert_deg_to_rads (   degs)
Convert an angle in degrees to radians.

This wrapper is needed because math.radians doesn't accept non-numeric inputs.

Args:
    degs (float, int, or str): Angle in degrees

Returns:
    The value of safe_float(degs) converted from degrees to radians.

Definition at line 209 of file parser.py.

◆ convert_knots_to_mps()

def libnmea_navsat_driver.parser.convert_knots_to_mps (   knots)
Convert a speed in knots to meters per second.

Args:
    knots (float, int, or str): Speed in knots.

Returns:
    The value of safe_float(knots) converted from knots to meters/second.

Definition at line 197 of file parser.py.

◆ convert_latitude()

def libnmea_navsat_driver.parser.convert_latitude (   field)
Convert a latitude string to floating point decimal degrees.

Args:
    field (str): Latitude string, expected to be formatted as DDMM.MMM, where
        DD is the latitude degrees, and MM.MMM are the minutes latitude.

Returns:
    Floating point latitude in decimal degrees.

Definition at line 75 of file parser.py.

◆ convert_longitude()

def libnmea_navsat_driver.parser.convert_longitude (   field)
Convert a longitude string to floating point decimal degrees.

Args:
    field (str): Longitude string, expected to be formatted as DDDMM.MMM, where
        DDD is the longitude degrees, and MM.MMM are the minutes longitude.

Returns:
    Floating point latitude in decimal degrees.

Definition at line 88 of file parser.py.

◆ convert_status_flag()

def libnmea_navsat_driver.parser.convert_status_flag (   status_flag)
Convert a NMEA RMB/RMC status flag to bool.

Args:
    status_flag (str): NMEA status flag, which should be "A" or "V"

Returns:
    True if the status_flag is "A" for Active.

Definition at line 180 of file parser.py.

◆ convert_time()

def libnmea_navsat_driver.parser.convert_time (   nmea_utc)
Extract time info from a NMEA UTC time string and use it to generate a UNIX epoch time.

Time information (hours, minutes, seconds) is extracted from the given string and augmented
with the date, which is taken from the current system time on the host computer (i.e. UTC now).
The date ambiguity is resolved by adding a day to the current date if the host time is more than
12 hours behind the NMEA time and subtracting a day from the current date if the host time is
more than 12 hours ahead of the NMEA time.

Args:
    nmea_utc (str): NMEA UTC time string to convert. The expected format is HHMMSS.SS where
        HH is the number of hours [0,24), MM is the number of minutes [0,60),
        and SS.SS is the number of seconds [0,60) of the time in UTC.

Returns:
    tuple(int, int): 2-tuple of (unix seconds, nanoseconds) if the sentence contains valid time.
    tuple(float, float): 2-tuple of (NaN, NaN) if the sentence does not contain valid time.

Definition at line 101 of file parser.py.

◆ convert_time_rmc()

def libnmea_navsat_driver.parser.convert_time_rmc (   date_str,
  time_str 
)
Convert a NMEA RMC date string and time string to UNIX epoch time.

Args:
    date_str (str): NMEA UTC date string to convert, formatted as DDMMYY.
    nmea_utc (str): NMEA UTC time string to convert. The expected format is HHMMSS.SS where
        HH is the number of hours [0,24), MM is the number of minutes [0,60),
        and SS.SS is the number of seconds [0,60) of the time in UTC.

Returns:
    tuple(int, int): 2-tuple of (unix seconds, nanoseconds) if the sentence contains valid time.
    tuple(float, float): 2-tuple of (NaN, NaN) if the sentence does not contain valid time.

Definition at line 139 of file parser.py.

◆ parse_nmea_sentence()

def libnmea_navsat_driver.parser.parse_nmea_sentence (   nmea_sentence)
Parse a NMEA sentence string into a dictionary.

Args:
    nmea_sentence (str): A single NMEA sentence of one of the types in parse_maps.

Returns:
    A dict mapping string field names to values for each field in the NMEA sentence or
    False if the sentence could not be parsed.

Definition at line 269 of file parser.py.

◆ safe_float()

def libnmea_navsat_driver.parser.safe_float (   field)
Convert  field to a float.

Args:
    field: The field (usually a str) to convert to float.

Returns:
    The float value represented by field or NaN if float conversion throws a ValueError.

Definition at line 45 of file parser.py.

◆ safe_int()

def libnmea_navsat_driver.parser.safe_int (   field)
Convert  field to an int.

Args:
    field: The field (usually a str) to convert to int.

Returns:
    The int value represented by field or 0 if int conversion throws a ValueError.

Definition at line 60 of file parser.py.

Variable Documentation

◆ logger

libnmea_navsat_driver.parser.logger = logging.getLogger('rosout')

Definition at line 42 of file parser.py.

◆ parse_maps

dictionary libnmea_navsat_driver.parser.parse_maps

Definition at line 223 of file parser.py.



nmea_navsat_driver
Author(s): Eric Perko , Steven Martin
autogenerated on Mon Feb 28 2022 22:57:09