QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GPSProtocolMath Namespace Reference

Unit conversions and geodesy shared by receiver families and their callers. More...

Classes

struct  Ecef

Functions

Ecef toEcef (const GPSEllipsoidPosition &position)
GPSEllipsoidPosition fromEcef (const Ecef &position)
bool nearEarthSurface (const Ecef &position)
uint64_t utcMicroseconds (int year, int month, int day, int hour, int minute, int second, int32_t nsec)
constexpr double degreesFromE7 (int32_t value)
 Degrees of a coordinate in 1e-7 degree units, as u-blox and MAVLink send them.
constexpr double metersFromMillimeters (int32_t value)
double roundedToMillimeters (double meters)
 meters rounded to whole millimetres.
std::optional< uint32_t > tenthMillimeters (double meters)
 meters in 0.1 mm, truncated toward zero. Empty when not finite, negative or beyond a 32-bit unsigned field.
double distance (const Ecef &left, const Ecef &right)
 Straight-line distance between left and right, in metres.

Variables

constexpr double DEG_TO_RAD = std::numbers::pi / 180.0
constexpr double RAD_TO_DEG = 180.0 / std::numbers::pi
constexpr time_t UTC_PLAUSIBILITY_FLOOR_SECS = static_cast<time_t>(1234567890ULL)
 Receiver dates before this instant (2009-02-13) are implausible and reported as unknown.

Detailed Description

Unit conversions and geodesy shared by receiver families and their callers.

Function Documentation

◆ degreesFromE7()

double GPSProtocolMath::degreesFromE7 ( int32_t value)
nodiscardconstexpr

Degrees of a coordinate in 1e-7 degree units, as u-blox and MAVLink send them.

Definition at line 23 of file GPSProtocolMath.h.

Referenced by UBX::coordinateDegrees(), and NTRIPVehicleGgaSource::setVehicle().

◆ distance()

double GPSProtocolMath::distance ( const Ecef & left,
const Ecef & right )
inlinenodiscard

Straight-line distance between left and right, in metres.

Definition at line 60 of file GPSProtocolMath.h.

References GPSProtocolMath::Ecef::x, GPSProtocolMath::Ecef::y, and GPSProtocolMath::Ecef::z.

◆ fromEcef()

GPSEllipsoidPosition GPSProtocolMath::fromEcef ( const Ecef & position)
nodiscard

◆ metersFromMillimeters()

double GPSProtocolMath::metersFromMillimeters ( int32_t value)
nodiscardconstexpr

Definition at line 28 of file GPSProtocolMath.h.

Referenced by NTRIPVehicleGgaSource::setVehicle().

◆ nearEarthSurface()

bool GPSProtocolMath::nearEarthSurface ( const Ecef & position)
nodiscard

Whether position lies 6000 to 7000 km from the Earth's centre, as a receiver's coordinates do; false for the zero or unknown coordinates of an unset base.

Definition at line 32 of file GPSProtocolMath.cc.

◆ roundedToMillimeters()

double GPSProtocolMath::roundedToMillimeters ( double meters)
inlinenodiscard

meters rounded to whole millimetres.

Definition at line 34 of file GPSProtocolMath.h.

◆ tenthMillimeters()

std::optional< uint32_t > GPSProtocolMath::tenthMillimeters ( double meters)
inlinenodiscard

meters in 0.1 mm, truncated toward zero. Empty when not finite, negative or beyond a 32-bit unsigned field.

Definition at line 40 of file GPSProtocolMath.h.

Referenced by gpsValidateBaseStationConfig().

◆ toEcef()

Ecef GPSProtocolMath::toEcef ( const GPSEllipsoidPosition & position)
nodiscard

◆ utcMicroseconds()

uint64_t GPSProtocolMath::utcMicroseconds ( int year,
int month,
int day,
int hour,
int minute,
int second,
int32_t nsec )
nodiscard

Microseconds since the Unix epoch of a receiver's UTC calendar fields plus nsec, which may be negative. Fields beyond their range carry into the next larger unit, as a leap second's 60 does. 0 when the date is implausible or beyond the platform's time_t.

Definition at line 38 of file GPSProtocolMath.cc.

References UTC_PLAUSIBILITY_FLOOR_SECS.

Variable Documentation

◆ DEG_TO_RAD

double GPSProtocolMath::DEG_TO_RAD = std::numbers::pi / 180.0
inlineconstexpr

Definition at line 17 of file GPSProtocolMath.h.

◆ RAD_TO_DEG

double GPSProtocolMath::RAD_TO_DEG = 180.0 / std::numbers::pi
inlineconstexpr

Definition at line 18 of file GPSProtocolMath.h.

◆ UTC_PLAUSIBILITY_FLOOR_SECS

time_t GPSProtocolMath::UTC_PLAUSIBILITY_FLOOR_SECS = static_cast<time_t>(1234567890ULL)
inlineconstexpr

Receiver dates before this instant (2009-02-13) are implausible and reported as unknown.

Definition at line 20 of file GPSProtocolMath.h.

Referenced by utcMicroseconds().