Skip to content

NMEANode

This module contains NMEANode, an extension ROS node that publishes mock GPS (GNSS) messages as NMEA sentences to ROS

Classes:

NMEANode(*args, **kwargs)Publishes mock GPS messages to FCU over NMEA protocol via a serial port

class gisnav.extensions.nmea_node.NMEANode(*args, **kwargs)

Bases: MockGPSNode

Publishes mock GPS messages to FCU over NMEA protocol via a serial port

Class initializer

  • Parameters:
    • args – Positional arguments to parent Node constructor
    • kwargs – Keyword arguments to parent Node constructor

Methods:

GGA(header, time_str, lat_nmea, lat_dir, ...)Returns an NMEA GPGGA sentence
GSA(header, pdop, hdop, vdop)Returns an NMEA GPGSA sentence
GST(header, time_str, rms_deviation, ...)Returns an NMEA GPGST sentence.
GSV(header)Returns NMEA GPGSV sentences for 12 statically defined dummy satellites.
HDT(header, yaw_deg)Returns an NMEA GPHDT sentence
RMC(header, time_str, status, lat_nmea, ...)Returns an NMEA GPRMC sentence.
VTG(header, cog_degrees, ground_speed_knots)Returns an NMEA GPVTG sentence
ZDA(header[, time_zone_hour_offset, ...])
compute_rmc_parameters(timestamp, lat, lon, ...)Calculates RMC parameters based on odometry data.
format_date_from_timestamp(timestamp)Helper function to convert a POSIX timestamp to a date string in YYMMDD format.
format_time_from_timestamp(timestamp)Helper function to convert a POSIX timestamp to a time string in hhmmss.SSS format, where SSS is milliseconds.
publish_nmea_sentences(lat, lon, ...)Outgoing NMEA mock GPS sentences

Attributes:

ROS_D_DEM_VERTICAL_DATUMDefault for dem_vertical_datum

GGA(header, time_str: str, lat_nmea: str, lat_dir: str, lon_nmea: str, lon_dir: str, altitude_amsl: float, hdop: float)

Returns an NMEA GPGGA sentence

  • Parameters:
    • time_str – UTC time in HHMMSS format.
    • lat_nmea – Latitude in decimal degrees.
    • lat_dir – Latitude hemisphere (N for North, S for South).
    • lon_nmea – Longitude in decimal degrees.
    • lon_dir – Longitude hemisphere (E for East, W for West).
    • altitude_amsl – Altitude above mean sea level in meters.
    • hdop – Horizontal dilution of precision.
  • Returns: A formatted NMEA GGA sentence as a string.

GSA(header, pdop: float, hdop: float, vdop: float)

Returns an NMEA GPGSA sentence

  • Parameters:
    • pdop – Positional dilution of precision.
    • hdop – Horizontal dilution of precision.
    • vdop – Vertical dilution of precision.
  • Returns: A formatted NMEA GSA sentence as a string.

GST(header, time_str: str, rms_deviation: float, std_dev_major_axis: float, std_dev_minor_axis: float, orientation_major_axis: float, std_dev_latitude: float, std_dev_longitude: float, std_dev_altitude: float)

Returns an NMEA GPGST sentence.

  • Parameters:
    • time_str – UTC time in hhmmss format.
    • rms_deviation – RMS deviation of the pseudorange.
    • std_dev_major_axis – Standard deviation of the semi-major axis.
    • std_dev_minor_axis – Standard deviation of the semi-minor axis.
    • orientation_major_axis – Orientation of the semi-major axis.
    • std_dev_latitude – Standard deviation of latitude error.
    • std_dev_longitude – Standard deviation of longitude error.
    • std_dev_altitude – Standard deviation of altitude error.
  • Returns: A formatted NMEA GST sentence as a string.

GSV(header)

Returns NMEA GPGSV sentences for 12 statically defined dummy satellites.

  • Returns: A formatted NMEA GSV sentences as a string.

HDT(header, yaw_deg: float)

Returns an NMEA GPHDT sentence

  • Parameters:yaw_deg – Vehicle heading in degrees. Heading increases “clockwise” so that north is 0 degrees and east is 90 degrees.
  • Returns: A formatted NMEA HDT sentence as a string.

RMC(header, time_str: str, status: str, lat_nmea: str, lat_dir: str, lon_nmea: str, lon_dir: str, speed_knots: float, course_degrees: float, date_str: str, magnetic_variation: float = 0, var_dir: str = 'E')

Returns an NMEA GPRMC sentence.

  • Parameters:
    • time_str – UTC time in hhmmss format.
    • status – Status, ‘A’ for active or ‘V’ for void.
    • lat_nmea – Latitude in NMEA format.
    • lat_dir – Latitude hemisphere (N for North, S for South).
    • lon_nmea – Longitude in NMEA format.
    • lon_dir – Longitude hemisphere (E for East, W for West).
    • speed_knots – Speed over ground in knots.
    • course_degrees – Course over ground in degrees.
    • date_str – Date in ddmmyy format.
    • magnetic_variation – Magnetic variation in degrees (optional).
    • var_dir – Direction of magnetic variation, ‘E’ or ‘W’ (optional).
  • Returns: A formatted NMEA RMC sentence as a string.

ROS_D_DEM_VERTICAL_DATUM = 5703

Default for dem_vertical_datum

VTG(header, cog_degrees: float, ground_speed_knots: float)

Returns an NMEA GPVTG sentence

  • Parameters:
    • cog_degrees – Course over ground in degrees.
    • ground_speed_knots – Speed over ground in knots.
  • Returns: A formatted NMEA VTG sentence as a string.

ZDA(header, time_zone_hour_offset: int = 0, time_zone_minute_offset: int = 0)

compute_rmc_parameters(timestamp, lat, lon, ground_speed_knots, cog)

Calculates RMC parameters based on odometry data.

  • Returns: A tuple with formatted time, status, latitude, latitude direction, longitude, longitude direction, speed, course, and date.

format_date_from_timestamp(timestamp: int)

Helper function to convert a POSIX timestamp to a date string in YYMMDD format.

  • Parameters:timestamp – Timestamp in microseconds

format_time_from_timestamp(timestamp: int)

Helper function to convert a POSIX timestamp to a time string in hhmmss.SSS format, where SSS is milliseconds.

  • Parameters:timestamp – Timestamp in microseconds

publish_nmea_sentences(lat: float, lon: float, altitude_amsl: float, timestamp: int, vel_n_m_s: float, vel_e_m_s: float, yaw_degrees: int, cog: float, rms: float, eph: float, sd_x: float, sd_y: float, sd_z: float, **kwargs)

Outgoing NMEA mock GPS sentences

Published sentences:

  • GGA (position fix)
  • GSA (position fix)
  • HDT (heading)
  • GST (standard deviations)
  • VTG (velocities, disabled)
  • RMC (velocities, disabled)

GISNav v0.68.1-2-gf2c72641

Released under the MIT License.