18 Q_MOC_INCLUDE(
"QmlObjectListModel.h")
42 Q_INVOKABLE
void gimbalOnScreenControl(
float panpct,
float tiltpct,
bool clickAndPoint,
bool clickAndDrag,
bool rateControl,
bool retract =
false,
bool neutral =
false,
bool yawlock =
false);
43 Q_INVOKABLE
void sendPitchBodyYaw(
float pitch,
float yaw,
bool showError =
true);
54 Q_INVOKABLE
void sendGimbalRate(
float pitch_rate_deg_s,
float yaw_rate_deg_s);
71 void _initialConnectCompleted();
73 void _rateSenderTimeout();
77 GimbalPairId() =
default;
78 GimbalPairId(uint8_t _managerCompid, uint8_t _deviceId)
79 : managerCompid(_managerCompid)
80 , deviceId(_deviceId) {}
83 bool operator<(
const GimbalPairId &other)
const {
85 if (managerCompid < other.managerCompid) {
87 }
else if (managerCompid > other.managerCompid) {
89 }
else if (deviceId < other.deviceId) {
96 bool operator==(
const GimbalPairId &other)
const {
97 return (managerCompid == other.managerCompid) && (deviceId == other.deviceId);
100 uint8_t managerCompid = 0;
101 uint8_t deviceId = 0;
105 bool _requestGimbalInformation(uint8_t compid);
107 static void _requestDeviceInformationResultHandler(
115 void _checkComplete(Gimbal &gimbal, GimbalPairId pairId);
116 bool _tryGetGimbalControl();
117 bool _yawInVehicleFrame(uint32_t flags);
118 static bool _gcsSystemIdSupportsGimbalControl();
119 static void _showGcsSystemIdUnsupportedMessage();
121 void _sendGimbalAttitudeRates(
float pitch_rate_deg_s,
float yaw_rate_deg_s);
123 QTimer _rateSenderTimer;
124 Vehicle *_vehicle =
nullptr;
125 Gimbal *_activeGimbal =
nullptr;
126 int _pendingInformationRequestCompId = -1;
128 struct PotentialGimbalManager {
129 unsigned requestGimbalManagerInformationRetries = 6;
130 bool receivedGimbalManagerInformation =
false;
132 QMap<uint8_t, PotentialGimbalManager> _potentialGimbalManagers;
134 QMap<GimbalPairId, Gimbal*> _potentialGimbals;
135 QmlObjectListModel *_gimbals =
nullptr;
136 bool _initialConnectComplete =
false;
137 bool _gcsSystemIdUnsupportedMessageShown =
false;
139 static constexpr const char *_gimbalFactGroupNamePrefix =
"gimbal";
Q_INVOKABLE void gimbalOnScreenControl(float panpct, float tiltpct, bool clickAndPoint, bool clickAndDrag, bool rateControl, bool retract=false, bool neutral=false, bool yawlock=false)