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