QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QuectelPlan.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <chrono>
5#include <span>
6#include <string_view>
7
8#include <QtCore/QByteArray>
9#include <QtCore/QByteArrayView>
10
11#include "GPSCommand.h"
12#include "GPSProtocolMath.h"
13#include "GPSReceiverConfig.h"
14
23namespace Quectel::Plan {
24
26inline constexpr std::chrono::milliseconds COMMAND_TIMEOUT{1000};
28inline constexpr std::chrono::milliseconds CONFIGURATION_TIMEOUT{45000};
30inline constexpr std::array BAUD_RATES{460800u, 115200u, 230400u, 921600u, 57600u, 9600u};
31
34inline constexpr std::string_view IDENTIFY = "PQTMVERNO";
35inline constexpr std::string_view QUALIFIED_FIRMWARE = "LG290P03";
36
38inline constexpr std::string_view READ_ROLE = "PQTMCFGRCVRMODE,R";
39inline constexpr unsigned BASE_ROLE = 2;
40inline constexpr std::string_view WRITE_BASE_ROLE = "PQTMCFGRCVRMODE,W,2";
41
43inline constexpr std::string_view READ_FIX_RATE = "PQTMCFGFIXRATE,R";
44inline constexpr unsigned FIX_INTERVAL_MS = 1000;
45
48inline constexpr std::string_view READ_BASE = "PQTMCFGSVIN,R";
49inline constexpr std::chrono::hours MAXIMUM_SURVEY_DURATION{24};
50inline constexpr double MAXIMUM_SURVEY_ACCURACY_METERS = 1000;
52inline constexpr std::string_view RESTART_SURVEY = "PQTMCFGSVIN,W";
54inline constexpr std::string_view FIXED_BASE_LABEL = "PQTMCFGSVIN,W (fixed position)";
55inline constexpr std::string_view RESTART_SURVEY_LABEL = "PQTMCFGSVIN,W (survey restart)";
56
58inline constexpr std::string_view SAVE = "PQTMSAVEPAR";
59inline constexpr std::chrono::milliseconds SAVE_TIMEOUT{5000};
60
64inline constexpr std::string_view RESTART = "PQTMSRR";
65inline constexpr std::chrono::milliseconds RESTART_TIMEOUT{8000};
66inline constexpr std::chrono::milliseconds RESTART_POLL{200};
67inline constexpr std::chrono::milliseconds RESTART_IDENTIFY_TIMEOUT{700};
68
70{
71 std::string_view message;
72 unsigned rate = 1;
74 std::string_view version{};
75};
76
78inline constexpr std::array BASE_OUTPUT{
79 MessageRate{.message = "PQTMSVINSTATUS", .version = "1"},
80 MessageRate{.message = "RTCM3-1005"},
81 MessageRate{.message = "RTCM3-107X", .version = "0"},
82};
83
85inline constexpr std::array NMEA_OUTPUT{
86 MessageRate{.message = "GGA"},
87 MessageRate{.message = "GST"},
88 MessageRate{.message = "GSA"},
89 MessageRate{.message = "GSV"},
90};
91
94[[nodiscard]] QByteArray writeBase(const GPSBaseStationConfig::Mode& mode, const GPSProtocolMath::Ecef& position,
95 bool distanceField);
96
98[[nodiscard]] GPSCommandSequence::Command command(QByteArrayView body, GPSTextMatcher reply,
99 std::chrono::milliseconds timeout = COMMAND_TIMEOUT);
100
102[[nodiscard]] GPSTextMatcher acknowledgement(QByteArrayView body);
103
105[[nodiscard]] GPSCommandSequence messageRates(std::span<const MessageRate> rates);
106
107} // namespace Quectel::Plan
std::function< GPSCommandOutcome(std::string_view reply)> GPSTextMatcher
Resolves the outstanding command from one text reply a decoder offers; Pending keeps waiting.
Definition GPSCommand.h:69
GPSCommandSequence::Command command(QByteArrayView body, GPSTextMatcher reply, std::chrono::milliseconds timeout)
body labelled by its text, framed as a sentence, and completed by reply within timeout.
constexpr std::array BASE_OUTPUT
Base output: survey-in status, RTCM3 station coordinates and MSM observations.
Definition QuectelPlan.h:78
GPSTextMatcher acknowledgement(QByteArrayView body)
Completes the setting body with its "<name>,OK" acknowledgement.
constexpr std::string_view IDENTIFY
Definition QuectelPlan.h:34
constexpr std::chrono::milliseconds RESTART_TIMEOUT
Definition QuectelPlan.h:65
QByteArray writeBase(const GPSBaseStationConfig::Mode &mode, const GPSProtocolMath::Ecef &position, bool distanceField)
constexpr std::string_view SAVE
Saves the current settings to flash.
Definition QuectelPlan.h:58
constexpr std::string_view WRITE_BASE_ROLE
Definition QuectelPlan.h:40
constexpr std::string_view QUALIFIED_FIRMWARE
Definition QuectelPlan.h:35
constexpr std::chrono::milliseconds RESTART_POLL
Definition QuectelPlan.h:66
constexpr unsigned BASE_ROLE
Definition QuectelPlan.h:39
constexpr std::string_view RESTART_SURVEY
Re-runs a survey with exactly the fields READ_BASE reported.
Definition QuectelPlan.h:52
constexpr std::string_view RESTART_SURVEY_LABEL
Definition QuectelPlan.h:55
constexpr std::string_view READ_BASE
Definition QuectelPlan.h:48
GPSCommandSequence messageRates(std::span< const MessageRate > rates)
PQTMCFGMSGRATE,W for each of rates, each followed by its PQTMCFGMSGRATE,R readback.
constexpr std::string_view READ_ROLE
Receiver role: "PQTMCFGRCVRMODE,OK,<role>", where 2 is the base station.
Definition QuectelPlan.h:38
constexpr std::chrono::milliseconds SAVE_TIMEOUT
Definition QuectelPlan.h:59
constexpr std::chrono::milliseconds CONFIGURATION_TIMEOUT
For the whole configuration after validation.
Definition QuectelPlan.h:28
constexpr unsigned FIX_INTERVAL_MS
Definition QuectelPlan.h:44
constexpr std::chrono::milliseconds RESTART_IDENTIFY_TIMEOUT
Definition QuectelPlan.h:67
constexpr std::string_view RESTART
Definition QuectelPlan.h:64
constexpr double MAXIMUM_SURVEY_ACCURACY_METERS
Definition QuectelPlan.h:50
constexpr std::array NMEA_OUTPUT
NMEA output: position, position accuracy, satellites used and satellites in view, every second.
Definition QuectelPlan.h:85
constexpr std::string_view FIXED_BASE_LABEL
Labels for the base writes whose bodies carry ECEF coordinates.
Definition QuectelPlan.h:54
constexpr std::array BAUD_RATES
Rates the identity query probes, in order.
Definition QuectelPlan.h:30
constexpr std::chrono::milliseconds COMMAND_TIMEOUT
Per attempt, unless a command gives its own.
Definition QuectelPlan.h:26
constexpr std::chrono::hours MAXIMUM_SURVEY_DURATION
Definition QuectelPlan.h:49
constexpr std::string_view READ_FIX_RATE
Base positioning runs at 1 Hz: "PQTMCFGFIXRATE,OK,1000".
Definition QuectelPlan.h:43
std::variant< SurveyIn, Fixed, ReceiverAveraging > Mode
std::string_view message
Definition QuectelPlan.h:71
std::string_view version
Message version; standard NMEA messages have none.
Definition QuectelPlan.h:74