QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleLocalPositionFactGroup.cc
Go to the documentation of this file.
2#include "Vehicle.h"
3
5 : FactGroup(1000, QStringLiteral(":/json/Vehicle/LocalPositionFact.json"), parent)
6{
7 _addFact(&_xFact);
8 _addFact(&_yFact);
9 _addFact(&_zFact);
10 _addFact(&_vxFact);
11 _addFact(&_vyFact);
12 _addFact(&_vzFact);
13
14 _xFact.setRawValue(qQNaN());
15 _yFact.setRawValue(qQNaN());
16 _zFact.setRawValue(qQNaN());
17 _vxFact.setRawValue(qQNaN());
18 _vyFact.setRawValue(qQNaN());
19 _vzFact.setRawValue(qQNaN());
20}
21
23{
24 Q_UNUSED(vehicle);
25
26 if (message.msgid != MAVLINK_MSG_ID_LOCAL_POSITION_NED) {
27 return;
28 }
29
30 mavlink_local_position_ned_t localPosition{};
31 mavlink_msg_local_position_ned_decode(&message, &localPosition);
32
33 x()->setRawValue(localPosition.x);
34 y()->setRawValue(localPosition.y);
35 z()->setRawValue(localPosition.z);
36
37 vx()->setRawValue(localPosition.vx);
38 vy()->setRawValue(localPosition.vy);
39 vz()->setRawValue(localPosition.vz);
40
42}
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:128
void handleMessage(Vehicle *vehicle, const mavlink_message_t &message) final
Allows a FactGroup to parse incoming messages and fill in values.
VehicleLocalPositionFactGroup(QObject *parent=nullptr)