86#include <QtCore/QDateTime>
87#include <QtCore/QSettings>
91#define UPDATE_TIMER 50
92#define DEFAULT_LAT 38.965767f
93#define DEFAULT_LON -120.083923f
97#define REQUEST_OPERATOR_CONTROL_ALLOW_TAKEOVER_TIMEOUT_MSECS 10000
104 int defaultComponentId,
105 MAV_AUTOPILOT firmwareType,
106 MAV_TYPE vehicleType,
109 , _systemID (vehicleId)
110 , _defaultComponentId (defaultComponentId)
111 , _firmwareType (firmwareType)
112 , _vehicleType (vehicleType)
113 , _defaultCruiseSpeed (
SettingsManager::instance()->appSettings()->offlineEditingCruiseSpeed()->rawValue().toDouble())
114 , _defaultHoverSpeed (
SettingsManager::instance()->appSettings()->offlineEditingHoverSpeed()->rawValue().toDouble())
118 , _orbitMapCircle (std::make_unique<
QGCMapCircle>(this))
119 , _mavlinkStreamConfig (std::make_unique<
MAVLinkStreamConfig>(std::bind(&
Vehicle::_setMessageInterval, this, std::placeholders::_1, std::placeholders::_2)))
120 , _vehicleFactGroup (this)
147 _autopilotPlugin->setParent(
this);
150 connect(&_prearmErrorTimer, &QTimer::timeout,
this, &Vehicle::_prearmErrorTimeout);
151 _prearmErrorTimer.setInterval(_prearmErrorTimeoutMSecs);
152 _prearmErrorTimer.setSingleShot(
true);
167 _sendMultipleTimer.start(_sendMessageMultipleIntraMessageDelay);
168 connect(&_sendMultipleTimer, &QTimer::timeout,
this, &Vehicle::_sendMessageMultipleNext);
170 connect(&_orbitTelemetryTimer, &QTimer::timeout,
this, &Vehicle::_orbitTelemetryTimeout);
173 connect(&_csvLogTimer, &QTimer::timeout,
this, &Vehicle::_writeCsvLine);
174 _csvLogTimer.start(1000);
180 MAV_TYPE vehicleType,
184 , _defaultComponentId (MAV_COMP_ID_ALL)
185 , _offlineEditingVehicle (true)
186 , _firmwareType (firmwareType)
187 , _vehicleType (vehicleType)
188 , _defaultCruiseSpeed (
SettingsManager::instance()->appSettings()->offlineEditingCruiseSpeed()->rawValue().toDouble())
189 , _defaultHoverSpeed (
SettingsManager::instance()->appSettings()->offlineEditingHoverSpeed()->rawValue().toDouble())
190 , _capabilityBitsKnown (true)
191 , _capabilityBits (MAV_PROTOCOL_CAPABILITY_MISSION_FENCE | MAV_PROTOCOL_CAPABILITY_MISSION_RALLY)
195 , _orbitMapCircle (std::make_unique<
QGCMapCircle>(this))
196 , _mavlinkStreamConfig (std::make_unique<
MAVLinkStreamConfig>(std::bind(&
Vehicle::_setMessageInterval, this, std::placeholders::_1, std::placeholders::_2)))
197 , _vehicleFactGroup (this)
204 _commonInit(
nullptr );
292 this, &Vehicle::_gotProgressUpdate);
334 if (!_offlineEditingVehicle) {
338 _createImageProtocolManager();
339 _createStatusTextHandler();
340 _createMAVLinkLogManager();
341 _createSigningController();
342 _createMAVLinkEventManager();
364 QMap<QString, FactGroup*>* fwFactGroups = _firmwarePlugin->
factGroups();
366 for (
auto it = fwFactGroups->keyValueBegin(); it != fwFactGroups->keyValueEnd(); ++it) {
371 _flightTimeUpdater.setInterval(1000);
372 _flightTimeUpdater.setSingleShot(
false);
373 connect(&_flightTimeUpdater, &QTimer::timeout,
this, &Vehicle::_updateFlightTime);
384 _createCameraManager();
389 qCDebug(VehicleLog) <<
"~Vehicle" <<
this;
396 _mavCmdQueue->
stop();
398 _sendMultipleTimer.stop();
399 _sendMultipleTimer.disconnect();
400 _prearmErrorTimer.stop();
401 _prearmErrorTimer.disconnect();
406 delete _autopilotPlugin;
407 _autopilotPlugin =
nullptr;
442void Vehicle::_deleteCameraManager()
446 _cameraManager->disconnect();
447 delete _cameraManager;
448 _cameraManager =
nullptr;
452void Vehicle::_deleteGimbalController()
454 if (_gimbalController) {
456 _gimbalController->disconnect();
463 delete _gimbalController;
464 _gimbalController =
nullptr;
468void Vehicle::_stopCommandProcessing()
470 qCDebug(VehicleLog) <<
"_stopCommandProcessing - stopping timers and clearing pending commands";
476 _mavCmdQueue->
stop();
479 _reqMsgCoord->
stop();
481 _sendMultipleTimer.stop();
482 _sendMultipleTimer.disconnect();
487 _firmwareType =
static_cast<MAV_AUTOPILOT
>(varFirmwareType.toInt());
489 if (_firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA) {
490 _capabilityBits |= MAV_PROTOCOL_CAPABILITY_TERRAIN;
492 _capabilityBits &= ~MAV_PROTOCOL_CAPABILITY_TERRAIN;
500 _vehicleType =
static_cast<MAV_TYPE
>(varVehicleType.toInt());
504void Vehicle::_offlineCruiseSpeedSettingChanged(QVariant value)
506 _defaultCruiseSpeed = value.toDouble();
510void Vehicle::_offlineHoverSpeedSettingChanged(QVariant value)
512 _defaultHoverSpeed = value.toDouble();
523 _messagesReceived = 0;
532 if (message.sysid != _systemID && message.sysid != 0) {
546 if(message.msgid == MAVLINK_MSG_ID_HEARTBEAT) {
548 _compID = message.compid;
549 _messageSeq = message.seq + 1;
552 if(_compID == message.compid) {
553 uint16_t seq_received =
static_cast<uint16_t
>(message.seq);
554 uint16_t packet_lost_count = 0;
556 if(seq_received < _messageSeq) {
557 packet_lost_count = (seq_received + 255) - _messageSeq;
559 packet_lost_count = seq_received - _messageSeq;
561 _messageSeq = message.seq + 1;
562 _messagesLost += packet_lost_count;
563 if(packet_lost_count)
582 _parameterManager->mavlinkMessageReceived(message);
583 (void) QMetaObject::invokeMethod(_imageProtocolManager,
"mavlinkMessageReceived", Qt::AutoConnection, message);
594 factGroup->handleMessage(
this, message);
599 switch (message.msgid) {
600 case MAVLINK_MSG_ID_HOME_POSITION:
601 _handleHomePosition(message);
603 case MAVLINK_MSG_ID_HEARTBEAT:
604 _handleHeartbeat(message);
606 case MAVLINK_MSG_ID_RC_CHANNELS:
607 _handleRCChannels(message);
609 case MAVLINK_MSG_ID_SERVO_OUTPUT_RAW:
611 mavlink_servo_output_raw_t servoOutputRaw;
612 mavlink_msg_servo_output_raw_decode(&message, &servoOutputRaw);
615 const uint16_t rawValues[16] = {
616 servoOutputRaw.servo1_raw,
617 servoOutputRaw.servo2_raw,
618 servoOutputRaw.servo3_raw,
619 servoOutputRaw.servo4_raw,
620 servoOutputRaw.servo5_raw,
621 servoOutputRaw.servo6_raw,
622 servoOutputRaw.servo7_raw,
623 servoOutputRaw.servo8_raw,
624 servoOutputRaw.servo9_raw,
625 servoOutputRaw.servo10_raw,
626 servoOutputRaw.servo11_raw,
627 servoOutputRaw.servo12_raw,
628 servoOutputRaw.servo13_raw,
629 servoOutputRaw.servo14_raw,
630 servoOutputRaw.servo15_raw,
631 servoOutputRaw.servo16_raw
634 for (
int servoIndex = 0; servoIndex <
_servoOutputRawValues.size() && servoIndex < 16; servoIndex++) {
635 _servoOutputRawValues[servoIndex] = (rawValues[servoIndex] == UINT16_MAX) ? -1 : static_cast<int>(rawValues[servoIndex]);
641 case MAVLINK_MSG_ID_BATTERY_STATUS:
642 _handleBatteryStatus(message);
644 case MAVLINK_MSG_ID_SYS_STATUS:
645 _handleSysStatus(message);
647 case MAVLINK_MSG_ID_EXTENDED_SYS_STATE:
648 _handleExtendedSysState(message);
650 case MAVLINK_MSG_ID_COMMAND_ACK:
651 _handleCommandAck(message);
653 case MAVLINK_MSG_ID_LOGGING_DATA:
654 _handleMavlinkLoggingData(message);
656 case MAVLINK_MSG_ID_LOGGING_DATA_ACKED:
657 _handleMavlinkLoggingDataAcked(message);
659 case MAVLINK_MSG_ID_GPS_RAW_INT:
660 _handleGpsRawInt(message);
662 case MAVLINK_MSG_ID_GLOBAL_POSITION_INT:
663 _handleGlobalPositionInt(message);
665 case MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED:
666 _handleCameraImageCaptured(message);
668 case MAVLINK_MSG_ID_ADSB_VEHICLE:
671 case MAVLINK_MSG_ID_HIGH_LATENCY:
672 _handleHighLatency(message);
674 case MAVLINK_MSG_ID_HIGH_LATENCY2:
675 _handleHighLatency2(message);
677 case MAVLINK_MSG_ID_STATUSTEXT:
680 case MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS:
681 _handleOrbitExecutionStatus(message);
683 case MAVLINK_MSG_ID_PING:
684 _handlePing(link, message);
686 case MAVLINK_MSG_ID_OBSTACLE_DISTANCE:
687 _handleObstacleDistance(message);
689 case MAVLINK_MSG_ID_FENCE_STATUS:
690 _handleFenceStatus(message);
693 case MAVLINK_MSG_ID_EVENT:
694 case MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE:
695 case MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR:
696 _handleEventMessage(message);
699 case MAVLINK_MSG_ID_SERIAL_CONTROL:
701 mavlink_serial_control_t ser;
702 mavlink_msg_serial_control_decode(&message, &ser);
703 if (
static_cast<size_t>(ser.count) >
sizeof(ser.data)) {
704 qCWarning(VehicleLog) <<
"Invalid count for SERIAL_CONTROL, discarding." << ser.count;
707 QByteArray(
reinterpret_cast<const char*
>(ser.data), ser.count));
711 case MAVLINK_MSG_ID_AVAILABLE_MODES_MONITOR:
715 mavlink_available_modes_monitor_t availableModesMonitor;
716 mavlink_msg_available_modes_monitor_decode(&message, &availableModesMonitor);
721 case MAVLINK_MSG_ID_CURRENT_MODE:
722 _handleCurrentMode(message);
726 case MAVLINK_MSG_ID_CAMERA_FEEDBACK:
727 _handleCameraFeedback(message);
729 case MAVLINK_MSG_ID_LOG_ENTRY:
731 mavlink_log_entry_t log{};
732 mavlink_msg_log_entry_decode(&message, &log);
733 emit
logEntry(log.time_utc, log.size, log.id, log.num_logs, log.last_log_num);
736 case MAVLINK_MSG_ID_LOG_DATA:
738 mavlink_log_data_t log{};
739 mavlink_msg_log_data_decode(&message, &log);
740 if (
static_cast<size_t>(log.count) >
sizeof(log.data)) {
741 qCWarning(VehicleLog) <<
"Invalid count for LOG_DATA, discarding." << log.count;
743 emit
logData(log.ofs, log.id, log.count, log.data);
747 case MAVLINK_MSG_ID_MESSAGE_INTERVAL:
752 case MAVLINK_MSG_ID_CONTROL_STATUS:
753 _handleControlStatus(message);
755 case MAVLINK_MSG_ID_COMMAND_LONG:
756 _handleCommandLong(message);
769 if (_cameraImageCapturedMessageAvailable) {
773 mavlink_camera_feedback_t feedback;
775 mavlink_msg_camera_feedback_decode(&message, &feedback);
777 QGeoCoordinate imageCoordinate((
double)feedback.lat / qPow(10.0, 7.0), (
double)feedback.lng / qPow(10.0, 7.0), feedback.alt_msl);
778 qCDebug(VehicleLog) <<
"_handleCameraFeedback coord:index" << imageCoordinate << feedback.img_idx;
784 mavlink_orbit_execution_status_t orbitStatus;
786 mavlink_msg_orbit_execution_status_decode(&message, &orbitStatus);
788 double newRadius = qAbs(
static_cast<double>(orbitStatus.radius));
789 if (!
QGC::fuzzyCompare(_orbitMapCircle->radius()->rawValue().toDouble(), newRadius)) {
790 _orbitMapCircle->radius()->setRawValue(newRadius);
793 bool newOrbitClockwise = orbitStatus.radius > 0 ? true :
false;
794 if (_orbitMapCircle->clockwiseRotation() != newOrbitClockwise) {
795 _orbitMapCircle->setClockwiseRotation(newOrbitClockwise);
798 QGeoCoordinate newCenter(
static_cast<double>(orbitStatus.x) / qPow(10.0, 7.0),
static_cast<double>(orbitStatus.y) / qPow(10.0, 7.0));
799 if (_orbitMapCircle->center() != newCenter) {
800 _orbitMapCircle->setCenter(newCenter);
805 _orbitMapCircle->setShowRotation(
true);
809 _orbitTelemetryTimer.start(_orbitTelemetryTimeoutMsecs);
812void Vehicle::_orbitTelemetryTimeout()
814 _orbitActive =
false;
820 mavlink_camera_image_captured_t feedback;
822 mavlink_msg_camera_image_captured_decode(&message, &feedback);
824 if (!_cameraImageCapturedMessageAvailable) {
825 _cameraImageCapturedMessageAvailable =
true;
827 if (_cameraTriggerPoints->count() > 0) {
832 QGeoCoordinate imageCoordinate((
double)feedback.lat / qPow(10.0, 7.0), (
double)feedback.lon / qPow(10.0, 7.0), feedback.alt);
833 qCDebug(VehicleLog) <<
"_handleCameraFeedback coord:index" << imageCoordinate << feedback.image_index << feedback.capture_result;
834 if (feedback.capture_result == 1) {
842 if (message.compid != _defaultComponentId) {
846 mavlink_gps_raw_int_t gpsRawInt;
847 mavlink_msg_gps_raw_int_decode(&message, &gpsRawInt);
849 _gpsRawIntMessageAvailable =
true;
851 if (gpsRawInt.fix_type >= GPS_FIX_TYPE_3D_FIX) {
852 if (!_globalPositionIntMessageAvailable) {
853 QGeoCoordinate newPosition(gpsRawInt.lat / (
double)1E7, gpsRawInt.lon / (
double)1E7, gpsRawInt.alt / 1000.0);
854 if (newPosition != _coordinate) {
855 _coordinate = newPosition;
868 if (message.compid != _defaultComponentId) {
872 mavlink_global_position_int_t globalPositionInt;
873 mavlink_msg_global_position_int_decode(&message, &globalPositionInt);
882 if (globalPositionInt.lat == 0 && globalPositionInt.lon == 0) {
886 _globalPositionIntMessageAvailable =
true;
887 QGeoCoordinate newPosition(globalPositionInt.lat / (
double)1E7, globalPositionInt.lon / (
double)1E7, globalPositionInt.alt / 1000.0);
888 if (newPosition != _coordinate) {
889 _coordinate = newPosition;
897 mavlink_high_latency_t highLatency;
898 mavlink_msg_high_latency_decode(&message, &highLatency);
900 QString previousFlightMode;
901 if (_base_mode != 0 || _custom_mode != 0){
906 _base_mode = MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
913 if (_armed !=
true) {
921 const double altitude;
923 highLatency.latitude / (double)1E7,
924 highLatency.longitude / (
double)1E7,
925 static_cast<double>(highLatency.altitude_amsl)
929 _coordinate.setLongitude(
coordinate.longitude);
945 mavlink_msg_high_latency2_decode(&message, &highLatency2);
947 QString previousFlightMode;
948 if (_base_mode != 0 || _custom_mode != 0){
954 if (highLatency2.autopilot == MAV_AUTOPILOT_ARDUPILOTMEGA) {
955 _base_mode = (uint8_t)highLatency2.custom0;
957 _base_mode = MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
964 if (highLatency2.autopilot == MAV_AUTOPILOT_ARDUPILOTMEGA) {
965 if ((uint8_t)highLatency2.custom0 & MAV_MODE_FLAG_SAFETY_ARMED && _armed !=
true) {
968 }
else if (!((uint8_t)highLatency2.custom0 & MAV_MODE_FLAG_SAFETY_ARMED) && _armed !=
false) {
974 if (_armed !=
true) {
980 _coordinate.setLatitude(highLatency2.latitude / (
double)1E7);
981 _coordinate.setLongitude(highLatency2.longitude / (
double)1E7);
982 _coordinate.setAltitude(highLatency2.altitude);
994 if (newOnboardControlSensorsEnabled != _onboardControlSensorsEnabled) {
995 _onboardControlSensorsEnabled = newOnboardControlSensorsEnabled;
996 _onboardControlSensorsPresent = newOnboardControlSensorsEnabled;
997 _onboardControlSensorsUnhealthy = 0;
1001void Vehicle::_setCapabilities(uint64_t capabilityBits)
1004 _capabilityBitsKnown =
true;
1009 QString doesNotSupport(
"does not support");
1011 qCDebug(VehicleLog) << QString(
"Vehicle %1 Mavlink 2.0").arg(_capabilityBits & MAV_PROTOCOL_CAPABILITY_MAVLINK2 ?
supports : doesNotSupport);
1012 qCDebug(VehicleLog) << QString(
"Vehicle %1 MISSION_ITEM_INT").arg(_capabilityBits & MAV_PROTOCOL_CAPABILITY_MISSION_INT ?
supports : doesNotSupport);
1013 qCDebug(VehicleLog) << QString(
"Vehicle %1 MISSION_COMMAND_INT").arg(_capabilityBits & MAV_PROTOCOL_CAPABILITY_COMMAND_INT ?
supports : doesNotSupport);
1014 qCDebug(VehicleLog) << QString(
"Vehicle %1 GeoFence").arg(_capabilityBits & MAV_PROTOCOL_CAPABILITY_MISSION_FENCE ?
supports : doesNotSupport);
1015 qCDebug(VehicleLog) << QString(
"Vehicle %1 RallyPoints").arg(_capabilityBits & MAV_PROTOCOL_CAPABILITY_MISSION_RALLY ?
supports : doesNotSupport);
1016 qCDebug(VehicleLog) << QString(
"Vehicle %1 Terrain").arg(_capabilityBits & MAV_PROTOCOL_CAPABILITY_TERRAIN ?
supports : doesNotSupport);
1022 uint8_t* pUid = (uint8_t*)(
void*)&_uid;
1023 uid = uid.asprintf(
"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
1037 if (message.compid != _defaultComponentId) {
1041 mavlink_extended_sys_state_t extendedState;
1042 mavlink_msg_extended_sys_state_decode(&message, &extendedState);
1044 switch (extendedState.landed_state) {
1045 case MAV_LANDED_STATE_ON_GROUND:
1049 case MAV_LANDED_STATE_TAKEOFF:
1050 case MAV_LANDED_STATE_IN_AIR:
1054 case MAV_LANDED_STATE_LANDING:
1071bool Vehicle::_apmArmingNotRequired()
1073 const QString armingRequireParam(
"ARMING_REQUIRE");
1077 const Fact*
const armingRequire =
1079 return armingRequire && (armingRequire->
rawValue().toInt() == 0);
1084 if (message.compid != _defaultComponentId) {
1088 mavlink_sys_status_t sysStatus;
1089 mavlink_msg_sys_status_decode(&message, &sysStatus);
1091 _sysStatusSensorInfo->update(sysStatus);
1093 if (sysStatus.onboard_control_sensors_enabled & MAV_SYS_STATUS_PREARM_CHECK) {
1094 if (!_readyToFlyAvailable) {
1095 _readyToFlyAvailable =
true;
1099 bool newReadyToFly = sysStatus.onboard_control_sensors_health & MAV_SYS_STATUS_PREARM_CHECK;
1100 if (newReadyToFly != _readyToFly) {
1101 _readyToFly = newReadyToFly;
1106 bool newAllSensorsHealthy = (sysStatus.onboard_control_sensors_enabled & sysStatus.onboard_control_sensors_health) == sysStatus.onboard_control_sensors_enabled;
1107 if (newAllSensorsHealthy != _allSensorsHealthy) {
1108 _allSensorsHealthy = newAllSensorsHealthy;
1112 if (_onboardControlSensorsPresent != sysStatus.onboard_control_sensors_present) {
1113 _onboardControlSensorsPresent = sysStatus.onboard_control_sensors_present;
1117 if (_onboardControlSensorsEnabled != sysStatus.onboard_control_sensors_enabled) {
1118 _onboardControlSensorsEnabled = sysStatus.onboard_control_sensors_enabled;
1121 if (_onboardControlSensorsHealth != sysStatus.onboard_control_sensors_health) {
1122 _onboardControlSensorsHealth = sysStatus.onboard_control_sensors_health;
1130 _updateArmed(_onboardControlSensorsEnabled & MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS);
1133 uint32_t newSensorsUnhealthy = _onboardControlSensorsEnabled & ~_onboardControlSensorsHealth;
1134 if (newSensorsUnhealthy != _onboardControlSensorsUnhealthy) {
1135 _onboardControlSensorsUnhealthy = newSensorsUnhealthy;
1143 mavlink_msg_battery_status_decode(&message, &batteryStatus);
1149 QString batteryMessage;
1151 switch (batteryStatus.charge_state) {
1152 case MAV_BATTERY_CHARGE_STATE_OK:
1155 case MAV_BATTERY_CHARGE_STATE_LOW:
1158 batteryMessage = tr(
"battery %1 level low");
1161 case MAV_BATTERY_CHARGE_STATE_CRITICAL:
1164 batteryMessage = tr(
"battery %1 level is critical");
1167 case MAV_BATTERY_CHARGE_STATE_EMERGENCY:
1170 batteryMessage = tr(
"battery %1 level emergency");
1173 case MAV_BATTERY_CHARGE_STATE_FAILED:
1176 batteryMessage = tr(
"battery %1 failed");
1179 case MAV_BATTERY_CHARGE_STATE_UNHEALTHY:
1182 batteryMessage = tr(
"battery %1 unhealthy");
1187 if (!batteryMessage.isEmpty()) {
1188 QString batteryIdStr(
"%1");
1190 batteryIdStr = batteryIdStr.arg(batteryStatus.id);
1192 batteryIdStr = batteryIdStr.arg(
"");
1194 _say(tr(
"warning"));
1195 _say(QStringLiteral(
"%1 %2 ").arg(_vehicleIdSpeech()).arg(batteryMessage.arg(batteryIdStr)));
1201 if (homeCoord != _homePosition) {
1202 _homePosition = homeCoord;
1203 qCDebug(VehicleLog) <<
"new home location set at coordinate: " << homeCoord;
1210 if (message.compid != _defaultComponentId) {
1214 mavlink_home_position_t homePos;
1216 mavlink_msg_home_position_decode(&message, &homePos);
1218 QGeoCoordinate newHomePosition (homePos.latitude / 10000000.0,
1219 homePos.longitude / 10000000.0,
1220 homePos.altitude / 1000.0);
1224void Vehicle::_updateArmed(
bool armed)
1226 if (_armed !=
armed) {
1231 _trajectoryPoints->
start();
1232 _flightTimerStart();
1233 _clearCameraTriggerPoints();
1237 _trajectoryPoints->
stop();
1252 qCDebug(VehicleLog) <<
"_handlePing: primary link gone!";
1256 mavlink_ping_t ping;
1259 mavlink_msg_ping_decode(&message, &ping);
1261 if ((ping.target_system == 0) && (ping.target_component == 0)) {
1266 sharedLink->mavlinkChannel(),
1277 const QString &metadataJsonFileName,
1278 const QJsonDocument &metadataJson)
1288 if (message.compid != _defaultComponentId) {
1292 mavlink_heartbeat_t heartbeat;
1294 mavlink_msg_heartbeat_decode(&message, &heartbeat);
1296 bool newArmed = heartbeat.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY;
1302 if (!_apmArmingNotRequired() || !(_onboardControlSensorsPresent & MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS)) {
1304 _updateArmed(newArmed);
1308 _updateArmed(newArmed);
1311 if (heartbeat.base_mode != _base_mode || heartbeat.custom_mode != _custom_mode) {
1312 QString previousFlightMode;
1313 if (_base_mode != 0 || _custom_mode != 0){
1318 _base_mode = heartbeat.base_mode;
1319 _custom_mode = heartbeat.custom_mode;
1328 if (message.compid != _defaultComponentId) {
1332 mavlink_current_mode_t currentMode;
1333 mavlink_msg_current_mode_decode(&message, ¤tMode);
1334 if (currentMode.intended_custom_mode != 0) {
1335 _has_custom_mode_user_intention =
true;
1337 bool changed = _custom_mode_user_intention != currentMode.intended_custom_mode;
1338 _custom_mode_user_intention = currentMode.intended_custom_mode;
1339 if (changed && previousFlightMode !=
flightMode()) {
1347 mavlink_rc_channels_t channels;
1349 mavlink_msg_rc_channels_decode(&message, &channels);
1351 QVector<uint16_t> rawChannelValues({
1361 channels.chan10_raw,
1362 channels.chan11_raw,
1363 channels.chan12_raw,
1364 channels.chan13_raw,
1365 channels.chan14_raw,
1366 channels.chan15_raw,
1367 channels.chan16_raw,
1368 channels.chan17_raw,
1369 channels.chan18_raw,
1373 int validChannelCount = 0;
1374 int firstUnusedChannelIndex = -1;
1375 for (
int i=0; i<rawChannelValues.size(); i++) {
1376 if (rawChannelValues[i] != UINT16_MAX) {
1377 validChannelCount++;
1378 }
else if (firstUnusedChannelIndex == -1) {
1379 firstUnusedChannelIndex = i;
1382 if (firstUnusedChannelIndex != -1 && firstUnusedChannelIndex != validChannelCount) {
1383 qCWarning(VehicleLog) <<
"Non-contiguous RC channels detected. Not publishing data from RC_CHANNELS.";
1387 QVector<int> channelValues(validChannelCount);
1388 QVector<int> clampedValues(validChannelCount);
1389 for (
int channelIndex = 0; channelIndex < validChannelCount; ++channelIndex) {
1390 channelValues[channelIndex] = rawChannelValues[channelIndex];
1391 clampedValues[channelIndex] = std::clamp(channelValues[channelIndex], 1000, 2000);
1404 qCDebug(VehicleLog) <<
"sendMessageOnLinkThreadSafe" << link <<
"not connected!";
1421 uint8_t frameType = 0;
1422 if (_vehicleType == MAV_TYPE_SUBMARINE) {
1423 const QString frameConfigParam = QStringLiteral(
"FRAME_CONFIG");
1424 const Fact*
const frameConfig = _parameterManager->parameterExists(_compID, frameConfigParam)
1425 ? _parameterManager->getParameter(_compID, frameConfigParam)
1428 frameType = frameConfig->
rawValue().toInt();
1430 qCDebug(VehicleLog) << frameConfigParam <<
"not available, using default frame";
1446void Vehicle::_activeVehicleChanged(
Vehicle *newActiveVehicle)
1448 _isActiveVehicle = newActiveVehicle ==
this;
1453 return _homePosition;
1460 MAV_CMD_COMPONENT_ARM_DISARM,
1462 armed ? 1.0f : 0.0f);
1468 MAV_CMD_COMPONENT_ARM_DISARM,
1487 return _firmwarePlugin->
flightMode(_base_mode, _custom_mode);
1490bool Vehicle::setFlightModeCustom(
const QString& flightMode, uint8_t* base_mode, uint32_t* custom_mode)
1498 uint32_t custom_mode;
1500 if (setFlightModeCustom(
flightMode, &base_mode, &custom_mode)) {
1503 qCDebug(VehicleLog) <<
"setFlightMode: primary link gone!";
1507 uint8_t newBaseMode = _base_mode & ~MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE;
1511 newBaseMode |= base_mode;
1515 MAV_CMD_DO_SET_MODE,
1517 MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
1523 sharedLink->mavlinkChannel(),
1531 qCWarning(VehicleLog) <<
"FirmwarePlugin::setFlightMode failed, flightMode:" <<
flightMode;
1536QVariantList Vehicle::links()
const {
1539 for(
const auto &item: _links )
1540 ret << QVariant::fromValue(item);
1550 qCDebug(VehicleLog) <<
"requestDataStream: primary link gone!";
1555 mavlink_request_data_stream_t dataStream;
1557 memset(&dataStream, 0,
sizeof(dataStream));
1559 dataStream.req_stream_id = stream;
1560 dataStream.req_message_rate = rate;
1561 dataStream.start_stop = 1;
1562 dataStream.target_system =
id();
1563 dataStream.target_component = _defaultComponentId;
1567 sharedLink->mavlinkChannel(),
1579void Vehicle::_sendMessageMultipleNext()
1581 if (_nextSendMessageMultipleIndex < _sendMessageMultipleList.count()) {
1582 uint32_t msgId = _sendMessageMultipleList[_nextSendMessageMultipleIndex].message.msgid;
1583 const mavlink_message_info_t* info = mavlink_get_message_info_by_id(msgId);
1584 QString msgName = info ? info->name : QString::number(msgId);
1585 qCDebug(VehicleLog) <<
"_sendMessageMultipleNext:" << msgName;
1592 if (--_sendMessageMultipleList[_nextSendMessageMultipleIndex].retryCount <= 0) {
1593 _sendMessageMultipleList.removeAt(_nextSendMessageMultipleIndex);
1595 _nextSendMessageMultipleIndex++;
1599 if (_nextSendMessageMultipleIndex >= _sendMessageMultipleList.count()) {
1600 _nextSendMessageMultipleIndex = 0;
1606 SendMessageMultipleInfo_t info;
1608 info.message = message;
1609 info.retryCount = _sendMessageMultipleRetries;
1611 _sendMessageMultipleList.append(info);
1614void Vehicle::_missionManagerError(
int errorCode,
const QString& errorMsg)
1616 Q_UNUSED(errorCode);
1620void Vehicle::_geoFenceManagerError(
int errorCode,
const QString& errorMsg)
1622 Q_UNUSED(errorCode);
1626void Vehicle::_rallyPointManagerError(
int errorCode,
const QString& errorMsg)
1628 Q_UNUSED(errorCode);
1632void Vehicle::_clearCameraTriggerPoints()
1634 _cameraImageCapturedMessageAvailable =
false;
1635 _cameraTriggerPoints->clearAndDeleteContents();
1638void Vehicle::_flightTimerStart()
1640 _flightTimer.start();
1641 _flightTimeUpdater.start();
1646void Vehicle::_flightTimerStop()
1648 _flightTimeUpdater.stop();
1651void Vehicle::_updateFlightTime()
1656void Vehicle::_gotProgressUpdate(
float progressValue)
1662 progressValue = 0.f;
1664 _loadProgress = progressValue;
1668void Vehicle::_firstMissionLoadComplete()
1673void Vehicle::_firstGeoFenceLoadComplete()
1678void Vehicle::_firstRallyPointLoadComplete()
1681 _initialPlanRequestComplete =
true;
1685void Vehicle::_parametersReady(
bool parametersReady)
1687 qCDebug(VehicleLog) <<
"_parametersReady" << parametersReady;
1690 _sendQGCTimeToVehicle();
1692 _sendQGCTimeToVehicle();
1693 if (parametersReady) {
1695 _setupAutoDisarmSignalling();
1705void Vehicle::_sendQGCTimeToVehicle()
1709 qCDebug(VehicleLog) <<
"_sendQGCTimeToVehicle: primary link gone!";
1714 mavlink_system_time_t cmd;
1717 cmd.time_unix_usec = QDateTime::currentDateTime().currentMSecsSinceEpoch()*1000;
1719 cmd.time_boot_ms = 0;
1722 sharedLink->mavlinkChannel(),
1734 if (!joystickEnabled) {
1736 static_cast<float>(
roll),
1737 static_cast<float>(
pitch),
1738 static_cast<float>(yaw),
1739 static_cast<float>(thrust),
1741 NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN);
1745void Vehicle::_say(
const QString& text)
1796QString Vehicle::_vehicleIdSpeech()
1799 return tr(
"Vehicle %1 ").arg(
id());
1805void Vehicle::_handleFlightModeChanged(
const QString& flightMode)
1807 if (
flightMode != _lastAnnouncedFlightMode) {
1809 _say(tr(
"%1 %2 flight mode").arg(_vehicleIdSpeech()).arg(
flightMode));
1814void Vehicle::_announceArmedChanged(
bool armed)
1816 _say(QString(
"%1 %2").arg(_vehicleIdSpeech()).arg(
armed ? tr(
"armed") : tr(
"disarmed")));
1819 _armedPosition = _coordinate;
1833void Vehicle::_updateAirborne()
1929 if (!gotoCoord.isValid()) {
1933 if (
coordinate().distanceTo(gotoCoord) > maxDistance) {
1982 static_cast<float>(radius),
1983 static_cast<float>(qQNaN()),
1984 static_cast<float>(ORBIT_YAW_BEHAVIOUR_UNCHANGED),
1985 static_cast<float>(qQNaN()),
1986 centerCoord.latitude(), centerCoord.longitude(),
static_cast<float>(amslAltitude));
1992 static_cast<float>(radius),
1993 static_cast<float>(qQNaN()),
1994 static_cast<float>(ORBIT_YAW_BEHAVIOUR_UNCHANGED),
1995 static_cast<float>(qQNaN()),
1996 static_cast<float>(centerCoord.latitude()),
1997 static_cast<float>(centerCoord.longitude()),
1998 static_cast<float>(amslAltitude));
2004 if (!centerCoord.isValid()) {
2007 if (!_vehicleSupports->
roiMode()) {
2012 if (!qIsFinite(relativeAltitudeMeters)) {
2013 relativeAltitudeMeters = 0;
2016 if (!_firmwarePlugin->
guidedModeROI(
this, centerCoord, relativeAltitudeMeters)) {
2020 if (_roiRelativeAltitudeMeters != relativeAltitudeMeters) {
2021 _roiRelativeAltitudeMeters = relativeAltitudeMeters;
2032 if (!_vehicleSupports->
roiMode()) {
2039 MAV_CMD_DO_SET_ROI_NONE,
2042 static_cast<float>(qQNaN()),
2043 static_cast<float>(qQNaN()),
2044 static_cast<float>(qQNaN()),
2045 static_cast<float>(qQNaN()),
2046 static_cast<double>(qQNaN()),
2047 static_cast<double>(qQNaN()),
2048 static_cast<float>(qQNaN()));
2052 MAV_CMD_DO_SET_ROI_NONE,
2054 static_cast<float>(qQNaN()),
2055 static_cast<float>(qQNaN()),
2056 static_cast<float>(qQNaN()),
2057 static_cast<float>(qQNaN()),
2058 static_cast<float>(qQNaN()),
2059 static_cast<float>(qQNaN()),
2060 static_cast<float>(qQNaN()));
2087 MAV_CMD_DO_GO_AROUND,
2089 static_cast<float>(climbOutAltitude));
2111 _defaultComponentId,
2112 MAV_CMD_COMPONENT_ARM_DISARM,
2122 MAV_CMD_AIRFRAME_CONFIGURATION,
2132 MAV_CMD_AIRFRAME_CONFIGURATION,
2149 qCDebug(VehicleLog) <<
"setCurrentMissionSequence: primary link gone!";
2156 mavlink_msg_mission_set_current_pack_chan(
2159 sharedLink->mavlinkChannel(),
2161 static_cast<uint8_t
>(
id()),
2163 static_cast<uint16_t
>(seq));
2167 MAV_CMD_DO_SET_MISSION_CURRENT,
2169 static_cast<uint16_t
>(seq)
2173void Vehicle::sendMavCommand(
int compId, MAV_CMD command,
bool showError,
float param1,
float param2,
float param3,
float param4,
float param5,
float param6,
float param7)
2175 _mavCmdQueue->
sendCommand(
compId, command, showError, param1, param2, param3, param4, param5, param6, param7);
2178void Vehicle::sendMavCommandDelayed(
int compId, MAV_CMD command,
bool showError,
int milliseconds,
float param1,
float param2,
float param3,
float param4,
float param5,
float param6,
float param7)
2180 _mavCmdQueue->
sendCommandDelayed(
compId, command, showError, milliseconds, param1, param2, param3, param4, param5, param6, param7);
2183void Vehicle::sendCommand(
int compId,
int command,
bool showError,
double param1,
double param2,
double param3,
double param4,
double param5,
double param6,
double param7)
2186 compId,
static_cast<MAV_CMD
>(command),
2188 static_cast<float>(param1),
2189 static_cast<float>(param2),
2190 static_cast<float>(param3),
2191 static_cast<float>(param4),
2192 static_cast<float>(param5),
2193 static_cast<float>(param6),
2194 static_cast<float>(param7));
2202void Vehicle::sendMavCommandInt(
int compId, MAV_CMD command, MAV_FRAME frame,
bool showError,
float param1,
float param2,
float param3,
float param4,
double param5,
double param6,
float param7)
2204 _mavCmdQueue->
sendCommandInt(
compId, command, frame, showError, param1, param2, param3, param4, param5, param6, param7);
2207void Vehicle::sendMavCommandIntWithHandler(
const MavCmdAckHandlerInfo_t* ackHandlerInfo,
int compId, MAV_CMD command, MAV_FRAME frame,
float param1,
float param2,
float param3,
float param4,
double param5,
double param6,
float param7)
2209 _mavCmdQueue->
sendCommandIntWithHandler(ackHandlerInfo,
compId, command, frame, param1, param2, param3, param4, param5, param6, param7);
2212void Vehicle::sendMavCommandWithLambdaFallback(std::function<
void()> lambda,
int compId, MAV_CMD command,
bool showError,
float param1,
float param2,
float param3,
float param4,
float param5,
float param6,
float param7)
2214 _mavCmdQueue->
sendCommandWithLambdaFallback(std::move(lambda),
compId, command, showError, param1, param2, param3, param4, param5, param6, param7);
2217void Vehicle::sendMavCommandIntWithLambdaFallback(std::function<
void()> lambda,
int compId, MAV_CMD command, MAV_FRAME frame,
bool showError,
float param1,
float param2,
float param3,
float param4,
double param5,
double param6,
float param7)
2219 _mavCmdQueue->
sendCommandIntWithLambdaFallback(std::move(lambda),
compId, command, frame, showError, param1, param2, param3, param4, param5, param6, param7);
2224 return _mavCmdQueue->
isPending(targetCompId, command);
2240 mavlink_msg_command_ack_decode(&message, &ack);
2243 QString logMsg = QStringLiteral(
"_handleCommandAck command(%1) result(%2)").arg(rawCommandName).arg(
QGCMAVLink::mavResultToString(
static_cast<MAV_RESULT
>(ack.result)));
2246 if (ack.command == MAV_CMD_REQUEST_MESSAGE) {
2247 const int entryIndex = _mavCmdQueue->
findEntryIndex(message.compid,
static_cast<MAV_CMD
>(ack.command));
2248 if (entryIndex != -1) {
2251 logMsg += QStringLiteral(
" (entry=%1)").arg(entryIndex);
2255 qCDebug(VehicleLog) << logMsg;
2258 if (ack.command == MAV_CMD_DO_SET_ROI_LOCATION && ack.result == MAV_RESULT_ACCEPTED) {
2259 _isROIEnabled =
true;
2262 if (ack.command == MAV_CMD_DO_SET_ROI_NONE && ack.result == MAV_RESULT_ACCEPTED) {
2263 _isROIEnabled =
false;
2266 if (ack.command == MAV_CMD_PREFLIGHT_STORAGE) {
2269 if (ack.command == MAV_CMD_FLASH_BOOTLOADER && ack.result == MAV_RESULT_ACCEPTED) {
2277 if (ack.command == MAV_CMD_SET_MESSAGE_INTERVAL) {
2278 _mavlinkStreamConfig->gotSetMessageIntervalAck();
2282void Vehicle::requestMessage(RequestMessageResultHandler resultHandler,
void* resultHandlerData,
int compId,
int messageId,
float param1,
float param2,
float param3,
float param4,
float param5)
2284 _reqMsgCoord->
requestMessage(resultHandler, resultHandlerData,
compId, messageId, param1, param2, param3, param4, param5);
2292 if (!_prearmError.isEmpty()) {
2293 _prearmErrorTimer.start();
2297void Vehicle::_prearmErrorTimeout()
2304 _firmwareMajorVersion = majorVersion;
2305 _firmwareMinorVersion = minorVersion;
2306 _firmwarePatchVersion = patchVersion;
2307 _firmwareVersionType = versionType;
2313 _firmwareCustomMajorVersion = majorVersion;
2314 _firmwareCustomMinorVersion = minorVersion;
2315 _firmwareCustomPatchVersion = patchVersion;
2324void Vehicle::_rebootCommandResultHandler(
void* resultHandlerData,
int ,
const mavlink_command_ack_t& ack, MavCmdResultFailureCode_t failureCode)
2328 if (ack.result != MAV_RESULT_ACCEPTED) {
2329 switch (failureCode) {
2331 qCDebug(VehicleLog) << QStringLiteral(
"MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN error(%1)").arg(ack.result);
2334 qCDebug(VehicleLog) <<
"MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN failed: no response from vehicle";
2337 qCDebug(VehicleLog) <<
"MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN failed: duplicate command";
2357 if (_rebootRequired) {
2361 _rebootRequired =
true;
2367 if (_newStableFirmwareVersion == version) {
2371 _newStableFirmwareVersion = version;
2372 _newStableFirmwareVersionAcknowledged = _isNewStableFirmwareVersionAcknowledged();
2378 if (_newStableFirmwareVersion.isEmpty() || _newStableFirmwareVersionAcknowledged) {
2382 QSettings().setValue(_acknowledgedStableFirmwareSettingsKey(), _newStableFirmwareVersion);
2386 for (
int i = 0; i < vehicles->
count(); i++) {
2388 if (vehicle && !vehicle->_newStableFirmwareVersionAcknowledged &&
2389 vehicle->_isNewStableFirmwareVersionAcknowledged()) {
2390 vehicle->_newStableFirmwareVersionAcknowledged =
true;
2396bool Vehicle::_isNewStableFirmwareVersionAcknowledged()
const
2398 const QString acknowledgedVersion = QSettings().value(_acknowledgedStableFirmwareSettingsKey()).toString();
2399 return !_newStableFirmwareVersion.isEmpty() &&
2403QString Vehicle::_acknowledgedStableFirmwareSettingsKey()
const
2412 qCDebug(VehicleLog) <<
"startCalibration: primary link gone!";
2478 sharedLink->mavlinkChannel(),
2482 MAV_CMD_PREFLIGHT_CALIBRATION,
2484 param1, param2, param3, param4, param5, param6, param7);
2491 MAV_CMD_PREFLIGHT_CALIBRATION,
2512 sendMavCommand(_defaultComponentId, MAV_CMD_DO_MOTOR_TEST, showError, motor, MOTOR_TEST_THROTTLE_PERCENT, percent, timeoutSecs, 0, MOTOR_TEST_ORDER_BOARD);
2517 if (_offlineEditingVehicle) {
2520 qCWarning(VehicleLog) <<
"Call to Vehicle::setOfflineEditingDefaultComponentId on vehicle which is not offline";
2528 MAV_CMD_DO_VTOL_TRANSITION,
2537 sendMavCommand(_defaultComponentId, MAV_CMD_LOGGING_START,
false );
2542 sendMavCommand(_defaultComponentId, MAV_CMD_LOGGING_STOP,
false );
2545void Vehicle::_ackMavlinkLogData(uint16_t sequence)
2549 qCDebug(VehicleLog) <<
"_ackMavlinkLogData: primary link gone!";
2554 mavlink_logging_ack_t ack;
2556 memset(&ack, 0,
sizeof(ack));
2558 ack.target_component = _defaultComponentId;
2559 ack.target_system =
id();
2560 mavlink_msg_logging_ack_encode_chan(
2563 sharedLink->mavlinkChannel(),
2571 mavlink_logging_data_t log;
2572 mavlink_msg_logging_data_decode(&message, &log);
2573 if (
static_cast<size_t>(log.length) >
sizeof(log.data)) {
2574 qWarning() <<
"Invalid length for LOGGING_DATA, discarding." << log.length;
2576 emit
mavlinkLogData(
this, log.target_system, log.target_component, log.sequence,
2577 log.first_message_offset, QByteArray((
const char*)log.data, log.length),
false);
2583 mavlink_logging_data_acked_t log;
2584 mavlink_msg_logging_data_acked_decode(&message, &log);
2585 _ackMavlinkLogData(log.sequence);
2586 if (
static_cast<size_t>(log.length) >
sizeof(log.data)) {
2587 qWarning() <<
"Invalid length for LOGGING_DATA_ACKED, discarding." << log.length;
2589 emit
mavlinkLogData(
this, log.target_system, log.target_component, log.sequence,
2590 log.first_message_offset, QByteArray((
const char*)log.data, log.length),
false);
2663 if(_firmwarePlugin) {
2666 static QVariantList emptyList;
2670void Vehicle::_setupAutoDisarmSignalling()
2687 return fact->
rawValue().toDouble() > 0;
2693void Vehicle::_updateDistanceHeadingHome()
2711void Vehicle::_updateHeadingToNextWP()
2716 if(llist.size()>currentIndex && currentIndex!=-1
2717 && llist[currentIndex]->coordinate().longitude()!=0.0
2727void Vehicle::_updateMissionItemIndex()
2731 unsigned offset = 0;
2739void Vehicle::_updateDistanceHeadingGCS()
2742 if (
coordinate().isValid() && gcsPosition.isValid()) {
2751void Vehicle::_updateHomepoint()
2755 if(setHomeCmdSupported && updateHomeActivated){
2757 if (
coordinate().isValid() && gcsPosition.isValid()) {
2759 MAV_CMD_DO_SET_HOME,
false,
2762 static_cast<float>(gcsPosition.latitude()) ,
2763 static_cast<float>(gcsPosition.longitude()),
2764 static_cast<float>(gcsPosition.altitude()));
2769void Vehicle::_updateHobbsMeter()
2776 _initialPlanRequestComplete =
true;
2790void Vehicle::_vehicleParamLoaded(
bool ready)
2799void Vehicle::_mavlinkMessageStatus(
int uasId, uint64_t totalSent, uint64_t totalReceived, uint64_t totalLoss,
float lossPercent)
2801 if(uasId == _systemID) {
2802 _mavlinkSentCount = totalSent;
2803 _mavlinkReceivedCount = totalReceived;
2804 _mavlinkLossCount = totalLoss;
2805 _mavlinkLossPercent = lossPercent;
2817 return _firmwarePlugin->
versionCompare(
this, major, minor, patch);
2830 _mavlinkStreamConfig->restoreDefaults();
2833 _mavlinkStreamConfig->setHighRateRateAndAttitude();
2836 _mavlinkStreamConfig->setHighRateVelAndPos();
2839 _mavlinkStreamConfig->setHighRateAltAirspeed();
2850void Vehicle::_setMessageInterval(
int messageId,
int rate)
2853 MAV_CMD_SET_MESSAGE_INTERVAL,
2859QString Vehicle::_formatMavCommand(MAV_CMD command,
float param1)
2863 if (command == MAV_CMD_REQUEST_MESSAGE && param1 > 0) {
2864 const mavlink_message_info_t* info = mavlink_get_message_info_by_id(
static_cast<uint32_t
>(param1));
2865 QString param1Str = info ? QString(
"%1(%2)").arg(param1).arg(info->name) : QString::number(param1);
2866 return QString(
"%1: %2").arg(commandName).arg(param1Str);
2868 return QString(
"%1: %2").arg(commandName).arg(param1);
2876void Vehicle::_initializeCsv()
2881 QString now = QDateTime::currentDateTime().toString(
"yyyy-MM-dd hh-mm-ss");
2882 QString fileName = QString(
"%1 vehicle%2.csv").arg(now).arg(_systemID);
2884 _csvLogFile.setFileName(saveDir.absoluteFilePath(fileName));
2886 if (!_csvLogFile.open(QIODevice::Append)) {
2887 qCWarning(VehicleLog) <<
"unable to open file for csv logging, Stopping csv logging!";
2891 QTextStream stream(&_csvLogFile);
2892 QStringList allFactNames;
2896 allFactNames << QString(
"%1.%2").arg(groupName, factName);
2899 qCDebug(VehicleLog) <<
"Facts logged to csv:" << allFactNames;
2900 stream <<
"Timestamp," << allFactNames.join(
",") <<
"\n";
2903void Vehicle::_writeCsvLine()
2906 if(!_csvLogFile.isOpen() &&
2911 if(!_csvLogFile.isOpen()){
2915 QStringList allFactValues;
2916 QTextStream stream(&_csvLogFile);
2919 allFactValues << QDateTime::currentDateTime().toString(QStringLiteral(
"yyyy-MM-dd hh:mm:ss.zzz"));
2921 for (
const QString& factName :
factNames()) {
2931 stream << allFactValues.join(
",") <<
"\n";
2942 mavlink_msg_obstacle_distance_decode(&message, &o);
2943 _objectAvoidance->
update(&o);
2948 mavlink_fence_status_t fenceStatus;
2950 mavlink_msg_fence_status_decode(&message, &fenceStatus);
2952 qCDebug(VehicleLog) <<
"_handleFenceStatus breach_status" << fenceStatus.breach_status;
2954 static qint64 lastUpdate = 0;
2955 qint64 now = QDateTime::currentMSecsSinceEpoch();
2956 if (fenceStatus.breach_status == 1) {
2957 if (now - lastUpdate > 3000) {
2959 QString breachTypeStr;
2960 switch (fenceStatus.breach_type) {
2961 case FENCE_BREACH_NONE:
2963 case FENCE_BREACH_MINALT:
2964 breachTypeStr = tr(
"minimum altitude");
2966 case FENCE_BREACH_MAXALT:
2967 breachTypeStr = tr(
"maximum altitude");
2969 case FENCE_BREACH_BOUNDARY:
2970 breachTypeStr = tr(
"boundary");
2976 _say(breachTypeStr +
" " + tr(
"fence breached"));
2988void Vehicle::sendParamMapRC(
const QString& paramName,
double scale,
double centerValue,
int tuningID,
double minValue,
double maxValue)
2992 qCDebug(VehicleLog) <<
"sendParamMapRC: primary link gone!";
2998 char param_id_cstr[MAVLINK_MSG_PARAM_MAP_RC_FIELD_PARAM_ID_LEN] = {};
3000 for (
unsigned int i = 0; i <
sizeof(param_id_cstr); i++) {
3001 if ((
int)i < paramName.length()) {
3002 param_id_cstr[i] = paramName.toLatin1()[i];
3008 sharedLink->mavlinkChannel(),
3011 MAV_COMP_ID_AUTOPILOT1,
3014 static_cast<uint8_t
>(tuningID),
3015 static_cast<float>(centerValue),
3016 static_cast<float>(scale),
3017 static_cast<float>(minValue),
3018 static_cast<float>(maxValue));
3026 qCDebug(VehicleLog)<<
"clearAllParamMapRC: primary link gone!";
3030 char param_id_cstr[MAVLINK_MSG_PARAM_MAP_RC_FIELD_PARAM_ID_LEN] = {};
3032 for (
int i = 0; i < 3; i++) {
3036 sharedLink->mavlinkChannel(),
3039 MAV_COMP_ID_AUTOPILOT1,
3048void Vehicle::sendJoystickDataThreadSafe(
float roll,
float pitch,
float yaw,
float thrust, quint16 buttons, quint16 buttons2,
float pitchExtension,
float rollExtension,
float aux1,
float aux2,
float aux3,
float aux4,
float aux5,
float aux6)
3052 qCDebug(VehicleLog)<<
"sendJoystickDataThreadSafe: primary link gone!";
3056 if (sharedLink->linkConfiguration()->isHighLatency()) {
3062 float axesScaling = 1.0 * 1000.0;
3063 uint8_t extensions = 0;
3066 float newRollCommand =
roll * axesScaling;
3067 float newPitchCommand =
pitch * axesScaling;
3068 float newYawCommand = yaw * axesScaling;
3069 float newThrustCommand = thrust * axesScaling;
3072 float incomingExtensionValues[] = { pitchExtension, rollExtension, aux1, aux2, aux3, aux4, aux5, aux6 };
3073 int16_t outgoingExtensionValues[std::size(incomingExtensionValues)];
3074 for (
size_t i = 0; i < std::size(incomingExtensionValues); i++) {
3075 int16_t scaledValue = 0;
3076 if (!qIsNaN(incomingExtensionValues[i])) {
3077 scaledValue =
static_cast<int16_t
>(incomingExtensionValues[i] * axesScaling);
3078 extensions |= (1 << i);
3080 outgoingExtensionValues[i] = scaledValue;
3082 mavlink_msg_manual_control_pack_chan(
3085 sharedLink->mavlinkChannel(),
3087 static_cast<uint8_t
>(_systemID),
3088 static_cast<int16_t
>(newPitchCommand),
3089 static_cast<int16_t
>(newRollCommand),
3090 static_cast<int16_t
>(newThrustCommand),
3091 static_cast<int16_t
>(newYawCommand),
3094 outgoingExtensionValues[0],
3095 outgoingExtensionValues[1],
3096 outgoingExtensionValues[2],
3097 outgoingExtensionValues[3],
3098 outgoingExtensionValues[4],
3099 outgoingExtensionValues[5],
3100 outgoingExtensionValues[6],
3101 outgoingExtensionValues[7]
3112 qCDebug(VehicleLog) <<
"sendJoystickAuxRcOverrideThreadSafe: primary link gone!";
3116 if (sharedLink->linkConfiguration()->isHighLatency()) {
3120 bool anyEnabledChannel =
false;
3121 for (
bool enabled : channelEnabled) {
3123 anyEnabledChannel =
true;
3128 if (!useRcOverride || !anyEnabledChannel) {
3130 bool expected =
true;
3131 if (!_joystickAuxRcOverrideActive.compare_exchange_strong(expected,
false)) {
3136 mavlink_msg_rc_channels_override_pack_chan(
3139 sharedLink->mavlinkChannel(),
3141 static_cast<uint8_t
>(_systemID),
3142 static_cast<uint8_t
>(_defaultComponentId),
3151 static_cast<uint16_t
>(UINT16_MAX - 1),
3152 static_cast<uint16_t
>(UINT16_MAX - 1),
3166 mavlink_msg_rc_channels_override_pack_chan(
3169 sharedLink->mavlinkChannel(),
3171 static_cast<uint8_t
>(_systemID),
3172 static_cast<uint8_t
>(_defaultComponentId),
3177 channelEnabled[0] ? channelValues[0] :
static_cast<uint16_t
>(0),
3178 channelEnabled[1] ? channelValues[1] :
static_cast<uint16_t
>(0),
3179 channelEnabled[2] ? channelValues[2] :
static_cast<uint16_t
>(0),
3180 channelEnabled[3] ? channelValues[3] :
static_cast<uint16_t
>(0),
3181 channelEnabled[4] ? channelValues[4] :
static_cast<uint16_t
>(UINT16_MAX - 1),
3182 channelEnabled[5] ? channelValues[5] :
static_cast<uint16_t
>(UINT16_MAX - 1),
3192 _joystickAuxRcOverrideActive =
true;
3198 MAV_CMD_DO_DIGICAM_CONTROL,
3207 _defaultComponentId,
3218 [
this, centerCoord]() {
3222 MAV_CMD_DO_SET_GLOBAL_ORIGIN,
3225 0.0f, 0.0f, 0.0f, 0.0f,
3226 centerCoord.latitude(),
3227 centerCoord.longitude(),
3228 static_cast<float>(centerCoord.altitude())
3236 qCDebug(VehicleLog) <<
"setEstimatorOrigin: primary link gone!";
3241 mavlink_msg_set_gps_global_origin_pack_chan(
3244 sharedLink->mavlinkChannel(),
3247 centerCoord.latitude() * 1e7,
3248 centerCoord.longitude() * 1e7,
3249 centerCoord.altitude() * 1e3,
3250 static_cast<float>(qQNaN())
3258 MAV_CMD_START_RX_PAIR,
3266 _timerRevertAllowTakeover.stop();
3267 _timerRevertAllowTakeover.setSingleShot(
true);
3268 _timerRevertAllowTakeover.setInterval(operatorControlTakeoverTimeoutMsecs());
3270 disconnect(&_timerRevertAllowTakeover, &QTimer::timeout,
nullptr,
nullptr);
3272 connect(&_timerRevertAllowTakeover, &QTimer::timeout,
this, [
this](){
3277 _timerRevertAllowTakeover.start();
3282 int safeRequestTimeoutSecs;
3285 if (requestTimeoutSecs >= requestTimeoutSecsMin && requestTimeoutSecs <= requestTimeoutSecsMax) {
3286 safeRequestTimeoutSecs = requestTimeoutSecs;
3292 const MavCmdAckHandlerInfo_t handlerInfo = {&Vehicle::_requestOperatorControlAckHandler,
this,
nullptr,
nullptr};
3295 _defaultComponentId,
3296 MAV_CMD_REQUEST_OPERATOR_CONTROL,
3299 allowOverride ? 1 : 0,
3300 safeRequestTimeoutSecs
3304 if (requestTimeoutSecs > 0) {
3305 requestOperatorControlStartTimer(requestTimeoutSecs * 1000);
3309void Vehicle::_requestOperatorControlAckHandler(
void* resultHandlerData,
int compId,
const mavlink_command_ack_t& ack, MavCmdResultFailureCode_t failureCode)
3315 switch (failureCode) {
3331 if (ack.result == MAV_RESULT_ACCEPTED) {
3332 qCDebug(VehicleLog) <<
"Operator control request accepted";
3334 qCDebug(VehicleLog) <<
"Operator control request rejected";
3338void Vehicle::requestOperatorControlStartTimer(
int requestTimeoutMsecs)
3341 _sendControlRequestAllowed =
false;
3344 _timerRequestOperatorControl.stop();
3345 _timerRequestOperatorControl.setSingleShot(
true);
3346 _timerRequestOperatorControl.setInterval(requestTimeoutMsecs);
3348 disconnect(&_timerRequestOperatorControl, &QTimer::timeout,
nullptr,
nullptr);
3349 connect(&_timerRequestOperatorControl, &QTimer::timeout,
this, [
this](){
3350 _sendControlRequestAllowed =
true;
3353 _timerRequestOperatorControl.start();
3358 mavlink_control_status_t controlStatus;
3359 mavlink_msg_control_status_decode(&message, &controlStatus);
3361 bool updateControlStatusSignals =
false;
3362 if (_gcsControlStatusFlags != controlStatus.flags) {
3363 _gcsControlStatusFlags = controlStatus.flags;
3364 _gcsControlStatusFlags_SystemManager = controlStatus.flags & GCS_CONTROL_STATUS_FLAGS_SYSTEM_MANAGER;
3365 _gcsControlStatusFlags_TakeoverAllowed = controlStatus.flags & GCS_CONTROL_STATUS_FLAGS_TAKEOVER_ALLOWED;
3366 updateControlStatusSignals =
true;
3369 if (_gcsMain != controlStatus.gcs_main) {
3370 _gcsMain = controlStatus.gcs_main;
3371 updateControlStatusSignals =
true;
3374 if (!_firstControlStatusReceived) {
3375 _firstControlStatusReceived =
true;
3376 updateControlStatusSignals =
true;
3379 if (updateControlStatusSignals) {
3385 if (!sendControlRequestAllowed() && _gcsControlStatusFlags_TakeoverAllowed) {
3386 disconnect(&_timerRequestOperatorControl, &QTimer::timeout,
nullptr,
nullptr);
3387 _sendControlRequestAllowed =
true;
3400 mavlink_msg_command_long_decode(&message, &commandLong);
3405 if (commandLong.command == MAV_CMD_REQUEST_OPERATOR_CONTROL) {
3406 _handleCommandRequestOperatorControl(commandLong);
3410int Vehicle::operatorControlTakeoverTimeoutMsecs()
const
3449 MAV_CMD_FLASH_BOOTLOADER,
3461 MAV_CMD_DO_AUX_FUNCTION,
3464 enable ? MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_HIGH : MAV_CMD_DO_AUX_FUNCTION_SWITCH_LEVEL_LOW);
3484void Vehicle::_createStatusTextHandler()
3494void Vehicle::_onStatusTextFromEvent(uint8_t compid,
int severity,
const QString &text,
const QString &description)
3497 static_cast<MAV_SEVERITY
>(severity), text, description);
3500void Vehicle::_textMessageReceived(MAV_COMPONENT componentid, MAV_SEVERITY severity, QString text, QString description)
3504 qCDebug(VehicleLog) <<
"Dropping message (expected as event):" << text;
3508 bool skipSpoken =
false;
3509 const bool ardupilotPrearm = text.startsWith(QStringLiteral(
"PreArm"));
3510 const bool px4Prearm = text.startsWith(QStringLiteral(
"preflight"), Qt::CaseInsensitive) && (severity >= MAV_SEVERITY::MAV_SEVERITY_CRITICAL);
3511 if (ardupilotPrearm || px4Prearm) {
3512 if (_healthAndArmingChecksSupported(componentid)) {
3513 qCDebug(VehicleLog) <<
"Dropping preflight message (expected as event):" << text;
3518 if (_noisySpokenPrearmMap.contains(text) && _noisySpokenPrearmMap.value(text).msecsTo(QTime::currentTime()) < (10 * 1000)) {
3521 (void) _noisySpokenPrearmMap.insert(text, QTime::currentTime());
3526 bool readAloud =
false;
3528 if (text.startsWith(
"#")) {
3529 (void) text.remove(0, 1);
3531 }
else if (severity <= MAV_SEVERITY::MAV_SEVERITY_NOTICE) {
3535 if (readAloud && !skipSpoken) {
3543void Vehicle::_errorMessageReceived(QString message)
3545 QString vehicleIdPrefix;
3548 vehicleIdPrefix = tr(
"Vehicle %1: ").arg(
id());
3558void Vehicle::_createSigningController()
3568void Vehicle::_createImageProtocolManager()
3573 qgcApp()->qgcImageProvider()->setImage(image, _systemID);
3579 return (_imageProtocolManager ? _imageProtocolManager->
flowImageIndex() : 0);
3587void Vehicle::_createMAVLinkLogManager()
3594 return _mavlinkLogManager;
3602void Vehicle::_createCameraManager()
3604 if (!_cameraManager && _firmwarePlugin) {
3612 if (_cameraManager) {
3616 static QVariantList emptyCameraList;
3617 return emptyCameraList;
3625void Vehicle::_createMAVLinkEventManager()
3627 _eventManager = std::make_unique<MAVLinkEventManager>(
this);
3634 _eventManager->handleEventMessage(msg);
3637bool Vehicle::_healthAndArmingChecksSupported(uint8_t compid)
3639 return _eventManager->healthAndArmingChecksSupported(compid);
3644 return _eventManager->healthAndArmingCheckReport();
3649 _eventManager->setMetadata(compid, metadataJsonFileName);
3651 sendMavCommand(_defaultComponentId, MAV_CMD_RUN_PREARM_CHECKS,
false);
static const QString guided_mode_not_supported_by_vehicle
std::shared_ptr< LinkInterface > SharedLinkInterfacePtr
struct __mavlink_message mavlink_message_t
#define QGC_LOGGING_CATEGORY(name, categoryStr)
struct __mavlink_command_ack_t mavlink_command_ack_t
struct __mavlink_high_latency2_t mavlink_high_latency2_t
struct __mavlink_command_long_t mavlink_command_long_t
struct __mavlink_battery_status_t mavlink_battery_status_t
struct __mavlink_obstacle_distance_t mavlink_obstacle_distance_t
#define REQUEST_OPERATOR_CONTROL_ALLOW_TAKEOVER_TIMEOUT_MSECS
const QString guided_mode_not_supported_by_vehicle
void mavlinkMessageReceived(const mavlink_message_t &message)
static ADSBVehicleManager * instance()
void load(const QString &json_file, const QJsonDocument &metadata)
void say(const QString &text, TextMods textMods=TextMod::None)
static AudioOutput * instance()
void handleMessageForFactGroupCreation(Vehicle *vehicle, const mavlink_message_t &message)
Allows for creation/updating of dynamic FactGroups based on incoming messages.
Used to group Facts together into an object hierarachy.
const QMap< QString, FactGroup * > & factGroups() const
Q_INVOKABLE Fact * getFact(const QString &name) const
QStringList factNames() const
void _addFactGroup(FactGroup *factGroup, const QString &name)
Q_INVOKABLE FactGroup * getFactGroup(const QString &name) const
QStringList factGroupNames() const
Q_INVOKABLE void setLiveUpdates(bool liveUpdates)
Turning on live updates will allow value changes to flow through as they are received.
A Fact is used to hold a single value within the system.
FactMetaData * metaData()
void rawValueChanged(const QVariant &value)
void setRawValue(const QVariant &value)
QString cookedValueString() const
QVariant rawValue() const
FirmwarePlugin * firmwarePluginForAutopilot(MAV_AUTOPILOT firmwareType, MAV_TYPE vehicleType)
static FirmwarePluginManager * instance()
virtual QString motorDetectionFlightMode() const
Returns the flight mode for Motor Detection.
virtual QString pauseFlightMode() const
Returns The flight mode which indicates the vehicle is paused.
virtual void guidedModeChangeEquivalentAirspeedMetersSecond(Vehicle *vehicle, double airspeed_equiv) const
virtual void guidedModeChangeAltitude(Vehicle *vehicle, double altitudeChange, bool pauseVehicle)
virtual void startMission(Vehicle *vehicle) const
Command the vehicle to start the mission.
virtual bool multiRotorCoaxialMotors(Vehicle *) const
virtual double minimumEquivalentAirspeed(Vehicle *) const
virtual const QVariantList & toolIndicators(const Vehicle *vehicle)
virtual void guidedModeChangeGroundSpeedMetersSecond(Vehicle *vehicle, double groundspeed) const
virtual bool setFlightMode(const QString &flightMode, uint8_t *base_mode, uint32_t *custom_mode) const
@ SetFlightModeCapability
FirmwarePlugin::setFlightMode method is supported.
virtual QString vehicleImageOutline(const Vehicle *) const
Return the resource file which contains the vehicle icon used in the flight view when the view is lig...
virtual void guidedModeTakeoff(Vehicle *vehicle, double takeoffAltRel) const
Command vehicle to takeoff from current location to the specified height.
virtual bool isCapable(const Vehicle *, FirmwareCapabilities) const
virtual double maximumEquivalentAirspeed(Vehicle *) const
virtual QString missionFlightMode() const
Returns the flight mode for running missions.
virtual void adjustMetaData(MAV_TYPE, FactMetaData *)
virtual bool adjustIncomingMavlinkMessage(Vehicle *, mavlink_message_t *)
virtual bool fixedWingAirSpeedLimitsAvailable(Vehicle *) const
virtual void guidedModeChangeHeading(Vehicle *vehicle, const QGeoCoordinate &headingCoord) const
Command vehicle to rotate towards specified location.
virtual QString smartRTLFlightMode() const
Returns the flight mode for Smart RTL.
virtual bool guidedModeGotoLocation(Vehicle *vehicle, const QGeoCoordinate &gotoCoord, double forwardFlightLoiterRadius=0.0) const
virtual bool multiRotorXConfig(Vehicle *) const
static QString stableFirmwareSettingsKey(const Vehicle *vehicle)
Settings key identifying the stable firmware stream (firmware + vehicle class) for this vehicle.
virtual QString takeControlFlightMode() const
Returns the flight mode to use when the operator wants to take back control from autonomouse flight.
virtual QString flightMode(uint8_t base_mode, uint32_t custom_mode) const
virtual QString vehicleImageOpaque(const Vehicle *) const
Return the resource file which contains the vehicle icon used in the flight view when the view is dar...
virtual void startTakeoff(Vehicle *vehicle) const
Command the vehicle to start a takeoff.
virtual void pauseVehicle(Vehicle *vehicle) const
virtual QVariant expandedToolbarIndicatorSource(const Vehicle *, const QString &) const
virtual bool mulirotorSpeedLimitsAvailable(Vehicle *) const
int versionCompare(const Vehicle *vehicle, const QString &compare) const
virtual bool hasGripper(const Vehicle *) const
virtual QString landFlightMode() const
Returns the flight mode for Land.
virtual QString gotoFlightMode() const
Returns the flight mode which the vehicle will be in if it is performing a goto location.
virtual Autotune * createAutotune(Vehicle *vehicle) const
Creates Autotune object.
static bool isStableFirmwareVersionUnseen(const QString &latestVersion, const QString &seenVersion)
virtual QStringList flightModes(Vehicle *) const
virtual AutoPilotPlugin * autopilotPlugin(Vehicle *vehicle) const
virtual void guidedModeRTL(Vehicle *vehicle, bool smartRTL) const
Command vehicle to return to launch.
virtual QList< MAV_CMD > supportedMissionCommands(QGCMAVLinkTypes::VehicleClass_t) const
List of supported mission commands. Empty list for all commands supported.
virtual QString autoDisarmParameter(Vehicle *) const
virtual QString stabilizedFlightMode() const
Returns the flight mode for Stabilized.
virtual void adjustOutgoingMavlinkMessageThreadSafe(Vehicle *, LinkInterface *, mavlink_message_t *)
void toolIndicatorsChanged()
virtual void setGuidedMode(Vehicle *vehicle, bool guidedMode) const
Set guided flight mode.
virtual bool guidedModeROI(Vehicle *vehicle, const QGeoCoordinate &roiCenterCoord, double relativeAltitudeMeters) const
virtual QString followFlightMode() const
Returns the flight mode which the vehicle will be for follow me.
virtual uint32_t highLatencyCustomModeTo32Bits(uint16_t hlCustomMode) const
Convert from HIGH_LATENCY2.custom_mode value to correct 32 bit value.
virtual QGCCameraManager * createCameraManager(Vehicle *vehicle) const
Creates vehicle camera manager.
virtual QMap< QString, FactGroup * > * factGroups()
Returns a pointer to a dictionary of firmware-specific FactGroups.
virtual void initializeVehicle(Vehicle *)
Called when Vehicle is first created to perform any firmware specific setup.
virtual bool MAV_CMD_DO_SET_MODE_is_supported() const
returns true if this flight stack supports MAV_CMD_DO_SET_MODE
virtual QString rtlFlightMode() const
Returns the flight mode for RTL.
virtual double maximumHorizontalSpeedMultirotorMetersSecond(Vehicle *) const
virtual void guidedModeLand(Vehicle *vehicle) const
Command vehicle to land at current location.
virtual bool sendHomePositionToVehicle() const
virtual bool isGuidedMode(const Vehicle *) const
Returns whether the vehicle is in guided mode or not.
virtual double minimumTakeoffAltitudeMeters(Vehicle *) const
virtual QString getHobbsMeter(Vehicle *vehicle) const
gets hobbs meter from autopilot. This should be reimplmeented for each firmware
static GPSManager * instance()
PositionManager * positionManager() const
This is the base class for firmware specific geofence managers.
void error(int errorCode, const QString &errorMsg)
Supports the Mavlink image transmission protocol (https://mavlink.io/en/services/image_transmission....
uint32_t flowImageIndex() const
void flowImageIndexChanged(uint32_t index)
void imageReady(const QImage &image)
bool activeJoystickEnabledForActiveVehicle() const
static JoystickManager * instance()
The link interface defines the interface for all links used to communicate with the ground station ap...
void sendMessageThreadSafe(mavlink_message_t &message)
virtual bool isConnected() const =0
void statusTextMessageFromEvent(uint8_t compid, int severity, const QString &text, const QString &description)
static int getComponentId()
void mavlinkMessageStatus(int sysid, uint64_t totalSent, uint64_t totalReceived, uint64_t totalLoss, float lossPercent)
void messageReceived(LinkInterface *link, const mavlink_message_t &message)
static MAVLinkProtocol * instance()
Allows to configure a set of mavlink streams to a specific rate, and restore back to default.
Owns the COMMAND_LONG / COMMAND_INT send/retry/ack pipeline for a single Vehicle.
void sendCommandInt(int compId, MAV_CMD command, MAV_FRAME frame, bool showError, float param1, float param2, float param3, float param4, double param5, double param6, float param7)
static QString failureCodeToString(MavCmdResultFailureCode_t failureCode)
void commandResult(int vehicleId, int targetComponent, int command, int ackResult, int failureCode)
Emitted for every terminal ack that has no user-provided resultHandler.
void sendCommandIntWithHandler(const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, MAV_FRAME frame, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, double param5=0.0, double param6=0.0, float param7=0.0f)
void sendCommandWithHandler(const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
void handleCommandAck(const mavlink_message_t &message, const mavlink_command_ack_t &ack)
Process a COMMAND_ACK — match it to a pending entry and fire callbacks.
void sendCommandDelayed(int compId, MAV_CMD command, bool showError, int milliseconds, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
bool isPending(int targetCompId, MAV_CMD command) const
True if a matching (targetCompId, command) is already queued or awaiting ack.
static void showCommandAckError(const mavlink_command_ack_t &ack)
void sendCommand(int compId, MAV_CMD command, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
int findEntryIndex(int targetCompId, MAV_CMD command) const
Index of a matching entry in the pending queue, or -1. Exposed for test use.
void sendCommandIntWithLambdaFallback(std::function< void()> lambda, int compId, MAV_CMD command, MAV_FRAME frame, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, double param5=0.0, double param6=0.0, float param7=0.0f)
void sendCommandWithLambdaFallback(std::function< void()> lambda, int compId, MAV_CMD command, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
Tracks per-component MAVLink message intervals and mediates SET_MESSAGE_INTERVAL commands plus MESSAG...
void handleMessageInterval(const mavlink_message_t &message)
void mavlinkMsgIntervalsChanged(uint8_t compid, uint16_t msgId, int32_t rate)
void setMessageRate(uint8_t compId, uint16_t msgId, int32_t rate)
int32_t getMessageRate(uint8_t compId, uint16_t msgId)
static MissionCommandTree * instance()
QString rawName(MAV_CMD command) const
Returns the raw name for the specified command.
int currentIndex(void) const
Current mission item as reported by MISSION_CURRENT.
static MultiVehicleManager * instance()
Vehicle * activeVehicle() const
QmlObjectListModel * vehicles() const
void parameterReadyVehicleAvailableChanged(bool parameterReadyVehicleAvailable)
void activeVehicleChanged(Vehicle *activeVehicle)
void parametersReadyChanged(bool parametersReady)
static constexpr int defaultComponentId
void loadProgressChanged(float value)
void currentIndexChanged(int currentIndex)
void sendComplete(bool error)
void newMissionItemsAvailable(bool removeAllRequested)
const QList< MissionItem * > & missionItems(void)
void error(int errorCode, const QString &errorMsg)
static void sendPlanToVehicle(Vehicle *vehicle, const QString &filename)
void gcsPositionChanged(QGeoCoordinate gcsPosition)
QGeoCoordinate gcsPosition() const
const QVariantList & cameraList() const
void showAdvancedUIChanged(bool showAdvancedUI)
static QGCCorePlugin * instance()
static bool isMultiRotor(MAV_TYPE mavType)
static uint32_t highLatencyFailuresToMavSysStatus(mavlink_high_latency2_t &highLatency2)
static QString mavTypeToString(MAV_TYPE mavType)
static int motorCount(MAV_TYPE mavType, uint8_t frameType=0)
static bool isAirship(MAV_TYPE mavType)
@ CalibrationAPMPressureAirspeed
@ CalibrationAPMAccelSimple
@ CalibrationAPMCompassMot
@ CalibrationAPMPreFlight
static bool isSpacecraft(MAV_TYPE mavType)
static QString firmwareClassToString(FirmwareClass_t firmwareClass)
static bool isVTOL(MAV_TYPE mavType)
static QString firmwareVersionTypeToString(FIRMWARE_VERSION_TYPE firmwareVersionType)
static bool isFixedWing(MAV_TYPE mavType)
static QString mavResultToString(uint8_t result)
static bool isSub(MAV_TYPE mavType)
static QString vehicleClassToInternalString(VehicleClass_t vehicleClass)
static bool isRoverBoat(MAV_TYPE mavType)
The QGCMapCircle represents a circular area which can be displayed on a Map control.
This is a QGeoCoordinate within a QObject such that it can be used on a QmlObjectListModel.
static QGCPressure * instance()
void progressUpdate(float progress)
int count() const override final
Radio link telemetry decoded from MAVLINK_MSG_ID_RADIO_STATUS.
This is the base class for firmware specific rally point managers. A rally point manager is responsib...
void error(int errorCode, const QString &errorMsg)
void mavlinkMessageReceived(mavlink_message_t &message)
Coordinates MAV_CMD_REQUEST_MESSAGE workflows: per-component queueing, ack/message correlation,...
void handleReceivedMessage(const mavlink_message_t &message)
void cancelRequests(void *resultHandlerData)
static QString failureCodeToString(RequestMessageResultHandlerFailureCode_t failureCode)
void requestMessage(RequestMessageResultHandler resultHandler, void *resultHandlerData, int compId, int messageId, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f)
void stop()
Clear pending state without firing callbacks (used during vehicle shutdown).
Provides access to all app settings.
static SettingsManager * instance()
VideoSettings * videoSettings() const
FlyViewSettings * flyViewSettings() const
MavlinkSettings * mavlinkSettings() const
void availableModesMonitorReceived(uint8_t seq)
void criticalMessageCountChanged()
void handleHTMLEscapedTextMessage(MAV_COMPONENT componentid, MAV_SEVERITY severity, const QString &text, const QString &description)
void newErrorMessage(QString message)
uint32_t criticalMessageCount() const
void mavlinkMessageReceived(const mavlink_message_t &message)
void textMessageReceived(MAV_COMPONENT componentid, MAV_SEVERITY severity, QString text, QString description)
void newFormattedMessage(QString message)
QString formattedMessages() const
Class which represents sensor info from the SYS_STATUS mavlink message.
bool mavlinkMessageReceived(const mavlink_message_t &message)
Coordinates the terrain-query workflows attached to a Vehicle:
void updateAltAboveTerrain()
void doSetHomeWithTerrain(const QGeoCoordinate &coord)
Fact _headingFromHomeFact
Fact * altitudeRelative()
Fact _altitudeRelativeFact
void handleMessage(Vehicle *vehicle, const mavlink_message_t &message) override
Allows a FactGroup to parse incoming messages and fill in values.
void updateRCRSSI(uint8_t rssi)
Fact _missionItemIndexFact
Fact _altitudeTuningSetpointFact
Fact _headingToNextWPFact
bool _altitudeMessageAvailable
WeakLinkInterfacePtr primaryLink() const
void mavlinkMessageReceived(LinkInterface *link, const mavlink_message_t &message)
bool containsLink(LinkInterface *link)
void update(mavlink_obstacle_distance_t *message)
Per-vehicle signing facade. Owns the wiring between Vehicle and the active SigningController (which l...
bool changeHeading() const
bool pauseVehicle() const
Q_INVOKABLE void triggerSimpleCamera(void)
Trigger camera using MAV_CMD_DO_DIGICAM_CONTROL command.
bool isInitialConnectComplete() const
Q_INVOKABLE void guidedModeChangeAltitude(double altitudeChange, bool pauseVehicle)
void _setLanding(bool landing)
Vehicle(LinkInterface *link, int vehicleId, int defaultComponentId, MAV_AUTOPILOT firmwareType, MAV_TYPE vehicleType, QObject *parent=nullptr)
Q_INVOKABLE void motorInterlock(bool enable)
Command vehicle to Enable/Disable Motor Interlock.
Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust)
int32_t getMessageRate(uint8_t compId, uint16_t msgId)
VehicleDistanceSensorFactGroup * _distanceSensorFactGroup
TerrainProtocolHandler * _terrainProtocolHandler
void firmwareTypeChanged()
QGCMAVLink::VehicleClass_t vehicleClass(void) const
void setInitialGCSPressure(qreal pressure)
Q_INVOKABLE void flashBootloader()
void sensorsPresentBitsChanged(int sensorsPresentBits)
void airborneChanged(bool airborne)
void defaultHoverSpeedChanged(double hoverSpeed)
friend class InitialConnectStateMachine
const QString _vibrationFactGroupName
bool _multirotor_speed_limits_available
void gcsControlStatusChanged()
void defaultCruiseSpeedChanged(double cruiseSpeed)
const QString _gpsFactGroupName
FactGroup * localPositionFactGroup()
void setActuatorsMetadata(uint8_t compid, const QString &metadataJsonFileName, const QJsonDocument &metadataJson)
void haveMRSpeedLimChanged()
FactGroup * vibrationFactGroup()
void sendMavCommandWithLambdaFallback(std::function< void()> lambda, int compId, MAV_CMD command, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
BatteryFactGroupListModel * _batteryFactGroupListModel
void sendMavCommand(int compId, MAV_CMD command, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
VehicleLocalPositionFactGroup * _localPositionFactGroup
const QString _hygrometerFactGroupName
void messagesLostChanged()
Q_INVOKABLE void rebootVehicle()
Reboot vehicle.
VehicleRPMFactGroup * _rpmFactGroup
const QString _localPositionFactGroupName
VehicleGPSFactGroup * _gps2FactGroup
void vtolInFwdFlightChanged(bool vtolInFwdFlight)
QString missionFlightMode() const
void readyToFlyAvailableChanged(bool readyToFlyAvailable)
void forceInitialPlanRequestComplete()
void isROIEnabledChanged()
Q_INVOKABLE void guidedModeOrbit(const QGeoCoordinate ¢erCoord, double radius, double amslAltitude)
const QString _terrainFactGroupName
const QString _temperatureFactGroupName
void _offlineVehicleTypeSettingChanged(QVariant varVehicleType)
Q_INVOKABLE void guidedModeTakeoff(double altitudeRelative)
Command vehicle to takeoff from current location.
Q_INVOKABLE void sendGripperAction(GRIPPER_ACTIONS gripperOption)
QString flightMode() const
static QString mavCmdResultFailureCodeToString(MavCmdResultFailureCode_t failureCode)
void setNewStableFirmwareVersion(const QString &version)
QString stabilizedFlightMode() const
const QVariantList & staticCameraList() const
void requestOperatorControlReceived(int sysIdRequestingControl, int allowTakeover, int requestTimeoutSecs)
Q_INVOKABLE QVariant expandedToolbarIndicatorSource(const QString &indicatorName)
void sendJoystickAuxRcOverrideThreadSafe(const std::array< uint16_t, kAuxRcOverrideChannelCount > &channelValues, const std::array< bool, kAuxRcOverrideChannelCount > &channelEnabled, bool useRcOverride)
void setSoloFirmware(bool soloFirmware)
void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate, bool sendMultiple=true)
FactGroup * rpmFactGroup()
QGeoCoordinate homePosition()
const QString _estimatorStatusFactGroupName
const QString _radioStatusFactGroupName
QString vehicleImageOutline() const
MissionManager * _missionManager
VehicleLocalPositionSetpointFactGroup * _localPositionSetpointFactGroup
void textMessageReceived(int sysid, int componentid, int severity, QString text, QString description)
void initialPlanRequestCompleteChanged(bool initialPlanRequestComplete)
Q_INVOKABLE double minimumEquivalentAirspeed()
const QString _clockFactGroupName
Q_INVOKABLE void stopGuidedModeROI()
void firmwareCustomVersionChanged()
QString pauseFlightMode() const
QString prearmError() const
EscStatusFactGroupListModel * _escStatusFactGroupListModel
const QString _efiFactGroupName
void inFwdFlightChanged()
void setFirmwarePluginInstanceData(FirmwarePluginInstanceData *firmwarePluginInstanceData)
Q_INVOKABLE double maximumHorizontalSpeedMultirotorMetersSecond()
void sendMessageMultiple(mavlink_message_t message)
void capabilityBitsChanged(uint64_t capabilityBits)
void _setHomePosition(QGeoCoordinate &homeCoord)
VehicleClockFactGroup * _clockFactGroup
uint64_t capabilityBits() const
int criticalMessageCount() const
Q_INVOKABLE void abortLanding(double climbOutAltitude)
Command vehicle to abort landing.
void setGuidedMode(bool guidedMode)
void readyToFlyChanged(bool readyToFy)
QString firmwareVersionTypeString() const
QString landFlightMode() const
static void showCommandAckError(const mavlink_command_ack_t &ack)
void newFormattedMessage(QString formattedMessage)
MAV_TYPE vehicleType() const
VehicleLinkManager * vehicleLinkManager()
void cameraManagerChanged()
void underwayChanged(bool underway)
Q_INVOKABLE void sendParamMapRC(const QString ¶mName, double scale, double centerValue, int tuningID, double minValue, double maxValue)
Sends PARAM_MAP_RC message to vehicle.
HealthAndArmingCheckReport * healthAndArmingCheckReport()
void armedChanged(bool armed)
void firmwareVersionChanged()
FactGroup * distanceSensorFactGroup()
void logEntry(uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num)
void sendControlRequestAllowedChanged(bool sendControlRequestAllowed)
FactGroup * generatorFactGroup()
void rcChannelsRawChanged(QVector< int > channelValues)
Q_INVOKABLE void acknowledgeNewStableFirmwareVersion()
Hides the update indicator until a newer stable firmware is released.
FirmwarePlugin * firmwarePlugin()
Provides access to the Firmware Plugin for this Vehicle.
void sendMavCommandInt(int compId, MAV_CMD command, MAV_FRAME frame, bool showError, float param1, float param2, float param3, float param4, double param5, double param6, float param7)
Q_INVOKABLE double minimumTakeoffAltitudeMeters()
InitialConnectStateMachine * _initialConnectStateMachine
void sensorsParametersResetAck(bool success)
void sendMavCommandDelayed(int compId, MAV_CMD command, bool showError, int milliseconds, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
void setEstimatorOrigin_SET_GPS_GLOBAL_ORIGIN(const QGeoCoordinate ¢erCoord)
Fallback for setEstimatorOrigin which sends the deprecated SET_GPS_GLOBAL_ORIGIN message.
const QString _distanceSensorFactGroupName
Q_INVOKABLE double maximumEquivalentAirspeed()
@ ModeAltitudeAndAirspeed
@ ModeVelocityAndPosition
void setPrearmError(const QString &prearmError)
VehicleGPSFactGroup * gpsFactGroup()
VehicleVibrationFactGroup * _vibrationFactGroup
void setFirmwareCustomVersion(int majorVersion, int minorVersion, int patchVersion)
Q_INVOKABLE void startTimerRevertAllowTakeover()
VehicleGeneratorFactGroup * _generatorFactGroup
const QString _generatorFactGroupName
void messagesSentChanged()
Q_INVOKABLE void sendPlan(QString planFile)
bool vtolInFwdFlight() const
Q_INVOKABLE void startMission()
bool isMavCommandPending(int targetCompId, MAV_CMD command)
isMavCommandPending Query whether the specified MAV_CMD is in queue to be sent or has already been se...
void capabilitiesKnownChanged(bool capabilitiesKnown)
Q_INVOKABLE void requestOperatorControl(bool allowOverride, int requestTimeoutSecs=0)
void rcChannelsClampedChanged(QVector< int > channelValues)
VehicleEstimatorStatusFactGroup * _estimatorStatusFactGroup
VehicleTemperatureFactGroup * _temperatureFactGroup
bool soloFirmware() const
void coordinateChanged(QGeoCoordinate coordinate)
QString vehicleImageOpaque() const
float _altitudeTuningOffset
Q_INVOKABLE void setPIDTuningTelemetryMode(PIDTuningTelemetryMode mode)
void setRebootRequired()
Latches rebootRequired until the vehicle reboots.
void mavlinkLogData(Vehicle *vehicle, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint8_t first_message, QByteArray data, bool acked)
Q_INVOKABLE void emergencyStop()
Command vehicle to kill all motors no matter what state.
void updateFlightDistance(double distance)
Q_INVOKABLE bool guidedModeGotoLocation(const QGeoCoordinate &gotoCoord, double forwardFlightLoiterRadius=0.0f)
void pairRX(int rxType, int rxSubType)
const QString _setpointFactGroupName
Q_INVOKABLE void setCurrentMissionSequence(int seq)
Alter the current mission item on the vehicle.
void toolIndicatorsChanged()
void roiRelativeAltitudeMetersChanged()
void sensorsUnhealthyBitsChanged(int sensorsUnhealthyBits)
void landingChanged(bool landing)
bool sendMessageOnLinkThreadSafe(LinkInterface *link, mavlink_message_t message)
VehicleWindFactGroup * _windFactGroup
const QString _rpmFactGroupName
FactGroup * hygrometerFactGroup()
static const MAV_AUTOPILOT MAV_AUTOPILOT_TRACK
Q_INVOKABLE void startTakeoff()
VehicleHygrometerFactGroup * _hygrometerFactGroup
void setFlightMode(const QString &flightMode)
Q_INVOKABLE void sendCommand(int compId, int command, bool showError, double param1=0.0, double param2=0.0, double param3=0.0, double param4=0.0, double param5=0.0, double param6=0.0, double param7=0.0)
Same as sendMavCommand but available from Qml.
void loadProgressChanged(float value)
QString smartRTLFlightMode() const
QString followFlightMode() const
bool _fixed_wing_airspeed_limits_available
Q_INVOKABLE void motorTest(int motor, int percent, int timeoutSecs, bool showError)
void mavlinkMessageReceived(const mavlink_message_t &message)
void setMessageRate(uint8_t compId, uint16_t msgId, int32_t rate)
Q_INVOKABLE void resetCounters()
< Non-empty when vehicle firmware is older than this stable version
const QVariantList & toolIndicators()
void _offlineFirmwareTypeSettingChanged(QVariant varFirmwareType)
FactGroup * localPositionSetpointFactGroup()
Q_INVOKABLE void guidedModeChangeEquivalentAirspeedMetersSecond(double airspeed)
QmlObjectListModel * escs()
void guidedModeChanged(bool guidedMode)
FactGroup * efiFactGroup()
void setEventsMetadata(uint8_t compid, const QString &metadataJsonFileName)
QString formattedMessages() const
int _findMavCommandListEntryIndex(int targetCompId, MAV_CMD command)
Test-only helper: forwards to MavCommandQueue::findEntryIndex.
QObject * sysStatusSensorInfo()
QString motorDetectionFlightMode() const
void sendMavCommandIntWithLambdaFallback(std::function< void()> lambda, int compId, MAV_CMD command, MAV_FRAME frame, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, double param5=0.0, double param6=0.0, float param7=0.0f)
void rebootRequiredChanged()
void orbitActiveChanged(bool orbitActive)
void allSensorsHealthyChanged(bool allSensorsHealthy)
Q_INVOKABLE void guidedModeRTL(bool smartRTL)
Command vehicle to return to launch.
void trackFirmwareVehicleTypeChanges(void)
Q_INVOKABLE void landingGearDeploy()
Command vichecle to deploy landing gear.
void _setUnderway(bool underway)
void armedPositionChanged()
VehicleEFIFactGroup * _efiFactGroup
static QString requestMessageResultHandlerFailureCodeToString(RequestMessageResultHandlerFailureCode_t failureCode)
RemoteIDManager * _remoteIDManager
Q_INVOKABLE void doSetHome(const QGeoCoordinate &coord)
Set home from flight map coordinate.
void soloFirmwareChanged(bool soloFirmware)
uint32_t flowImageIndex() const
void homePositionChanged(const QGeoCoordinate &homePosition)
QMap< uint8_t, uint8_t > _lowestBatteryChargeStateAnnouncedMap
FactGroup * radioStatusFactGroup()
Q_INVOKABLE bool guidedModeROI(const QGeoCoordinate ¢erCoord, double relativeAltitudeMeters)
Q_INVOKABLE void pauseVehicle()
void stopTrackingFirmwareVehicleTypeChanges(void)
FactGroup * windFactGroup()
void flightModesChanged()
const QString _gps2FactGroupName
FactGroup * temperatureFactGroup()
Q_INVOKABLE void closeVehicle()
Removes the vehicle from the system.
void flightModeChanged(const QString &flightMode)
void flowImageIndexChanged()
void roiCoordChanged(const QGeoCoordinate ¢erCoord)
Q_INVOKABLE void clearAllParamMapRC(void)
Clears all PARAM_MAP_RC settings from vehicle.
FactGroup * estimatorStatusFactGroup()
Q_INVOKABLE void setEstimatorOrigin(const QGeoCoordinate ¢erCoord)
void setVtolInFwdFlight(bool vtolInFwdFlight)
Q_INVOKABLE void guidedModeChangeGroundSpeedMetersSecond(double groundspeed)
int defaultComponentId() const
void setInitialGCSTemperature(qreal temperature)
void mavlinkStatusChanged()
MAVLinkLogManager * mavlinkLogManager() const
Q_INVOKABLE void clearMessages()
VehicleGPSFactGroup * gps2FactGroup()
FactGroup * setpointFactGroup()
void sendJoystickDataThreadSafe(float roll, float pitch, float yaw, float thrust, quint16 buttons, quint16 buttons2, float pitchExtension, float rollExtension, float aux1, float aux2, float aux3, float aux4, float aux5, float aux6)
QmlObjectListModel * cameraTriggerPoints()
GeoFenceManager * _geoFenceManager
bool flightModeSetAvailable()
VehicleGPSFactGroup * _gpsFactGroup
void sensorsHealthBitsChanged(int sensorsHealthBits)
Q_INVOKABLE void guidedModeChangeHeading(const QGeoCoordinate &headingCoord)
QString takeControlFlightMode() const
void messagesReceivedChanged()
const QString _localPositionSetpointFactGroupName
void setOfflineEditingDefaultComponentId(int defaultComponentId)
Sets the default component id for an offline editing vehicle.
void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType=FIRMWARE_VERSION_TYPE_OFFICIAL)
QString rtlFlightMode() const
void requestMessage(RequestMessageResultHandler resultHandler, void *resultHandlerData, int compId, int messageId, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f)
QGeoCoordinate coordinate()
void startCalibration(QGCMAVLink::CalibrationType calType)
QVector< int > _servoOutputRawValues
QString firmwareTypeString() const
FactGroup * clockFactGroup()
void stopCalibration(bool showError)
void newStableFirmwareVersionChanged()
friend class VehicleLinkManager
QmlObjectListModel * batteries()
void haveFWSpeedLimChanged()
RallyPointManager * _rallyPointManager
RadioStatusFactGroup * _radioStatusFactGroup
QString gotoFlightMode() const
void sendMavCommandIntWithHandler(const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, MAV_FRAME frame, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, double param5=0.0f, double param6=0.0f, float param7=0.0f)
Q_INVOKABLE void landingGearRetract()
Command vichecle to retract landing gear.
VehicleSupports * supports()
const QString _windFactGroupName
void mavCommandResult(int vehicleId, int targetComponent, int command, int ackResult, int failureCode)
void sensorsEnabledBitsChanged(int sensorsEnabledBits)
class FirmwarePluginInstanceData * firmwarePluginInstanceData()
VehicleSetpointFactGroup * _setpointFactGroup
Q_INVOKABLE int versionCompare(const QString &compare) const
Used to check if running current version is equal or higher than the one being compared.
TerrainFactGroup * _terrainFactGroup
Q_INVOKABLE void forceArm()
void requiresGpsFixChanged()
void setArmed(bool armed, bool showError)
QStringList flightModes()
void mavlinkMsgIntervalsChanged(uint8_t compid, uint16_t msgId, int32_t rate)
FactGroup * terrainFactGroup()
void mavlinkSerialControl(uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, QByteArray data)
Q_INVOKABLE QString vehicleClassInternalName() const
VehicleLinkManager * _vehicleLinkManager
void servoOutputsChanged(QVector< int > servoValues)
TerrainQueryCoordinator * _terrainQueryCoordinator
void prearmErrorChanged(const QString &prearmError)
void vehicleTypeChanged()
Q_INVOKABLE void guidedModeLand()
Command vehicle to land at current location.
void sendMavCommandWithHandler(const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
Sends the command and calls the callback with the result.
StandardModes * _standardModes
friend class GimbalController
QString vehicleTypeString() const
void logData(uint32_t ofs, uint16_t id, uint8_t count, const uint8_t *data)
void criticalMessageCountChanged()
static VideoManager * instance()
Q_INVOKABLE void stopVideo()
static constexpr const char * videoSourceUDPH264
static constexpr const char * videoDisabled
GPSCommandSequence sequence(std::span< const Setting > settings, char port)
settings for port, each acknowledged by an ACK.
bool fuzzyCompare(double value1, double value2)
Returns true if the two values are equal or close. Correctly handles 0 and NaN values.
void showCriticalVehicleMessage(const QString &message)
void showAppMessage(const QString &message, const QString &title)
Modal application message. Queued if the UI isn't ready yet.
Callback info bundle for sendMavCommandWithHandler.
MavCmdResultHandler resultHandler
nullptr for no handler
MavCmdResultFailureCode_t
@ MavCmdResultFailureDuplicateCommand
Unable to send command since duplicate is already being waited on for response.
@ MavCmdResultCommandResultOnly
commandResult specifies full success/fail info
@ MavCmdResultFailureNoResponseToCommand
No response from vehicle to command.
RequestMessageResultHandlerFailureCode_t