Newer
Older
QGeoCoordinate _coordinate;
UASInterface* _mav;
int _currentMessageCount;
int _messageCount;
int _currentErrorCount;
int _currentWarningCount;
int _currentNormalCount;
MessageType_t _currentMessageType;
QString _latestError;
int _updateCount;
bool _autoDisconnect; ///< true: Automatically disconnect vehicle when last connection goes away or lost heartbeat
uint32_t _onboardControlSensorsPresent;
uint32_t _onboardControlSensorsEnabled;
uint32_t _onboardControlSensorsHealth;
uint32_t _onboardControlSensorsUnhealthy;
bool _gpsRawIntMessageAvailable = false;
bool _globalPositionIntMessageAvailable = false;
bool _altitudeMessageAvailable = false;
double _defaultCruiseSpeed;
double _defaultHoverSpeed;
int _telemetryRRSSI;
int _telemetryLRSSI;
uint32_t _telemetryRXErrors;
uint32_t _telemetryFixed;
uint32_t _telemetryTXBuffer;
int _telemetryLNoise;
int _telemetryRNoise;
bool _mavlinkProtocolRequestComplete = false;
unsigned _mavlinkProtocolRequestMaxProtoVersion = 0;
unsigned _maxProtoVersion = 0;
bool _capabilityBitsKnown = false;
uint64_t _capabilityBits;
bool _receivingAttitudeQuaternion;
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
// Lost connection handling
bool _connectionLost;
bool _connectionLostEnabled;
RallyPointManager* _rallyPointManager;
ComponentInformationManager* _componentInformationManager = nullptr;
InitialConnectStateMachine* _initialConnectStateMachine = nullptr;
VehicleObjectAvoidance* _objectAvoidance = nullptr;
#if defined(QGC_AIRMAP_ENABLED)
AirspaceVehicleManager* _airspaceVehicleManager;
bool _armed; ///< true: vehicle is armed
uint8_t _base_mode; ///< base_mode from HEARTBEAT
uint32_t _custom_mode; ///< 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;
QTimer _sendMultipleTimer;
int _nextSendMessageMultipleIndex;
Patrick José Pereira
committed
QElapsedTimer _flightTimer;
TrajectoryPoints* _trajectoryPoints;
QmlObjectListModel _cameraTriggerPoints;
FirmwarePluginManager* _firmwarePluginManager;
JoystickManager* _joystickManager;
int _flowImageIndex;
bool _allLinksInactiveSent; ///< true: allLinkInactive signal already sent one time
uint _messagesReceived;
uint _messagesSent;
uint _messagesLost;
uint8_t _messageSeq;
uint8_t _compID;
bool _heardFrom;
float _curGimbalRoll = 0.0f;
float _curGimbalPitch = 0.0f;
float _curGinmbalYaw = 0.0f;
bool _haveGimbalData = false;
int _firmwareMajorVersion;
int _firmwareMinorVersion;
int _firmwarePatchVersion;
int _firmwareCustomMajorVersion;
int _firmwareCustomMinorVersion;
int _firmwareCustomPatchVersion;
FIRMWARE_VERSION_TYPE _firmwareVersionType;
SharedLinkInterfacePointer _priorityLink; // We always keep a reference to the priority link to manage shutdown ordering
bool _priorityLinkCommanded;
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
// Orbit status values
bool _orbitActive;
QGCMapCircle _orbitMapCircle;
QTimer _orbitTelemetryTimer;
static const int _orbitTelemetryTimeoutMsecs = 3000; // No telemetry for this amount and orbit will go inactive
// PID Tuning telemetry mode
bool _pidTuningTelemetryMode;
bool _pidTuningWaitingForRates;
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;
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
} 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;
VehicleEstimatorStatusFactGroup _estimatorStatusFactGroup;
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* _estimatorStatusFactGroupName;
static const int _vehicleUIUpdateRateMSecs = 100;
static const char* _settingsGroup;
static const char* _joystickEnabledSettingsKey;
friend class VehicleBatteryFactGroup; // Allow VehicleBatteryFactGroup to call _addFactGroup