QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
AshtechPlan.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
10#include "GPSCommand.h"
11
13
19namespace Ashtech::Plan {
20
21struct Setting
22{
23 std::string_view command;
24 bool required = true;
25};
26
28inline constexpr std::chrono::milliseconds RESPONSE_TIMEOUT{200};
29
31inline constexpr std::array BAUD_RATES{9600u, 38400u, 19200u, 57600u, 115200u};
32inline constexpr std::string_view PORT_QUERY = "$PASHQ,PRT";
33inline constexpr unsigned PORT_QUERY_ATTEMPTS = 2;
34
37inline constexpr unsigned LINK_BAUD = 115200;
38inline constexpr std::string_view LINK_SPEED = "$PASHS,SPD,{port},9";
39inline constexpr std::chrono::milliseconds LINK_SPEED_SETTLE{200};
40inline constexpr unsigned PORT_QUERY_ATTEMPTS_AT_LINK_BAUD = 10;
41
43inline constexpr std::string_view BOARD_QUERY = "$PASHQ,RID";
44inline constexpr std::string_view BASE_BOARD = "MB2";
45
47inline constexpr std::array OUTPUTS{
48 Setting{"$PASHS,POP,20", false}, // internal update rate 20 Hz
49 Setting{"$PASHS,SNS,SOL", false},
50 Setting{"$PASHS,NME,ALL,{port},OFF", false}, // all NMEA and NMEA-like messages off
51 Setting{"$PASHS,ATM,ALL,{port},OFF", false}, // all ATOM messages off
52 Setting{"$PASHS,OUT,{port},ON", false}, // periodic output on
53 Setting{"$PASHS,NME,ZDA,{port},ON,3", false}, // date and time every 3 s
54 Setting{"$PASHS,NME,GST,{port},ON,3", false}, // position accuracy every 3 s
55 Setting{"$PASHS,NME,POS,{port},ON,0.05", false}, // position and velocity at 20 Hz (option W; 50 Hz needs 8)
56 Setting{"$PASHS,NME,GSV,{port},ON,1", false}, // satellites in view every second
57};
58
60inline constexpr std::array STATION{
61 Setting{"$PASHS,ANP,OWN,TRM55971.00"}, // antenna name (arbitrary)
62 Setting{"$PASHS,STI,0001"}, // base station ID
63};
64
66inline constexpr std::array RTCM_OUTPUTS{
67 Setting{"$PASHS,NME,POS,{port},ON,0.2"}, // position output reduced to 5 Hz
68 Setting{"$PASHS,RT3,1074,{port},ON,1"}, // GPS observations
69 Setting{"$PASHS,RT3,1084,{port},ON,1"}, // GLONASS observations
70 Setting{"$PASHS,RT3,1094,{port},ON,1"}, // Galileo observations
71 Setting{"$PASHS,RT3,1114,{port},ON,1"}, // QZSS observations
72 Setting{"$PASHS,RT3,1124,{port},ON,1"}, // BeiDou observations
73 Setting{"$PASHS,RT3,1006,{port},ON,1"}, // static position
74 Setting{"$PASHS,RT3,1033,{port},ON,31"}, // antenna and receiver name
75 Setting{"$PASHS,RT3,1013,{port},ON,1"}, // system parameters
76 Setting{"$PASHS,RT3,1029,{port},ON,1"}, // ASCII message
77 Setting{"$PASHS,RT3,1230,{port},ON"}, // GLONASS code-phase biases
78 // The u-blox base messages; possibly redundant for these receivers.
79 Setting{"$PASHS,RT3,1005,{port},ON,1"},
80 Setting{"$PASHS,RT3,1077,{port},ON,1"},
81 Setting{"$PASHS,RT3,1087,{port},ON,1"},
82};
83
85[[nodiscard]] GPSCommandOutcome rejection(std::string_view reply);
86
88[[nodiscard]] GPSCommandOutcome acknowledgement(std::string_view reply);
89
91[[nodiscard]] QByteArray line(std::string_view command);
92
94[[nodiscard]] QByteArray line(std::string_view command, char port);
95
98[[nodiscard]] QByteArray surveyStart(std::chrono::seconds duration);
99
102[[nodiscard]] QByteArray fixedPosition(const GPSEllipsoidPosition& position);
103
106
108[[nodiscard]] GPSCommandSequence sequence(std::span<const Setting> settings, char port);
109
110} // namespace Ashtech::Plan
GPSCommandOutcome
Definition GPSCommand.h:33
QByteArray surveyStart(std::chrono::seconds duration)
GPSCommandOutcome rejection(std::string_view reply)
A NAK rejects any command.
GPSCommandSequence::Command fixedPositionCommand(const GPSEllipsoidPosition &position)
The fixedPosition() command, acknowledged by an ACK and labelled without its coordinates.
QByteArray fixedPosition(const GPSEllipsoidPosition &position)
constexpr std::array OUTPUTS
Navigation output. Some receivers do not acknowledge some of these (GSV, for example),...
Definition AshtechPlan.h:47
constexpr std::array BAUD_RATES
Rates the port query probes, in order. Trimble receivers default to 115200.
Definition AshtechPlan.h:31
constexpr std::string_view BOARD_QUERY
Board identification; only an MB-Two (BASE_BOARD) can run as a base station.
Definition AshtechPlan.h:43
constexpr std::string_view LINK_SPEED
Definition AshtechPlan.h:38
GPSCommandSequence sequence(std::span< const Setting > settings, char port)
settings for port, each acknowledged by an ACK.
constexpr std::chrono::milliseconds RESPONSE_TIMEOUT
Per attempt, for every command.
Definition AshtechPlan.h:28
GPSCommandOutcome acknowledgement(std::string_view reply)
A $PASHS setting is acknowledged by an ACK.
constexpr unsigned PORT_QUERY_ATTEMPTS_AT_LINK_BAUD
Definition AshtechPlan.h:40
constexpr std::chrono::milliseconds LINK_SPEED_SETTLE
Definition AshtechPlan.h:39
constexpr std::string_view PORT_QUERY
Definition AshtechPlan.h:32
QByteArray line(std::string_view command)
command as one CR/LF-terminated line.
constexpr unsigned LINK_BAUD
Definition AshtechPlan.h:37
constexpr unsigned PORT_QUERY_ATTEMPTS
Definition AshtechPlan.h:33
constexpr std::array STATION
Station description once averaging has started (see surveyStart()).
Definition AshtechPlan.h:60
constexpr std::string_view BASE_BOARD
Definition AshtechPlan.h:44
constexpr std::array RTCM_OUTPUTS
RTCM3 output once the base position is known.
Definition AshtechPlan.h:66
std::string_view command
Definition AshtechPlan.h:23
WGS84 geodetic position with ellipsoid height, not mean-sea-level altitude.