20 Q_MOC_INCLUDE(
"QmlObjectListModel.h")
29 Gimbal *activeGimbal()
const {
return _activeGimbal; }
32 void setActiveGimbal(
Gimbal *gimbal);
34 void sendPitchYawFlags(uint32_t flags);
35 Q_INVOKABLE
void gimbalOnScreenControl(
float panpct,
float tiltpct,
bool clickAndPoint,
bool clickAndDrag,
bool rateControl,
bool retract =
false,
bool neutral =
false,
bool yawlock =
false);
36 Q_INVOKABLE
void sendPitchBodyYaw(
float pitch,
float yaw,
bool showError =
true);
37 Q_INVOKABLE
void sendPitchAbsoluteYaw(
float pitch,
float yaw,
bool showError =
true);
38 Q_INVOKABLE
void setGimbalRetract(
bool set);
39 Q_INVOKABLE
void setGimbalYawLock(
bool set);
40 Q_INVOKABLE
void acquireGimbalControl();
41 Q_INVOKABLE
void releaseGimbalControl();
42 Q_INVOKABLE
void sendRate();
47 Q_INVOKABLE
void sendGimbalRate(
float pitch_rate_deg_s,
float yaw_rate_deg_s);
63 void _initialConnectCompleted();
65 void _rateSenderTimeout();
69 GimbalPairId() =
default;
70 GimbalPairId(uint8_t _managerCompid, uint8_t _deviceId)
71 : managerCompid(_managerCompid)
72 , deviceId(_deviceId) {}
75 bool operator<(
const GimbalPairId &other)
const {
77 if (managerCompid < other.managerCompid) {
79 }
else if (managerCompid > other.managerCompid) {
81 }
else if (deviceId < other.deviceId) {
88 bool operator==(
const GimbalPairId &other)
const {
89 return (managerCompid == other.managerCompid) && (deviceId == other.deviceId);
92 uint8_t managerCompid = 0;
96 void _requestGimbalInformation(uint8_t compid);
101 void _checkComplete(
Gimbal &gimbal, GimbalPairId pairId);
102 bool _tryGetGimbalControl();
103 bool _yawInVehicleFrame(uint32_t flags);
105 void _sendGimbalAttitudeRates(
float pitch_rate_deg_s,
float yaw_rate_deg_s);
107 QTimer _rateSenderTimer;
109 Gimbal *_activeGimbal =
nullptr;
111 struct PotentialGimbalManager {
112 unsigned requestGimbalManagerInformationRetries = 6;
113 bool receivedGimbalManagerInformation =
false;
115 QMap<uint8_t, PotentialGimbalManager> _potentialGimbalManagers;
117 QMap<GimbalPairId, Gimbal*> _potentialGimbals;
119 bool _initialConnectComplete =
false;
121 static constexpr const char *_gimbalFactGroupNamePrefix =
"gimbal";