Newer
Older
bool _receivingAttitudeQuaternion = false;
CheckList _checkListState = CheckListNotSetup;
bool _readyToFlyAvailable = false;
bool _readyToFly = false;
bool _allSensorsHealthy = true;
SysStatusSensorInfo _sysStatusSensorInfo;
QString _prearmError;
QTimer _prearmErrorTimer;
static const int _prearmErrorTimeoutMSecs = 35 * 1000; ///< Take away prearm error after 35 seconds
bool _initialPlanRequestComplete = false;
LinkManager* _linkManager = nullptr;
FirmwarePluginManager* _firmwarePluginManager = nullptr;
JoystickManager* _joystickManager = nullptr;
ComponentInformationManager* _componentInformationManager = nullptr;
VehicleObjectAvoidance* _objectAvoidance = nullptr;
#if defined(QGC_AIRMAP_ENABLED)
AirspaceVehicleManager* _airspaceVehicleManager = nullptr;
bool _armed = false; ///< true: vehicle is armed
uint8_t _base_mode = 0; ///< base_mode from HEARTBEAT
uint32_t _custom_mode = 0; ///< custom_mode from HEARTBEAT
/// Used to store a message being sent by sendMessageMultiple
typedef struct {
mavlink_message_t message; ///< Message to send multiple times
int retryCount; ///< Number of retries left
} SendMessageMultipleInfo_t;
QList<SendMessageMultipleInfo_t> _sendMessageMultipleList; ///< List of messages being sent multiple times
static const int _sendMessageMultipleRetries = 5;
static const int _sendMessageMultipleIntraMessageDelay = 500;
int _nextSendMessageMultipleIndex = 0;
Patrick José Pereira
committed
QElapsedTimer _flightTimer;
TrajectoryPoints* _trajectoryPoints = nullptr;
int _flowImageIndex = 0;
bool _allLinksRemovedSent = false; ///< true: allLinkRemoved signal already sent one time
uint _messagesReceived = 0;
uint _messagesSent = 0;
uint _messagesLost = 0;
uint8_t _messageSeq = 0;
uint8_t _compID = 0;
bool _heardFrom = false;
float _curGimbalRoll = 0.0f;
float _curGimbalPitch = 0.0f;
float _curGinmbalYaw = 0.0f;
bool _haveGimbalData = false;
int _firmwareMajorVersion = versionNotSetValue;
int _firmwareMinorVersion = versionNotSetValue;
int _firmwarePatchVersion = versionNotSetValue;
int _firmwareCustomMajorVersion = versionNotSetValue;
int _firmwareCustomMinorVersion = versionNotSetValue;
int _firmwareCustomPatchVersion = versionNotSetValue;
FIRMWARE_VERSION_TYPE _firmwareVersionType = FIRMWARE_VERSION_TYPE_OFFICIAL;
quint64 _uid = 0;
uint64_t _mavlinkSentCount = 0;
uint64_t _mavlinkReceivedCount = 0;
uint64_t _mavlinkLossCount = 0;
float _mavlinkLossPercent = 0.0f;
QMap<QString, QTime> _noisySpokenPrearmMap; ///< Used to prevent PreArm messages from being spoken too often
bool _orbitActive = false;
QGCMapCircle _orbitMapCircle;
QTimer _orbitTelemetryTimer;
static const int _orbitTelemetryTimeoutMsecs = 3000; // No telemetry for this amount and orbit will go inactive
bool _pidTuningTelemetryMode = false;
bool _pidTuningWaitingForRates = false;
QList<int> _pidTuningMessages;
QMap<int, int> _pidTuningMessageRatesUsecs;
// Chunked status text support
typedef struct {
uint16_t chunkId;
uint8_t severity;
QStringList rgMessageChunks;
} ChunkedStatusTextInfo_t;
QMap<uint8_t /* compId */, ChunkedStatusTextInfo_t> _chunkedStatusTextInfoMap;
QTimer _chunkedStatusTextTimer;
/// Callback for waitForMavlinkMessage
/// @param resultHandleData Opaque data passed in to waitForMavlinkMessage call
/// @param commandResult Ack result for command send
/// @param noReponseFromVehicle true: The vehicle did not responsed to the COMMAND_LONG message
typedef void (*WaitForMavlinkMessageResultHandler)(void* resultHandlerData, bool noResponsefromVehicle, const mavlink_message_t& message);
/// Waits for the specified msecs for the message to be received. Calls timeoutHandler if not received.
void _waitForMavlinkMessage (WaitForMavlinkMessageResultHandler resultHandler, void* resultHandlerData, int messageId, int timeoutMsecs);
int _waitForMavlinkMessageId = 0;
bool _waitForMavlinkMessageTimeoutActive = false;
int _waitForMavlinkMessageTimeoutMsecs = 0;
WaitForMavlinkMessageResultHandler _waitForMavlinkMessageResultHandler = nullptr;
void* _waitForMavlinkMessageResultHandlerData = nullptr;
void _waitForMavlinkMessageMessageReceived(const mavlink_message_t& message);
// requestMessage handling
typedef struct {
bool commandAckReceived; // We keep track of the ack/message being received since the order in which this will come in is random
bool messageReceived; // We only delete the allocated RequestMessageInfo_t when both happen (or the message wait times out)
int msgId;
int compId;
RequestMessageResultHandler resultHandler;
void* resultHandlerData;
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
} RequestMessageInfo_t;
static void _requestMessageCmdResultHandler (void* resultHandlerData, int compId, MAV_RESULT result, bool noResponsefromVehicle);
static void _requestMessageWaitForMessageResultHandler (void* resultHandlerData, bool noResponsefromVehicle, const mavlink_message_t& message);
typedef struct {
int compId;
bool commandInt; // true: use COMMAND_INT, false: use COMMAND_LONG
MAV_CMD command;
MAV_FRAME frame;
float rgParam[7];
bool showError;
bool requestMessage; // true: this is from a requestMessage call
MavCmdResultHandler resultHandler;
void* resultHandlerData;
} MavCommandQueueEntry_t;
QQueue<MavCommandQueueEntry_t> _mavCommandQueue;
QTimer _mavCommandAckTimer;
int _mavCommandRetryCount;
static const int _mavCommandMaxRetryCount = 3;
static const int _mavCommandAckTimeoutMSecs = 3000;
static const int _mavCommandAckTimeoutMSecsHighLatency = 120000;
void _sendMavCommandWorker(bool commandInt, bool requestMessage, bool showError, MavCmdResultHandler resultHandler, void* resultHandlerData, int compId, MAV_CMD command, MAV_FRAME frame, float param1, float param2, float param3, float param4, float param5, float param6, float param7);
QMap<uint8_t /* batteryId */, uint8_t /* MAV_BATTERY_CHARGE_STATE_OK */> _lowestBatteryChargeStateAnnouncedMap;
// FactGroup facts
Fact _rollFact;
Fact _pitchFact;
Fact _headingFact;
Fact _rollRateFact;
Fact _pitchRateFact;
Fact _yawRateFact;
Fact _groundSpeedFact;
Fact _airSpeedFact;
Fact _climbRateFact;
Fact _altitudeRelativeFact;
Fact _altitudeAMSLFact;
Fact _missionItemIndexFact;
VehicleGPSFactGroup _gpsFactGroup;
VehicleWindFactGroup _windFactGroup;
VehicleVibrationFactGroup _vibrationFactGroup;
VehicleTemperatureFactGroup _temperatureFactGroup;
VehicleClockFactGroup _clockFactGroup;
VehicleSetpointFactGroup _setpointFactGroup;
VehicleDistanceSensorFactGroup _distanceSensorFactGroup;
VehicleEscStatusFactGroup _escStatusFactGroup;
VehicleEstimatorStatusFactGroup _estimatorStatusFactGroup;
MissionManager* _missionManager = nullptr;
GeoFenceManager* _geoFenceManager = nullptr;
RallyPointManager* _rallyPointManager = nullptr;
VehicleLinkManager* _vehicleLinkManager = nullptr;
FTPManager* _ftpManager = nullptr;
InitialConnectStateMachine* _initialConnectStateMachine = nullptr;
static const char* _rollFactName;
static const char* _pitchFactName;
static const char* _headingFactName;
static const char* _rollRateFactName;
static const char* _pitchRateFactName;
static const char* _yawRateFactName;
static const char* _groundSpeedFactName;
static const char* _airSpeedFactName;
static const char* _climbRateFactName;
static const char* _altitudeRelativeFactName;
static const char* _altitudeAMSLFactName;
static const char* _flightDistanceFactName;
static const char* _flightTimeFactName;
static const char* _distanceToHomeFactName;
static const char* _missionItemIndexFactName;
static const char* _headingToNextWPFactName;
static const char* _hobbsFactName;
static const char* _vibrationFactGroupName;
static const char* _temperatureFactGroupName;
static const char* _distanceSensorFactGroupName;
static const char* _escStatusFactGroupName;
static const char* _estimatorStatusFactGroupName;
static const int _vehicleUIUpdateRateMSecs = 100;
static const char* _settingsGroup;
static const char* _joystickEnabledSettingsKey;
friend class VehicleBatteryFactGroup; // Allow VehicleBatteryFactGroup to call _addFactGroup
friend class VehicleLinkManager;