QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GPSReceiverConfig.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <cstdint>
5#include <limits>
6#include <variant>
7
8#include <QtCore/QString>
9
10#include "GPSType.h"
11
14{
15 double latitudeDegrees = std::numeric_limits<double>::quiet_NaN();
16 double longitudeDegrees = std::numeric_limits<double>::quiet_NaN();
17 double altitudeMeters = std::numeric_limits<double>::quiet_NaN();
18
19 bool operator==(const GPSEllipsoidPosition&) const = default;
20};
21
24{
25 struct SurveyIn
26 {
27 double accuracyMeters = 0.0;
28 std::chrono::seconds duration{0};
29 bool operator==(const SurveyIn&) const = default;
30 };
31
32 struct Fixed
33 {
35 float accuracyMeters = 0.0f;
36 bool operator==(const Fixed&) const = default;
37 };
38
40 {
42 std::chrono::seconds maximumDuration{60};
43 bool operator==(const ReceiverAveraging&) const = default;
44 };
45
46 using Mode = std::variant<SurveyIn, Fixed, ReceiverAveraging>;
49 bool compactObservations = false;
50
51 bool operator==(const GPSBaseStationConfig&) const = default;
52};
53
64
77
80[[nodiscard]] constexpr bool gpsValidBaudRate(uint32_t baudRate, bool passive)
81{
82 return baudRate == 0 ? !passive : baudRate >= 1200 && baudRate <= 4000000;
83}
84
87
90
94[[nodiscard]] QString gpsReceiverConfigError(GPSType type, const GPSReceiverConfig& config);
95
101 bool* compactFallback = nullptr);
102
105[[nodiscard]] QString gpsDetectedReceiverConfigError(GPSType detected, const GPSReceiverConfig& config);
GPSReceiverConfig gpsReceiverConfigForDetected(GPSType detected, GPSReceiverConfig config, bool *compactFallback=nullptr)
GPSReceiverConfigError
GPSReceiverConfigError gpsValidateBaseStationConfig(const GPSBaseStationConfig &config)
Check the selected base mode against the existing receiver wire-unit limits.
constexpr bool gpsValidBaudRate(uint32_t baudRate, bool passive)
GPSReceiverConfigError gpsValidateReceiverConfig(GPSType type, const GPSReceiverConfig &config)
Precedence: recognized receiver, persistent permission, base mode, baud rate.
QString gpsDetectedReceiverConfigError(GPSType detected, const GPSReceiverConfig &config)
QString gpsReceiverConfigErrorText(GPSReceiverConfigError error)
Translated diagnostic; empty for GPSReceiverConfigError::None.
QString gpsReceiverConfigError(GPSType type, const GPSReceiverConfig &config)
An empty diagnostic means the receiver supports the role and all supplied settings.
Config config
Error error
bool operator==(const Fixed &) const =default
GPSEllipsoidPosition position
bool operator==(const ReceiverAveraging &) const =default
std::chrono::seconds maximumDuration
Maximum receiver-managed time, not a minimum duration or an accuracy guarantee.
bool operator==(const SurveyIn &) const =default
Configuration used only by the RTK base-station role.
bool operator==(const GPSBaseStationConfig &) const =default
std::variant< SurveyIn, Fixed, ReceiverAveraging > Mode
bool compactObservations
MSM4 instead of MSM7 observations: about a third less correction bandwidth, without Doppler.
WGS84 geodetic position with ellipsoid height, not mean-sea-level altitude.
bool operator==(const GPSEllipsoidPosition &) const =default
bool allowPersistentChanges
Per-connection consent to persistent receiver settings and the required restart.
GPSBaseStationConfig base
uint32_t baudRate
Zero lets a configurable receiver detect the rate; passive serial input requires an explicit rate.