5#include "development/mavlink_msg_gnss_integrity.h"
7#include <QtPositioning/QGeoCoordinate>
9VehicleGPSFactGroup::VehicleGPSFactGroup(QObject *parent)
10 :
FactGroup(1000,
":/json/Vehicle/GPSFact.json", parent)
17 _addFact(&_courseOverGroundFact);
20 _addFact(&_countFact);
21 _addFact(&_systemErrorsFact);
22 _addFact(&_spoofingStateFact);
23 _addFact(&_jammingStateFact);
24 _addFact(&_authenticationStateFact);
25 _addFact(&_correctionsQualityFact);
26 _addFact(&_systemQualityFact);
27 _addFact(&_gnssSignalQualityFact);
28 _addFact(&_postProcessingQualityFact);
30 _latFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
31 _lonFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
32 _mgrsFact.setRawValue(
"");
33 _hdopFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
34 _vdopFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
35 _courseOverGroundFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
36 _yawFact.setRawValue(std::numeric_limits<int16_t>::quiet_NaN());
37 _spoofingStateFact.setRawValue(255);
38 _jammingStateFact.setRawValue(255);
39 _authenticationStateFact.setRawValue(255);
40 _correctionsQualityFact.setRawValue(255);
41 _systemQualityFact.setRawValue(255);
42 _gnssSignalQualityFact.setRawValue(255);
43 _postProcessingQualityFact.setRawValue(255);
50 switch (message.msgid) {
51 case MAVLINK_MSG_ID_GPS_RAW_INT:
54 case MAVLINK_MSG_ID_HIGH_LATENCY:
57 case MAVLINK_MSG_ID_HIGH_LATENCY2:
60 case MAVLINK_MSG_ID_GNSS_INTEGRITY:
70 mavlink_gps_raw_int_t gpsRawInt{};
71 mavlink_msg_gps_raw_int_decode(&message, &gpsRawInt);
73 lat()->setRawValue(gpsRawInt.lat * 1e-7);
74 lon()->setRawValue(gpsRawInt.lon * 1e-7);
76 count()->setRawValue((gpsRawInt.satellites_visible == 255) ? 0 : gpsRawInt.satellites_visible);
77 hdop()->setRawValue((gpsRawInt.eph == UINT16_MAX) ? qQNaN() : (gpsRawInt.eph / 100.0));
78 vdop()->setRawValue((gpsRawInt.epv == UINT16_MAX) ? qQNaN() : (gpsRawInt.epv / 100.0));
79 courseOverGround()->setRawValue((gpsRawInt.cog == UINT16_MAX) ? qQNaN() : (gpsRawInt.cog / 100.0));
80 yaw()->setRawValue((gpsRawInt.yaw == UINT16_MAX) ? qQNaN() : (gpsRawInt.yaw / 100.0));
81 lock()->setRawValue(gpsRawInt.fix_type);
88 mavlink_high_latency_t highLatency{};
89 mavlink_msg_high_latency_decode(&message, &highLatency);
91 lat()->setRawValue(highLatency.latitude * 1e-7);
92 lon()->setRawValue(highLatency.longitude * 1e-7);
93 mgrs()->setRawValue(
QGCGeo::convertGeoToMGRS(QGeoCoordinate(highLatency.latitude * 1e-7, highLatency.longitude * 1e-7, highLatency.altitude_amsl)));
94 count()->setRawValue(0);
101 mavlink_high_latency2_t highLatency2{};
102 mavlink_msg_high_latency2_decode(&message, &highLatency2);
104 lat()->setRawValue(highLatency2.latitude * 1e-7);
105 lon()->setRawValue(highLatency2.longitude * 1e-7);
106 mgrs()->setRawValue(
QGCGeo::convertGeoToMGRS(QGeoCoordinate(highLatency2.latitude * 1e-7, highLatency2.longitude * 1e-7, highLatency2.altitude)));
107 count()->setRawValue(0);
108 hdop()->setRawValue((highLatency2.eph == UINT8_MAX) ? qQNaN() : (highLatency2.eph / 10.0));
109 vdop()->setRawValue((highLatency2.epv == UINT8_MAX) ? qQNaN() : (highLatency2.epv / 10.0));
116 mavlink_gnss_integrity_t gnssIntegrity;
117 mavlink_msg_gnss_integrity_decode(&message, &gnssIntegrity);
123 systemErrors()->setRawValue (gnssIntegrity.system_errors);
124 spoofingState()->setRawValue (gnssIntegrity.spoofing_state);
125 jammingState()->setRawValue (gnssIntegrity.jamming_state);
126 authenticationState()->setRawValue (gnssIntegrity.authentication_state);
127 correctionsQuality()->setRawValue (gnssIntegrity.corrections_quality);
128 systemQuality()->setRawValue (gnssIntegrity.system_status_summary);
129 gnssSignalQuality()->setRawValue (gnssIntegrity.gnss_signal_quality);
130 postProcessingQuality()->setRawValue(gnssIntegrity.post_processing_quality);
struct __mavlink_message mavlink_message_t
Geographic coordinate conversion utilities using GeographicLib.
Used to group Facts together into an object hierarachy.
void _setTelemetryAvailable(bool telemetryAvailable)
void _handleHighLatency2(const mavlink_message_t &message)
void _handleHighLatency(const mavlink_message_t &message)
void _handleGpsRawInt(const mavlink_message_t &message)
void _handleGnssIntegrity(const mavlink_message_t &message)
void gnssIntegrityReceived()
QString convertGeoToMGRS(const QGeoCoordinate &coord)