QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SensorsComponentController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtQuick/QQuickItem>
4#include <QtQmlIntegration/QtQmlIntegration>
5
7
11{
12 Q_OBJECT
13 QML_ELEMENT
14public:
16
25 Q_ENUM(SideCalState)
26
27 Q_PROPERTY(QQuickItem* statusLog MEMBER _statusLog)
28 Q_PROPERTY(QQuickItem* progressBar MEMBER _progressBar)
29
30 Q_PROPERTY(QQuickItem* orientationCalAreaHelpText MEMBER _orientationCalAreaHelpText)
31
33 Q_PROPERTY(bool magCalInProgress MEMBER _magCalInProgress NOTIFY calibrationActiveChanged)
34
35 Q_PROPERTY(bool showOrientationCalArea MEMBER _showOrientationCalArea NOTIFY showOrientationCalAreaChanged)
36
37 Q_PROPERTY(SideCalState orientationCalDownSideState MEMBER _orientationCalDownSideState NOTIFY orientationCalSidesStateChanged)
38 Q_PROPERTY(SideCalState orientationCalUpsideDownSideState MEMBER _orientationCalUpsideDownSideState NOTIFY orientationCalSidesStateChanged)
39 Q_PROPERTY(SideCalState orientationCalLeftSideState MEMBER _orientationCalLeftSideState NOTIFY orientationCalSidesStateChanged)
40 Q_PROPERTY(SideCalState orientationCalRightSideState MEMBER _orientationCalRightSideState NOTIFY orientationCalSidesStateChanged)
41 Q_PROPERTY(SideCalState orientationCalNoseDownSideState MEMBER _orientationCalNoseDownSideState NOTIFY orientationCalSidesStateChanged)
42 Q_PROPERTY(SideCalState orientationCalTailDownSideState MEMBER _orientationCalTailDownSideState NOTIFY orientationCalSidesStateChanged)
43
44 Q_PROPERTY(bool orientationCalDownSideVisible MEMBER _orientationCalDownSideVisible NOTIFY orientationCalSidesVisibleChanged)
45 Q_PROPERTY(bool orientationCalUpsideDownSideVisible MEMBER _orientationCalUpsideDownSideVisible NOTIFY orientationCalSidesVisibleChanged)
46 Q_PROPERTY(bool orientationCalLeftSideVisible MEMBER _orientationCalLeftSideVisible NOTIFY orientationCalSidesVisibleChanged)
47 Q_PROPERTY(bool orientationCalRightSideVisible MEMBER _orientationCalRightSideVisible NOTIFY orientationCalSidesVisibleChanged)
48 Q_PROPERTY(bool orientationCalNoseDownSideVisible MEMBER _orientationCalNoseDownSideVisible NOTIFY orientationCalSidesVisibleChanged)
49 Q_PROPERTY(bool orientationCalTailDownSideVisible MEMBER _orientationCalTailDownSideVisible NOTIFY orientationCalSidesVisibleChanged)
50
51 Q_PROPERTY(bool waitingForCancel MEMBER _waitingForCancel NOTIFY waitingForCancelChanged)
52
53 Q_INVOKABLE void calibrateCompass(void);
54 Q_INVOKABLE void calibrateGyro(void);
55 Q_INVOKABLE void calibrateAccel(void);
56 Q_INVOKABLE void calibrateLevel(void);
57 Q_INVOKABLE void calibrateAirspeed(void);
58 Q_INVOKABLE void cancelCalibration(void);
59 Q_INVOKABLE bool usingUDPLink(void);
60 Q_INVOKABLE void resetFactoryParameters();
61 Q_INVOKABLE void resetSidesToIdle(void);
62
63 bool calibrationActive() const { return _magCalInProgress || _gyroCalInProgress || _accelCalInProgress || _airspeedCalInProgress || _levelCalInProgress; }
64
65signals:
72 void magCalComplete(void);
74
75private slots:
76 void _handleUASTextMessage(int uasId, int compId, int severity, QString text, const QString &description);
77 void _handleParametersReset(bool success);
78
79private:
80 void _startLogCalibration(void);
81 void _startVisualCalibration(void);
82 void _appendStatusLog(const QString& text);
83 void _refreshParams(void);
84 void _hideAllCalAreas(void);
85 void _setAllSidesState(SideCalState state);
86
87 enum StopCalibrationCode {
88 StopCalibrationSuccess,
89 StopCalibrationFailed,
90 StopCalibrationCancelled
91 };
92 void _stopCalibration(StopCalibrationCode code);
93
94 void _updateAndEmitShowOrientationCalArea(bool show);
95
96 QQuickItem* _statusLog;
97 QQuickItem* _progressBar;
98 QQuickItem* _orientationCalAreaHelpText;
99
100 bool _showGyroCalArea;
101 bool _showOrientationCalArea;
102
103 bool _gyroCalInProgress;
104 bool _magCalInProgress;
105 bool _accelCalInProgress;
106 bool _airspeedCalInProgress;
107 bool _levelCalInProgress;
108
109 bool _orientationCalDownSideVisible;
110 bool _orientationCalUpsideDownSideVisible;
111 bool _orientationCalLeftSideVisible;
112 bool _orientationCalRightSideVisible;
113 bool _orientationCalNoseDownSideVisible;
114 bool _orientationCalTailDownSideVisible;
115
116 SideCalState _orientationCalDownSideState;
117 SideCalState _orientationCalUpsideDownSideState;
118 SideCalState _orientationCalLeftSideState;
119 SideCalState _orientationCalRightSideState;
120 SideCalState _orientationCalNoseDownSideState;
121 SideCalState _orientationCalTailDownSideState;
122
123 bool _unknownFirmwareVersion;
124 bool _waitingForCancel;
125
126 static const int _supportedFirmwareCalVersion = 2;
127};
Used for handling missing Facts from C++ code.
Sensors Component MVC Controller for SensorsComponent.qml.
void orientationCalSidesVisibleChanged(void)
void waitingForCancelChanged(void)
@ SideCalStateIncomplete
Calibration running, side not yet calibrated.
@ SideCalStateInProgress
Side actively being calibrated.
@ SideCalStateIdle
No calibration data to show (neutral preview)
@ SideCalStateCompleted
Side calibration complete.
void orientationCalSidesStateChanged(void)
void calibrationActiveChanged(void)
void showOrientationCalAreaChanged(void)