QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
UnicorePlan.cc
Go to the documentation of this file.
2
3namespace Unicore::Plan {
4
5namespace {
6
7QList<Command> role(const Command& baseMode, Reply baseReadback)
8{
9 return {
10 {"UNLOG"}, // all logs off on this port
11 {"MODE ROVER"}, // even when reconnecting to a receiver left in base mode
12 {"MODE", Reply::RoverMode},
13 {"GPGGA 1"}, // position every second
14 {"GPGST 1"}, // position accuracy
15 {"GPGSV 1"}, // satellites in view
16 {"GPGSA 1"}, // satellites used and DOP
17 baseMode,
18 {"MODE", baseReadback},
19 };
20}
21
22QList<Command> output()
23{
24 return {
25 {"BESTNAVXYZA 1"}, // base status every second
26 {"RTCM1005 1"}, // station coordinates
27 {"RTCM1033 10"}, // receiver and antenna descriptors every 10 s
28 {"RTCM1074 1"}, // GPS MSM4
29 {"RTCM1084 1"}, // GLONASS MSM4
30 {"RTCM1094 1"}, // Galileo MSM4
31 {"RTCM1124 1"}, // BeiDou MSM4
32 };
33}
34
35} // namespace
36
38{
39 return {"VERSIONA", Reply::Version};
40}
41
42BaseStation averagingBase(std::chrono::seconds maximum)
43{
44 // Distance 0 forces newly averaged coordinates; it is not an accuracy threshold.
45 const QByteArray mode = "MODE BASE TIME " + QByteArray::number(static_cast<qint64>(maximum.count())) + " 0";
46 return {.role = role({mode}, Reply::AveragingMode), .output = output()};
47}
48
50{
51 const QByteArray mode = "MODE BASE " + gpsFixedDecimal(position.x, 4) + ' ' + gpsFixedDecimal(position.y, 4) + ' ' +
52 gpsFixedDecimal(position.z, 4);
53 // Read back before subscribing, so queued periodic output cannot satisfy the query.
54 QList<Command> commands{{"BESTNAVXYZA", Reply::FixedPosition}};
55 commands += output();
56 return {.role = role({.text = mode, .label = "MODE BASE (fixed position)"}, Reply::FixedMode), .output = commands};
57}
58
59} // namespace Unicore::Plan
QByteArray gpsFixedDecimal(double value, int decimals)
Command identify()
Sent at each candidate rate. Nothing changes before a supported receiver answers.
@ Version
#VERSIONA names a UM980 from R4.10Build7923 or a UM982 from R4.10Build7650 (section 3....
@ RoverMode
#MODE reports MODE ROVER.
@ FixedPosition
#BESTNAVXYZA reports FIXEDPOS at the commanded coordinates.
@ FixedMode
#MODE reports MODE BASE.
@ AveragingMode
#MODE reports MODE BASE TIME.
BaseStation fixedBase(const GPSProtocolMath::Ecef &position)
A fixed base at position, in ECEF metres.
BaseStation averagingBase(std::chrono::seconds maximum)
Receiver-managed averaging for at most maximum.
The commands after identification.
Definition UnicorePlan.h:50
QList< Command > role
Stops logs, forces a fresh role transition through the rover role, enables NMEA output and sets the b...
Definition UnicorePlan.h:52