QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
Autotune.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QTimer>
4#include <QtQmlIntegration/QtQmlIntegration>
5
6#include "VehicleTypes.h"
8#include "QGCMAVLinkTypes.h"
9
10class Vehicle;
11
12class Autotune : public QObject
13{
14 Q_OBJECT
15 QML_ELEMENT
16 QML_UNCREATABLE("")
17
18public:
19 explicit Autotune(Vehicle *vehicle);
20
21 Q_PROPERTY(bool autotuneInProgress READ autotuneInProgress NOTIFY autotuneChanged)
22 Q_PROPERTY(float autotuneProgress READ autotuneProgress NOTIFY autotuneChanged)
23 Q_PROPERTY(QString autotuneStatus READ autotuneStatus NOTIFY autotuneChanged)
24
25 Q_INVOKABLE void autotuneRequest ();
26
27 static void ackHandler (void* resultHandlerData, int compId, const mavlink_command_ack_t& ack, VehicleTypes::MavCmdResultFailureCode_t failureCode);
28 static void progressHandler (void* progressHandlerData, int compId, const mavlink_command_ack_t& ack);
29
30 bool autotuneInProgress () { return _autotuneInProgress; }
31 float autotuneProgress () { return _autotuneProgress; }
32 QString autotuneStatus () { return _autotuneStatus; }
33
34
35public slots:
36 void sendMavlinkRequest();
37
38signals:
40
41private:
42 void handleAckStatus(uint8_t ackProgress);
43 void handleAckFailure();
44 void handleAckError(uint8_t ackError);
45 void startTimers();
46 void stopTimers();
47
48private:
49 Vehicle* _vehicle {nullptr};
50 bool _autotuneInProgress {false};
51 float _autotuneProgress {0.0};
52 QString _autotuneStatus {tr("Autotune: Not performed")};
53 bool _disarmMessageDisplayed {false};
54
55 QTimer _pollTimer; // the frequency at which the polling should be performed
56
57};
struct __mavlink_command_ack_t mavlink_command_ack_t
static void ackHandler(void *resultHandlerData, int compId, const mavlink_command_ack_t &ack, VehicleTypes::MavCmdResultFailureCode_t failureCode)
Definition Autotune.cpp:31
static void progressHandler(void *progressHandlerData, int compId, const mavlink_command_ack_t &ack)
Definition Autotune.cpp:58
bool autotuneInProgress()
Definition Autotune.h:30
QString autotuneStatus()
Definition Autotune.h:32
void autotuneChanged()
void sendMavlinkRequest()
Definition Autotune.cpp:151
float autotuneProgress()
Definition Autotune.h:31
Q_INVOKABLE void autotuneRequest()
Definition Autotune.cpp:18