QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleEstimatorStatusFactGroup.cc
Go to the documentation of this file.
2
3#include "MAVLinkLib.h"
4#include "Vehicle.h"
5
7 : FactGroup(500, QStringLiteral(":/json/Vehicle/EstimatorStatusFactGroup.json"), parent)
8{
9 _addFact(&_goodAttitudeEstimateFact);
10 _addFact(&_goodHorizVelEstimateFact);
11 _addFact(&_goodVertVelEstimateFact);
12 _addFact(&_goodHorizPosRelEstimateFact);
13 _addFact(&_goodHorizPosAbsEstimateFact);
14 _addFact(&_goodVertPosAbsEstimateFact);
15 _addFact(&_goodVertPosAGLEstimateFact);
16 _addFact(&_goodConstPosModeEstimateFact);
17 _addFact(&_goodPredHorizPosRelEstimateFact);
18 _addFact(&_goodPredHorizPosAbsEstimateFact);
19 _addFact(&_gpsGlitchFact);
20 _addFact(&_accelErrorFact);
21 _addFact(&_velRatioFact);
22 _addFact(&_horizPosRatioFact);
23 _addFact(&_vertPosRatioFact);
24 _addFact(&_magRatioFact);
25 _addFact(&_haglRatioFact);
26 _addFact(&_tasRatioFact);
27 _addFact(&_horizPosAccuracyFact);
28 _addFact(&_vertPosAccuracyFact);
29}
30
32{
33 Q_UNUSED(vehicle);
34
35 if (message.msgid != MAVLINK_MSG_ID_ESTIMATOR_STATUS) {
36 return;
37 }
38
39 mavlink_estimator_status_t estimatorStatus{};
40 mavlink_msg_estimator_status_decode(&message, &estimatorStatus);
41
42 goodAttitudeEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_ATTITUDE));
43 goodHorizVelEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_VELOCITY_HORIZ));
44 goodVertVelEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_VELOCITY_VERT));
45 goodHorizPosRelEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_POS_HORIZ_REL));
46 goodHorizPosAbsEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_POS_HORIZ_ABS));
47 goodVertPosAbsEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_POS_VERT_ABS));
48 goodVertPosAGLEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_POS_VERT_AGL));
49 goodConstPosModeEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_CONST_POS_MODE));
50 goodPredHorizPosRelEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_PRED_POS_HORIZ_REL));
51 goodPredHorizPosAbsEstimate()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_PRED_POS_HORIZ_ABS));
52 gpsGlitch()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_GPS_GLITCH));
53 accelError()->setRawValue(!!(estimatorStatus.flags & ESTIMATOR_ACCEL_ERROR));
54 velRatio()->setRawValue(estimatorStatus.vel_ratio);
55 horizPosRatio()->setRawValue(estimatorStatus.pos_horiz_ratio);
56 vertPosRatio()->setRawValue(estimatorStatus.pos_vert_ratio);
57 magRatio()->setRawValue(estimatorStatus.mag_ratio);
58 haglRatio()->setRawValue(estimatorStatus.hagl_ratio);
59 tasRatio()->setRawValue(estimatorStatus.tas_ratio);
60 horizPosAccuracy()->setRawValue(estimatorStatus.pos_horiz_accuracy);
61 vertPosAccuracy()->setRawValue(estimatorStatus.pos_vert_accuracy);
62
64}
struct __mavlink_message mavlink_message_t
Used to group Facts together into an object hierarachy.
Definition FactGroup.h:16
void _setTelemetryAvailable(bool telemetryAvailable)
Definition FactGroup.cc:175
void _addFact(Fact *fact, const QString &name)
Definition FactGroup.cc:116
void setRawValue(const QVariant &value)
Definition Fact.cc:135
VehicleEstimatorStatusFactGroup(QObject *parent=nullptr)
void handleMessage(Vehicle *vehicle, const mavlink_message_t &message) final
Allows a FactGroup to parse incoming messages and fill in values.