QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
Vehicle.h
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <memory>
5
6#include <QtCore/QElapsedTimer>
7#include <QtCore/QFile>
8#include <QtCore/QObject>
9#include <QtCore/QPointer>
10#include <QtCore/QSharedPointer>
11#include <QtCore/QTime>
12#include <QtCore/QTimer>
13#include <QtCore/QVariantList>
14#include <QtPositioning/QGeoCoordinate>
15#include <QtQmlIntegration/QtQmlIntegration>
16
17#include <array>
18#include <atomic>
19
20#include "QGCMAVLink.h"
21#include "VehicleFactGroup.h"
22#include "VehicleSigningController.h" // Q_PROPERTY needs the full QObject type for moc/QML metatype registration
23#include "VehicleTypes.h"
24
25class Actuators;
28class QGCMapCircle;
29class QJsonDocument;
33class AutoPilotPlugin;
53class Autotune;
56class FirmwarePlugin;
57class FTPManager;
58class GeoFenceManager;
62class LinkInterface;
64class MavCommandQueue;
66class MissionManager;
71class RemoteIDManager;
72class RequestMessageTest;
73class RetryableRequestMessageStateTest;
74class SendMavCommandWithHandlerTest;
75class SendMavCommandWithSignallingTest;
76class StandardModes;
82class VehicleSupports;
83
85{
86 Q_OBJECT
87 QML_ELEMENT
88 QML_UNCREATABLE("")
89 Q_MOC_INCLUDE("Actuators.h")
90 Q_MOC_INCLUDE("AutoPilotPlugin.h")
91 Q_MOC_INCLUDE("Autotune.h")
92 Q_MOC_INCLUDE("GimbalController.h")
93 Q_MOC_INCLUDE("LinkInterface.h")
94 Q_MOC_INCLUDE("MAVLinkLogManager.h")
95 Q_MOC_INCLUDE("ParameterManager.h")
96 Q_MOC_INCLUDE("QGCMapCircle.h")
97 Q_MOC_INCLUDE("QmlObjectListModel.h")
98 Q_MOC_INCLUDE("RemoteIDManager.h")
99 Q_MOC_INCLUDE("TrajectoryPoints.h")
100 Q_MOC_INCLUDE("VehicleLinkManager.h")
101 Q_MOC_INCLUDE("VehicleObjectAvoidance.h")
102 Q_MOC_INCLUDE("VehicleSupports.h")
103 Q_MOC_INCLUDE("VehicleGPSFactGroup.h")
104
106 friend class VehicleLinkManager;
107 friend class FactGroupListModel; // Allow call _addFactGroup
108#ifdef QGC_UNITTEST_BUILD
109 friend class SendMavCommandWithSignallingTest; // Unit test
110 friend class SendMavCommandWithHandlerTest; // Unit test
111 friend class RequestMessageTest; // Unit test
112 friend class RetryableRequestMessageStateTest; // Unit test
113#endif
114 friend class GimbalController; // Allow GimbalController to call _addFactGroup
115
116public:
118 int vehicleId,
120 MAV_AUTOPILOT firmwareType,
121 MAV_TYPE vehicleType,
122 QObject* parent = nullptr);
123
124 // Pass these into the offline constructor to create an offline vehicle which tracks the offline vehicle settings.
125 // Keep these as valid enum values to avoid UBSan failures on enum loads/comparisons.
126 // Use ENUM_END sentinels — no real component should report these values.
127 static const MAV_AUTOPILOT MAV_AUTOPILOT_TRACK = MAV_AUTOPILOT_ENUM_END;
128 static const MAV_TYPE MAV_TYPE_TRACK = MAV_TYPE_ENUM_END;
129
130 // The following is used to create a disconnected Vehicle for use while offline editing.
131 Vehicle(MAV_AUTOPILOT firmwareType,
132 MAV_TYPE vehicleType,
133 QObject* parent = nullptr);
134
135 ~Vehicle();
136
142 Q_ENUM(CheckList)
143
144 Q_PROPERTY(int id READ id CONSTANT)
145 Q_PROPERTY(AutoPilotPlugin* autopilotPlugin MEMBER _autopilotPlugin CONSTANT)
146 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged)
147 Q_PROPERTY(QGeoCoordinate homePosition READ homePosition NOTIFY homePositionChanged)
148 Q_PROPERTY(QGeoCoordinate armedPosition READ armedPosition NOTIFY armedPositionChanged)
149 Q_PROPERTY(bool armed READ armed WRITE setArmedShowError NOTIFY armedChanged)
150 Q_PROPERTY(bool autoDisarm READ autoDisarm NOTIFY autoDisarmChanged)
151 Q_PROPERTY(bool flightModeSetAvailable READ flightModeSetAvailable CONSTANT)
152 Q_PROPERTY(QStringList flightModes READ flightModes NOTIFY flightModesChanged)
153 Q_PROPERTY(QString flightMode READ flightMode WRITE setFlightMode NOTIFY flightModeChanged)
154 Q_PROPERTY(TrajectoryPoints* trajectoryPoints MEMBER _trajectoryPoints CONSTANT)
156 Q_PROPERTY(float latitude READ latitude NOTIFY coordinateChanged)
157 Q_PROPERTY(float longitude READ longitude NOTIFY coordinateChanged)
158 Q_PROPERTY(bool px4Firmware READ px4Firmware NOTIFY firmwareTypeChanged)
159 Q_PROPERTY(bool apmFirmware READ apmFirmware NOTIFY firmwareTypeChanged)
160 Q_PROPERTY(bool soloFirmware READ soloFirmware WRITE setSoloFirmware NOTIFY soloFirmwareChanged)
161 Q_PROPERTY(bool genericFirmware READ genericFirmware CONSTANT)
163 Q_PROPERTY(uint messagesSent READ messagesSent NOTIFY messagesSentChanged)
164 Q_PROPERTY(uint messagesLost READ messagesLost NOTIFY messagesLostChanged)
165 Q_PROPERTY(bool airship READ airship NOTIFY vehicleTypeChanged)
166 Q_PROPERTY(bool fixedWing READ fixedWing NOTIFY vehicleTypeChanged)
167 Q_PROPERTY(bool multiRotor READ multiRotor NOTIFY vehicleTypeChanged)
168 Q_PROPERTY(bool vtol READ vtol NOTIFY vehicleTypeChanged)
169 Q_PROPERTY(bool rover READ rover NOTIFY vehicleTypeChanged)
170 Q_PROPERTY(bool sub READ sub NOTIFY vehicleTypeChanged)
171 Q_PROPERTY(VehicleSupports* supports READ supports CONSTANT)
172 Q_PROPERTY(QString prearmError READ prearmError WRITE setPrearmError NOTIFY prearmErrorChanged)
173 Q_PROPERTY(int motorCount READ motorCount CONSTANT)
174 Q_PROPERTY(bool coaxialMotors READ coaxialMotors CONSTANT)
175 Q_PROPERTY(bool xConfigMotors READ xConfigMotors CONSTANT)
176 Q_PROPERTY(bool isOfflineEditingVehicle READ isOfflineEditingVehicle CONSTANT)
181 Q_PROPERTY(QString missionFlightMode READ missionFlightMode CONSTANT)
182 Q_PROPERTY(QString pauseFlightMode READ pauseFlightMode CONSTANT)
183 Q_PROPERTY(QString rtlFlightMode READ rtlFlightMode CONSTANT)
184 Q_PROPERTY(QString smartRTLFlightMode READ smartRTLFlightMode CONSTANT)
185 Q_PROPERTY(QString landFlightMode READ landFlightMode CONSTANT)
186 Q_PROPERTY(QString takeControlFlightMode READ takeControlFlightMode CONSTANT)
187 Q_PROPERTY(QString followFlightMode READ followFlightMode CONSTANT)
188 Q_PROPERTY(QString motorDetectionFlightMode READ motorDetectionFlightMode CONSTANT)
189 Q_PROPERTY(QString stabilizedFlightMode READ stabilizedFlightMode CONSTANT)
190 Q_PROPERTY(QString firmwareTypeString READ firmwareTypeString NOTIFY firmwareTypeChanged)
191 Q_PROPERTY(QString vehicleTypeString READ vehicleTypeString NOTIFY vehicleTypeChanged)
192 Q_PROPERTY(QString vehicleImageOpaque READ vehicleImageOpaque CONSTANT)
193 Q_PROPERTY(QString vehicleImageOutline READ vehicleImageOutline CONSTANT)
194 Q_PROPERTY(QVariantList toolIndicators READ toolIndicators NOTIFY toolIndicatorsChanged)
196 Q_PROPERTY(QString hobbsMeter READ hobbsMeter NOTIFY hobbsMeterChanged)
197 Q_PROPERTY(bool inFwdFlight READ inFwdFlight NOTIFY inFwdFlightChanged)
199 Q_PROPERTY(quint64 mavlinkSentCount READ mavlinkSentCount NOTIFY mavlinkStatusChanged)
201 Q_PROPERTY(quint64 mavlinkLossCount READ mavlinkLossCount NOTIFY mavlinkStatusChanged)
203 Q_PROPERTY(GimbalController* gimbalController READ gimbalController CONSTANT)
204 Q_PROPERTY(bool hasGripper READ hasGripper NOTIFY hasGripperChanged)
205 Q_PROPERTY(bool isROIEnabled READ isROIEnabled NOTIFY isROIEnabledChanged)
209 Q_PROPERTY(bool readyToFly READ readyToFly NOTIFY readyToFlyChanged)
210 Q_PROPERTY(QObject* sysStatusSensorInfo READ sysStatusSensorInfo CONSTANT)
211 Q_PROPERTY(bool allSensorsHealthy READ allSensorsHealthy NOTIFY allSensorsHealthyChanged) //< true: all sensors in SYS_STATUS reported as healthy
212 Q_PROPERTY(bool requiresGpsFix READ requiresGpsFix NOTIFY requiresGpsFixChanged)
213 Q_PROPERTY(bool rebootRequired READ rebootRequired NOTIFY rebootRequiredChanged)
216 Q_PROPERTY(double loadProgress READ loadProgress NOTIFY loadProgressChanged)
218
219 // The following properties relate to Orbit status
220 Q_PROPERTY(bool orbitActive READ orbitActive NOTIFY orbitActiveChanged)
221 Q_PROPERTY(QGCMapCircle* orbitMapCircle READ orbitMapCircle CONSTANT)
222
223 // Vehicle state used for guided control
224 Q_PROPERTY(bool underway READ underway NOTIFY underwayChanged)
225 Q_PROPERTY(
226 bool airborne READ airborne NOTIFY airborneChanged)
227 Q_PROPERTY(bool landing READ landing NOTIFY landingChanged)
228 Q_PROPERTY(bool guidedMode READ guidedMode WRITE setGuidedMode NOTIFY guidedModeChanged)
229 Q_PROPERTY(QString gotoFlightMode READ gotoFlightMode CONSTANT)
232
233 Q_PROPERTY(ParameterManager* parameterManager READ parameterManager CONSTANT)
236 Q_PROPERTY(Autotune* autotune READ autotune CONSTANT)
237 Q_PROPERTY(RemoteIDManager* remoteIDManager READ remoteIDManager CONSTANT)
238
239 // FactGroup object model properties
240
241 Q_PROPERTY(FactGroup* vehicle READ vehicleFactGroup CONSTANT)
242 Q_PROPERTY(VehicleGPSFactGroup* gps READ gpsFactGroup CONSTANT)
243 Q_PROPERTY(VehicleGPSFactGroup* gps2 READ gps2FactGroup CONSTANT)
244 Q_PROPERTY(FactGroup* wind READ windFactGroup CONSTANT)
245 Q_PROPERTY(FactGroup* vibration READ vibrationFactGroup CONSTANT)
246 Q_PROPERTY(FactGroup* temperature READ temperatureFactGroup CONSTANT)
247 Q_PROPERTY(FactGroup* clock READ clockFactGroup CONSTANT)
248 Q_PROPERTY(FactGroup* setpoint READ setpointFactGroup CONSTANT)
249 Q_PROPERTY(FactGroup* estimatorStatus READ estimatorStatusFactGroup CONSTANT)
250 Q_PROPERTY(FactGroup* terrain READ terrainFactGroup CONSTANT)
251 Q_PROPERTY(FactGroup* distanceSensors READ distanceSensorFactGroup CONSTANT)
252 Q_PROPERTY(FactGroup* localPosition READ localPositionFactGroup CONSTANT)
253 Q_PROPERTY(FactGroup* localPositionSetpoint READ localPositionSetpointFactGroup CONSTANT)
254 Q_PROPERTY(FactGroup* hygrometer READ hygrometerFactGroup CONSTANT)
255 Q_PROPERTY(FactGroup* generator READ generatorFactGroup CONSTANT)
256 Q_PROPERTY(FactGroup* efi READ efiFactGroup CONSTANT)
257 Q_PROPERTY(FactGroup* radioStatus READ radioStatusFactGroup CONSTANT)
258 Q_PROPERTY(Actuators* actuators READ actuators CONSTANT)
259
260 // Dynamic FactGroupListModel properties
261 Q_PROPERTY(QmlObjectListModel* batteries READ batteries CONSTANT)
262 Q_PROPERTY(QmlObjectListModel* escs READ escs CONSTANT)
263
272 Q_PROPERTY(QString gitHash READ gitHash NOTIFY gitHashChanged)
273 Q_PROPERTY(quint64 vehicleUID READ vehicleUID NOTIFY vehicleUIDChanged)
274 Q_PROPERTY(QString vehicleUIDStr READ vehicleUIDStr NOTIFY vehicleUIDChanged)
275
277
278
279 Q_INVOKABLE void resetCounters ();
280
281 Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust);
282
284 Q_INVOKABLE void guidedModeRTL(bool smartRTL);
285
287 Q_INVOKABLE void guidedModeLand();
288
290 Q_INVOKABLE void guidedModeTakeoff(double altitudeRelative);
291
293 Q_INVOKABLE double minimumTakeoffAltitudeMeters();
294
297
299 Q_INVOKABLE double maximumEquivalentAirspeed();
300
302 Q_INVOKABLE double minimumEquivalentAirspeed();
303
306 Q_INVOKABLE bool guidedModeGotoLocation(const QGeoCoordinate& gotoCoord, double forwardFlightLoiterRadius = 0.0f);
307
311 Q_INVOKABLE void guidedModeChangeAltitude(double altitudeChange, bool pauseVehicle);
312
315 Q_INVOKABLE void guidedModeChangeHeading(const QGeoCoordinate &headingCoord);
316
319 Q_INVOKABLE void guidedModeChangeGroundSpeedMetersSecond(double groundspeed);
322 Q_INVOKABLE void guidedModeChangeEquivalentAirspeedMetersSecond(double airspeed);
323
328 Q_INVOKABLE void guidedModeOrbit(const QGeoCoordinate& centerCoord, double radius, double amslAltitude);
329
334 Q_INVOKABLE bool guidedModeROI(const QGeoCoordinate &centerCoord, double relativeAltitudeMeters);
335 Q_INVOKABLE void stopGuidedModeROI();
336
339 Q_INVOKABLE void pauseVehicle();
340
342 Q_INVOKABLE void emergencyStop();
343
345 Q_INVOKABLE void abortLanding(double climbOutAltitude);
346
348 Q_INVOKABLE void landingGearDeploy();
349
351 Q_INVOKABLE void landingGearRetract();
352
353 Q_INVOKABLE void startTakeoff();
354
355 Q_INVOKABLE void startMission();
356
358 Q_INVOKABLE void setCurrentMissionSequence(int seq);
359
361 Q_INVOKABLE void rebootVehicle();
362
364 void setRebootRequired();
365
366 void setNewStableFirmwareVersion(const QString& version);
367
369 Q_INVOKABLE void acknowledgeNewStableFirmwareVersion();
370
371 Q_INVOKABLE void sendPlan(QString planFile);
372 Q_INVOKABLE void setEstimatorOrigin(const QGeoCoordinate& centerCoord);
373
375 void setEstimatorOrigin_SET_GPS_GLOBAL_ORIGIN(const QGeoCoordinate& centerCoord);
376
378 // returns 1 if current > compare, 0 if current == compare, -1 if current < compare
379 Q_INVOKABLE int versionCompare(const QString& compare) const;
380 Q_INVOKABLE int versionCompare(int major, int minor, int patch) const;
381
386 Q_INVOKABLE void motorTest(int motor, int percent, int timeoutSecs, bool showError);
387
395
397
398 Q_INVOKABLE void forceArm ();
399
401 Q_INVOKABLE void sendParamMapRC(const QString& paramName, double scale, double centerValue, int tuningID, double minValue, double maxValue);
402
404 Q_INVOKABLE void clearAllParamMapRC(void);
405
407 Q_INVOKABLE void closeVehicle();
408
410 Q_INVOKABLE void triggerSimpleCamera(void);
411
413 Q_INVOKABLE void doSetHome(const QGeoCoordinate& coord);
414
415 Q_INVOKABLE QVariant expandedToolbarIndicatorSource(const QString& indicatorName);
416
417 bool isInitialConnectComplete() const;
418 QString gotoFlightMode () const;
419
420 VehicleSupports* supports() { return _vehicleSupports; }
421 bool hasGripper () const;
424
425 // Property accessors
426
427 QGeoCoordinate coordinate() { return _coordinate; }
428 QGeoCoordinate armedPosition () { return _armedPosition; }
429
430 qreal getInitialGCSPressure() const { return _initialGCSPressure; }
431 qreal getInitialGCSTemperature() const { return _initialGCSTemperature; }
432 void setInitialGCSPressure(qreal pressure) { _initialGCSPressure = pressure; }
433 void setInitialGCSTemperature(qreal temperature) { _initialGCSTemperature = temperature; }
434
435 void updateFlightDistance(double distance);
436
437 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);
439 static constexpr int kAuxRcOverrideChannelCount = 6;
440 void sendJoystickAuxRcOverrideThreadSafe(const std::array<uint16_t, kAuxRcOverrideChannelCount> &channelValues, const std::array<bool, kAuxRcOverrideChannelCount> &channelEnabled, bool useRcOverride);
441
442 // Property accesors
443 int id() const{ return _systemID; }
444 int compId() const{ return _compID; }
445 MAV_AUTOPILOT firmwareType() const { return _firmwareType; }
446 MAV_TYPE vehicleType() const { return _vehicleType; }
448 Q_INVOKABLE QString vehicleClassInternalName() const;
449
453
457
459 AutoPilotPlugin* autopilotPlugin() { return _autopilotPlugin; }
460
462 FirmwarePlugin* firmwarePlugin() { return _firmwarePlugin; }
463
464
465 QGeoCoordinate homePosition();
466
467 bool armed () const{ return _armed; }
468 void setArmed (bool armed, bool showError);
469 void setArmedShowError (bool armed) { setArmed(armed, true); }
470
472 QStringList flightModes ();
473 QString flightMode () const;
474 void setFlightMode (const QString& flightMode);
475
476 bool airship() const;
477
478 void pairRX(int rxType, int rxSubType);
479
480 bool fixedWing() const;
481 bool multiRotor() const;
482 bool vtol() const;
483 bool rover() const;
484 bool sub() const;
485 bool spacecraft() const;
486
487
488
489 void setGuidedMode(bool guidedMode);
490
491 QString prearmError() const { return _prearmError; }
492 void setPrearmError(const QString& prearmError);
493
495
496 //-- Mavlink Logging
497 void startMavlinkLog();
498 void stopMavlinkLog();
499
504 void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate, bool sendMultiple = true);
505
506 // The follow method are used to turn on/off the tracking of settings updates for firmware/vehicle type on offline vehicles.
509
510 float latitude () { return static_cast<float>(_coordinate.latitude()); }
511 float longitude () { return static_cast<float>(_coordinate.longitude()); }
512 bool px4Firmware () const { return _firmwareType == MAV_AUTOPILOT_PX4; }
513 bool apmFirmware () const { return _firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA; }
514 bool genericFirmware () const { return !px4Firmware() && !apmFirmware(); }
515 uint messagesReceived () const{ return _messagesReceived; }
516 uint messagesSent () const{ return _messagesSent; }
517 uint messagesLost () const{ return _messagesLost; }
518
519 bool underway() const { return _underway; }
520
521 bool airborne() const { return _airborne; }
522
523 bool landing () const { return _landing; }
524 bool guidedMode () const;
525 bool inFwdFlight () const;
526 bool vtolInFwdFlight () const { return _vtolInFwdFlight; }
527 uint8_t baseMode () const { return _base_mode; }
528 uint32_t customMode () const { return _custom_mode; }
531 uint32_t effectiveCustomMode () const { return _has_custom_mode_user_intention ? _custom_mode_user_intention : _custom_mode; }
532 bool isOfflineEditingVehicle () const { return _offlineEditingVehicle; }
533 int sensorsPresentBits () const { return static_cast<int>(_onboardControlSensorsPresent); }
534 int sensorsEnabledBits () const { return static_cast<int>(_onboardControlSensorsEnabled); }
535 int sensorsHealthBits () const { return static_cast<int>(_onboardControlSensorsHealth); }
536 int sensorsUnhealthyBits () const { return static_cast<int>(_onboardControlSensorsUnhealthy); }
537 QString missionFlightMode () const;
538 QString pauseFlightMode () const;
539 QString rtlFlightMode () const;
540 QString smartRTLFlightMode () const;
541 QString landFlightMode () const;
542 QString takeControlFlightMode () const;
543 QString followFlightMode () const;
544 QString motorDetectionFlightMode () const;
545 QString stabilizedFlightMode () const;
546 double defaultCruiseSpeed () const { return _defaultCruiseSpeed; }
547 double defaultHoverSpeed () const { return _defaultHoverSpeed; }
548 QString firmwareTypeString () const;
549 QString vehicleTypeString () const;
550 bool autoDisarm ();
551 bool orbitActive () const { return _orbitActive; }
552 QGCMapCircle* orbitMapCircle () { return _orbitMapCircle.get(); }
553 bool readyToFlyAvailable () const{ return _readyToFlyAvailable; }
554 bool readyToFly () const{ return _readyToFly; }
555 bool allSensorsHealthy () const{ return _allSensorsHealthy; }
556 QObject* sysStatusSensorInfo ();
557 bool requiresGpsFix () const { return static_cast<bool>(_onboardControlSensorsPresent & MAV_SYS_STATUS_SENSOR_GPS); }
558 bool rebootRequired () const { return _rebootRequired; }
559 QString newStableFirmwareVersion () const { return _newStableFirmwareVersion; }
560 bool newStableFirmwareVersionAcknowledged() const { return _newStableFirmwareVersionAcknowledged; }
561 bool hilMode () const { return _base_mode & MAV_MODE_FLAG_HIL_ENABLED; }
562 Actuators* actuators () const { return _actuators; }
563 VehicleSigningController* signingController() { return _signingController; }
564 const VehicleSigningController* signingController() const { return _signingController; }
565
567 void stopCalibration (bool showError);
568
570
588
591
595 ParameterManager* parameterManager () { return _parameterManager; }
596 ParameterManager* parameterManager () const { return _parameterManager; }
599 ComponentInformationManager* compInfoManager () { return _componentInformationManager; }
600 VehicleObjectAvoidance* objectAvoidance () { return _objectAvoidance; }
601 Autotune* autotune () const { return _autotune; }
603
604 static void showCommandAckError(const mavlink_command_ack_t& ack);
605
612 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);
613 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);
614 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);
615
630 bool isMavCommandPending(int targetCompId, MAV_CMD command);
631
633 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);
634
636
637 // MavCmdProgressHandler, MavCmdResultHandler, MavCmdAckHandlerInfo_t are inherited from VehicleTypes.
638
641 const MavCmdAckHandlerInfo_t* ackHandlerInfo,
642 int compId, MAV_CMD command,
643 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);
644
649 const MavCmdAckHandlerInfo_t* ackHandlerInfo,
650 int compId, MAV_CMD command, MAV_FRAME frame,
651 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);
652
656 std::function<void()> lambda,
657 int compId, MAV_CMD command,
658 bool showError,
659 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);
660
664 std::function<void()> lambda,
665 int compId, MAV_CMD command, MAV_FRAME frame,
666 bool showError,
667 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);
668
669
671
672 // RequestMessageResultHandler is inherited from VehicleTypes.
673
677 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);
678
679 int firmwareMajorVersion() const { return _firmwareMajorVersion; }
680 int firmwareMinorVersion() const { return _firmwareMinorVersion; }
681 int firmwarePatchVersion() const { return _firmwarePatchVersion; }
682 int firmwareVersionType() const { return _firmwareVersionType; }
683 int firmwareCustomMajorVersion() const { return _firmwareCustomMajorVersion; }
684 int firmwareCustomMinorVersion() const { return _firmwareCustomMinorVersion; }
685 int firmwareCustomPatchVersion() const { return _firmwareCustomPatchVersion; }
686 int firmwareBoardVendorId() const { return _firmwareBoardVendorId; }
687 int firmwareBoardProductId() const { return _firmwareBoardProductId; }
688 QString firmwareVersionTypeString() const;
689 void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType = FIRMWARE_VERSION_TYPE_OFFICIAL);
690 void setFirmwareCustomVersion(int majorVersion, int minorVersion, int patchVersion);
691 // versionNotSetValue inherited from VehicleTypes
692
693 QString gitHash() const { return _gitHash; }
694 quint64 vehicleUID() const { return _uid; }
695 QString vehicleUIDStr();
696
697 bool soloFirmware() const { return _soloFirmware; }
698 void setSoloFirmware(bool soloFirmware);
699
700 int defaultComponentId() const{ return _defaultComponentId; }
701
704
706 int motorCount();
707
709 bool coaxialMotors();
710
712 bool xConfigMotors();
713
715 class FirmwarePluginInstanceData* firmwarePluginInstanceData() { return _firmwarePluginInstanceData; }
716
720
721 QString vehicleImageOpaque () const;
722 QString vehicleImageOutline () const;
723
724 const QVariantList& toolIndicators();
725
726 bool capabilitiesKnown () const { return _capabilityBitsKnown; }
727 uint64_t capabilityBits () const { return _capabilityBits; } // Change signalled by capabilityBitsChanged
728
729 QString hobbsMeter ();
730
733 bool initialPlanRequestComplete() const { return _initialPlanRequestComplete; }
734
736
737 void _setUnderway(bool underway);
738 void _setLanding(bool landing);
739 void _setHomePosition(QGeoCoordinate& homeCoord);
740
743
746
747 quint64 mavlinkSentCount () const{ return _mavlinkSentCount; }
748 quint64 mavlinkReceivedCount () const{ return _mavlinkReceivedCount; }
749 quint64 mavlinkLossCount () const{ return _mavlinkLossCount; }
750 float mavlinkLossPercent () const{ return _mavlinkLossPercent; }
751
752 bool isROIEnabled () const{ return _isROIEnabled; }
753
755 double roiRelativeAltitudeMeters() const{ return _roiRelativeAltitudeMeters; }
756
757 CheckList checkListState () { return _checkListState; }
758 void setCheckListState (CheckList cl) { _checkListState = cl; emit checkListStateChanged(); }
759
760 double loadProgress () const { return _loadProgress; }
761
762 void setActuatorsMetadata(uint8_t compid, const QString& metadataJsonFileName, const QJsonDocument& metadataJson);
763
764 GimbalController* gimbalController () { return _gimbalController; }
765
766public slots:
768 void _offlineFirmwareTypeSettingChanged (QVariant varFirmwareType); // Should only be used by MissionControler to set firmware from Plan file
769 void _offlineVehicleTypeSettingChanged (QVariant varVehicleType); // Should only be used by MissionController to set vehicle type from Plan file
770 Q_INVOKABLE void sendGripperAction(GRIPPER_ACTIONS gripperOption);
771
772signals:
773 void coordinateChanged (QGeoCoordinate coordinate);
775 void homePositionChanged (const QGeoCoordinate& homePosition);
777 void armedChanged (bool armed);
778 void flightModeChanged (const QString& flightMode);
785 void prearmErrorChanged (const QString& prearmError);
787 void defaultCruiseSpeedChanged (double cruiseSpeed);
788 void defaultHoverSpeedChanged (double hoverSpeed);
807 void readyToFlyChanged (bool readyToFy);
815
818 void gitHashChanged (QString hash);
820 void loadProgressChanged (float value);
821
824 void rcChannelsRawChanged(QVector<int> channelValues);
825
828 void rcChannelsClampedChanged(QVector<int> channelValues);
829
832 void servoOutputsChanged(QVector<int> servoValues);
833
834 // Mavlink Log Download
835 void mavlinkLogData (Vehicle* vehicle, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint8_t first_message, QByteArray data, bool acked);
836
843 void mavCommandResult (int vehicleId, int targetComponent, int command, int ackResult, int failureCode);
844
845 // MAVlink Serial Data
846 void mavlinkSerialControl (uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, QByteArray data);
847
849
852 void roiCoordChanged (const QGeoCoordinate& centerCoord);
854
855 void sensorsParametersResetAck (bool success);
856
857 void logEntry (uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num);
858 void logData (uint32_t ofs, uint16_t id, uint8_t count, const uint8_t* data);
859
860private slots:
861 void _mavlinkMessageReceived (LinkInterface* link, mavlink_message_t message);
862 void _sendMessageMultipleNext ();
863 void _parametersReady (bool parametersReady);
864 void _handleFlightModeChanged (const QString& flightMode);
865 void _announceArmedChanged (bool armed);
866 void _updateAirborne();
867 void _offlineCruiseSpeedSettingChanged (QVariant value);
868 void _offlineHoverSpeedSettingChanged (QVariant value);
869 void _prearmErrorTimeout ();
870 void _firstMissionLoadComplete ();
871 void _firstGeoFenceLoadComplete ();
872 void _firstRallyPointLoadComplete ();
873 void _clearCameraTriggerPoints ();
874 void _updateDistanceHeadingHome ();
875 void _updateMissionItemIndex ();
876 void _updateHeadingToNextWP ();
877 void _updateDistanceHeadingGCS ();
878 void _updateHomepoint ();
879 void _updateHobbsMeter ();
880 void _vehicleParamLoaded (bool ready);
881 void _sendQGCTimeToVehicle ();
882 void _mavlinkMessageStatus (int uasId, uint64_t totalSent, uint64_t totalReceived, uint64_t totalLoss, float lossPercent);
883 void _orbitTelemetryTimeout ();
884 void _updateFlightTime ();
885 void _gotProgressUpdate (float progressValue);
886
887private:
888 void _activeVehicleChanged (Vehicle* newActiveVehicle);
889 void _handlePing (LinkInterface* link, mavlink_message_t& message);
890 void _handleHomePosition (mavlink_message_t& message);
891 void _handleHeartbeat (mavlink_message_t& message);
892 void _handleCurrentMode (mavlink_message_t& message);
893 void _handleRCChannels (mavlink_message_t& message);
894 void _handleBatteryStatus (mavlink_message_t& message);
895 void _handleSysStatus (mavlink_message_t& message);
896 void _handleExtendedSysState (mavlink_message_t& message);
897 void _handleCommandAck (mavlink_message_t& message);
898 void _handleGpsRawInt (mavlink_message_t& message);
899 void _handleGlobalPositionInt (mavlink_message_t& message);
900 void _handleHighLatency (mavlink_message_t& message);
901 void _handleHighLatency2 (mavlink_message_t& message);
902 void _handleOrbitExecutionStatus (const mavlink_message_t& message);
903 void _handleGimbalOrientation (const mavlink_message_t& message);
904 void _handleObstacleDistance (const mavlink_message_t& message);
905 void _handleFenceStatus (const mavlink_message_t& message);
906
907 // ArduPilot dialect messages
908 void _handleCameraFeedback (const mavlink_message_t& message);
909 void _handleCameraImageCaptured (const mavlink_message_t& message);
910 void _handleCommandLong (const mavlink_message_t& message);
911 void _missionManagerError (int errorCode, const QString& errorMsg);
912 void _geoFenceManagerError (int errorCode, const QString& errorMsg);
913 void _rallyPointManagerError (int errorCode, const QString& errorMsg);
914 void _say (const QString& text);
915 QString _vehicleIdSpeech ();
916 void _handleMavlinkLoggingData (mavlink_message_t& message);
917 void _handleMavlinkLoggingDataAcked (mavlink_message_t& message);
918 void _ackMavlinkLogData (uint16_t sequence);
919 void _commonInit (LinkInterface* link);
920 void _setupAutoDisarmSignalling ();
921 void _setCapabilities (uint64_t capabilityBits);
922 QString _acknowledgedStableFirmwareSettingsKey() const;
923 bool _isNewStableFirmwareVersionAcknowledged() const;
924 void _updateArmed (bool armed);
925 bool _apmArmingNotRequired ();
926 void _initializeCsv ();
927 void _writeCsvLine ();
928 void _flightTimerStart ();
929 void _flightTimerStop ();
930 void _setMessageInterval (int messageId, int rate);
931 bool setFlightModeCustom (const QString& flightMode, uint8_t* base_mode, uint32_t* custom_mode);
932 QString _formatMavCommand (MAV_CMD command, float param1);
933
934 static void _rebootCommandResultHandler(void* resultHandlerData, int compId, const mavlink_command_ack_t& ack, MavCmdResultFailureCode_t failureCode);
935
936 // The following methods should only be called by unit tests
937 void _deleteGimbalController();
938 void _deleteCameraManager();
939
942 void _stopCommandProcessing();
943
944 int _systemID;
945 int _defaultComponentId;
946 bool _offlineEditingVehicle = false;
947
948 MAV_AUTOPILOT _firmwareType;
949 MAV_TYPE _vehicleType;
950 FirmwarePlugin* _firmwarePlugin = nullptr;
951 class FirmwarePluginInstanceData* _firmwarePluginInstanceData = nullptr;
952 AutoPilotPlugin* _autopilotPlugin = nullptr;
953 bool _soloFirmware = false;
954
955 QTimer _csvLogTimer;
956 QFile _csvLogFile;
957
958 bool _isActiveVehicle = false;
959
960 QGeoCoordinate _coordinate;
961 QGeoCoordinate _homePosition;
962 QGeoCoordinate _armedPosition;
963
964 qreal _initialGCSPressure = 0.;
965 qreal _initialGCSTemperature = 0.;
966
967 bool _underway = false;
968 bool _airborne = false;
969 bool _landing = false;
970 bool _vtolInFwdFlight = false;
971 uint32_t _onboardControlSensorsPresent = 0;
972 uint32_t _onboardControlSensorsEnabled = 0;
973 uint32_t _onboardControlSensorsHealth = 0;
974 uint32_t _onboardControlSensorsUnhealthy = 0;
975 bool _gpsRawIntMessageAvailable = false;
976 bool _gps2RawMessageAvailable = false;
977 bool _globalPositionIntMessageAvailable = false;
978 bool _cameraImageCapturedMessageAvailable = false;
979 double _defaultCruiseSpeed = qQNaN();
980 double _defaultHoverSpeed = qQNaN();
981 bool _capabilityBitsKnown = false;
982 uint64_t _capabilityBits = 0;
983 CheckList _checkListState = CheckListNotSetup;
984 bool _readyToFlyAvailable = false;
985 bool _readyToFly = false;
986 bool _allSensorsHealthy = true;
987 bool _rebootRequired = false;
988 QString _newStableFirmwareVersion;
989 bool _newStableFirmwareVersionAcknowledged = false;
990 VehicleSigningController* _signingController = nullptr;
991 std::atomic<bool> _joystickAuxRcOverrideActive = false;
992
993 std::unique_ptr<SysStatusSensorInfo> _sysStatusSensorInfo;
994
995
996 QString _prearmError;
997 QTimer _prearmErrorTimer;
998 static const int _prearmErrorTimeoutMSecs = 35 * 1000;
999
1000 bool _initialPlanRequestComplete = false;
1001
1002 ParameterManager* _parameterManager = nullptr;
1003 ComponentInformationManager* _componentInformationManager = nullptr;
1004 VehicleObjectAvoidance* _objectAvoidance = nullptr;
1005 Autotune* _autotune = nullptr;
1006 GimbalController* _gimbalController = nullptr;
1007 VehicleSupports* _vehicleSupports = nullptr;
1008
1009 bool _armed = false;
1010 uint8_t _base_mode = 0;
1011 uint32_t _custom_mode = 0;
1012 uint32_t _custom_mode_user_intention = 0;
1013 bool _has_custom_mode_user_intention = false;
1014 QString _lastAnnouncedFlightMode;
1015
1017 typedef struct {
1018 mavlink_message_t message;
1019 int retryCount;
1020 } SendMessageMultipleInfo_t;
1021
1022 QList<SendMessageMultipleInfo_t> _sendMessageMultipleList;
1023
1024 static const int _sendMessageMultipleRetries = 5;
1025 static const int _sendMessageMultipleIntraMessageDelay = 500;
1026
1027 QTimer _sendMultipleTimer;
1028 int _nextSendMessageMultipleIndex = 0;
1029
1030 QElapsedTimer _flightTimer;
1031 QTimer _flightTimeUpdater;
1032 TrajectoryPoints* _trajectoryPoints = nullptr;
1033 std::unique_ptr<QmlObjectListModel> _cameraTriggerPoints;
1034 //QMap<QString, ADSBVehicle*> _trafficVehicleMap;
1035
1036 bool _allLinksRemovedSent = false;
1037
1038 uint _messagesReceived = 0;
1039 uint _messagesSent = 0;
1040 uint _messagesLost = 0;
1041 uint8_t _messageSeq = 0;
1042 uint8_t _compID = 0;
1043 bool _heardFrom = false;
1044
1045 bool _isROIEnabled = false;
1046 double _roiRelativeAltitudeMeters = 0;
1047\
1048 bool _checkLatestStableFWDone = false;
1049 int _firmwareMajorVersion = versionNotSetValue;
1050 int _firmwareMinorVersion = versionNotSetValue;
1051 int _firmwarePatchVersion = versionNotSetValue;
1052 int _firmwareCustomMajorVersion = versionNotSetValue;
1053 int _firmwareCustomMinorVersion = versionNotSetValue;
1054 int _firmwareCustomPatchVersion = versionNotSetValue;
1055 FIRMWARE_VERSION_TYPE _firmwareVersionType = FIRMWARE_VERSION_TYPE_OFFICIAL;
1056
1057 // Vendor and Product as reported from the first autopilot version message
1058 // during the initial connect. They may be zero eg ArduPilot SITL reports 0
1059 // by default.
1060 uint16_t _firmwareBoardVendorId = 0;
1061 uint16_t _firmwareBoardProductId = 0;
1062
1063
1064 QString _gitHash;
1065 quint64 _uid = 0;
1066
1067 uint64_t _mavlinkSentCount = 0;
1068 uint64_t _mavlinkReceivedCount = 0;
1069 uint64_t _mavlinkLossCount = 0;
1070 float _mavlinkLossPercent = 0.0f;
1071
1072 float _loadProgress = 0.0f;
1073
1074 QMap<QString, QTime> _noisySpokenPrearmMap;
1075
1076 // Orbit status values
1077 bool _orbitActive = false;
1078 std::unique_ptr<QGCMapCircle> _orbitMapCircle;
1079 QTimer _orbitTelemetryTimer;
1080 static const int _orbitTelemetryTimeoutMsecs = 3000; // No telemetry for this amount and orbit will go inactive
1081
1082 std::unique_ptr<MAVLinkStreamConfig> _mavlinkStreamConfig;
1083
1084 MavCommandQueue* _mavCmdQueue = nullptr;
1085 RequestMessageCoordinator* _reqMsgCoord = nullptr;
1086
1087public:
1089 int _findMavCommandListEntryIndex(int targetCompId, MAV_CMD command);
1090
1091 QMap<uint8_t /* batteryId */, uint8_t /* MAV_BATTERY_CHARGE_STATE_OK */> _lowestBatteryChargeStateAnnouncedMap;
1092
1093 float _altitudeTuningOffset = qQNaN(); // altitude offset, so the plotted value is around 0
1094
1095 // these flags are used to determine if the speed change action from fly view should be shown
1098
1099 // FactGroup facts
1100
1101 const QString _vehicleFactGroupName = QStringLiteral("vehicle");
1102 const QString _gpsFactGroupName = QStringLiteral("gps");
1103 const QString _gps2FactGroupName = QStringLiteral("gps2");
1104 const QString _windFactGroupName = QStringLiteral("wind");
1105 const QString _vibrationFactGroupName = QStringLiteral("vibration");
1106 const QString _temperatureFactGroupName = QStringLiteral("temperature");
1107 const QString _clockFactGroupName = QStringLiteral("clock");
1108 const QString _setpointFactGroupName = QStringLiteral("setpoint");
1109 const QString _distanceSensorFactGroupName = QStringLiteral("distanceSensor");
1110 const QString _localPositionFactGroupName = QStringLiteral("localPosition");
1111 const QString _localPositionSetpointFactGroupName = QStringLiteral("localPositionSetpoint");
1112 const QString _estimatorStatusFactGroupName = QStringLiteral("estimatorStatus");
1113 const QString _terrainFactGroupName = QStringLiteral("terrain");
1114 const QString _hygrometerFactGroupName = QStringLiteral("hygrometer");
1115 const QString _generatorFactGroupName = QStringLiteral("generator");
1116 const QString _efiFactGroupName = QStringLiteral("efi");
1117 const QString _rpmFactGroupName = QStringLiteral("rpm");
1118 const QString _radioStatusFactGroupName = QStringLiteral("radioStatus");
1119
1138
1139 // Live SERVO_OUTPUT_RAW values (microseconds). Indexed 0..15 -> SERVO1..SERVO16.
1140 QVector<int> _servoOutputRawValues = QVector<int>(16, -1);
1141
1142 // Dynamic FactGroups
1145
1147
1157
1158 // All terrain query workflows (doSetHome, ROI, altAboveTerrain) live in the coordinator.
1160
1161public:
1162 int32_t getMessageRate(uint8_t compId, uint16_t msgId);
1163 void setMessageRate(uint8_t compId, uint16_t msgId, int32_t rate);
1164
1165signals:
1166 // Re-emitted from MessageIntervalManager so existing consumers keep working.
1167 void mavlinkMsgIntervalsChanged(uint8_t compid, uint16_t msgId, int32_t rate);
1168
1169private:
1170 MessageIntervalManager* _messageIntervalManager = nullptr;
1171
1172/*---------------------------------------------------------------------------*/
1173/*===========================================================================*/
1174/* ardupilotmega Dialect */
1175/*===========================================================================*/
1176public:
1177 Q_INVOKABLE void flashBootloader();
1178
1180 Q_INVOKABLE void motorInterlock(bool enable);
1181
1182/*---------------------------------------------------------------------------*/
1183/*===========================================================================*/
1184/* CONTROL STATUS HANDLER */
1185/*===========================================================================*/
1186public:
1187 Q_INVOKABLE void startTimerRevertAllowTakeover();
1188 Q_INVOKABLE void requestOperatorControl(bool allowOverride, int requestTimeoutSecs = 0);
1189
1190private:
1191 void _handleControlStatus(const mavlink_message_t& message);
1192 void _handleCommandRequestOperatorControl(const mavlink_command_long_t commandLong);
1193 static void _requestOperatorControlAckHandler(void* resultHandlerData, int compId, const mavlink_command_ack_t& ack, MavCmdResultFailureCode_t failureCode);
1194
1195 Q_PROPERTY(uint8_t gcsMain READ gcsMain NOTIFY gcsControlStatusChanged)
1196 Q_PROPERTY(bool gcsControlStatusFlags_SystemManager READ gcsControlStatusFlags_SystemManager NOTIFY gcsControlStatusChanged)
1197 Q_PROPERTY(bool gcsControlStatusFlags_TakeoverAllowed READ gcsControlStatusFlags_TakeoverAllowed NOTIFY gcsControlStatusChanged)
1198 Q_PROPERTY(bool firstControlStatusReceived READ firstControlStatusReceived NOTIFY gcsControlStatusChanged)
1199 Q_PROPERTY(int operatorControlTakeoverTimeoutMsecs READ operatorControlTakeoverTimeoutMsecs CONSTANT)
1200 Q_PROPERTY(int requestOperatorControlRemainingMsecs READ requestOperatorControlRemainingMsecs CONSTANT)
1201 Q_PROPERTY(bool sendControlRequestAllowed READ sendControlRequestAllowed NOTIFY sendControlRequestAllowedChanged)
1202
1203 uint8_t gcsMain() const { return _gcsMain; }
1204 bool gcsControlStatusFlags_SystemManager() const { return _gcsControlStatusFlags_SystemManager; }
1205 bool gcsControlStatusFlags_TakeoverAllowed() const { return _gcsControlStatusFlags_TakeoverAllowed; }
1206 bool firstControlStatusReceived() const { return _firstControlStatusReceived; }
1207 int operatorControlTakeoverTimeoutMsecs() const;
1208 int requestOperatorControlRemainingMsecs() const { return _timerRequestOperatorControl.remainingTime(); }
1209 bool sendControlRequestAllowed() const { return _sendControlRequestAllowed; }
1210 void requestOperatorControlStartTimer(int requestTimeoutMsecs);
1211
1212 uint8_t _gcsMain = 0;
1213 uint8_t _gcsControlStatusFlags = 0;
1214 bool _gcsControlStatusFlags_SystemManager = 0;
1215 bool _gcsControlStatusFlags_TakeoverAllowed = 0;
1216 bool _firstControlStatusReceived = false;
1217 QTimer _timerRevertAllowTakeover;
1218 QTimer _timerRequestOperatorControl;
1219 bool _sendControlRequestAllowed = true;
1220
1221signals:
1223 void requestOperatorControlReceived(int sysIdRequestingControl, int allowTakeover, int requestTimeoutSecs);
1224 void sendControlRequestAllowedChanged(bool sendControlRequestAllowed);
1225
1226/*===========================================================================*/
1227/* STATUS TEXT HANDLER */
1228/*===========================================================================*/
1229private:
1231 Q_PROPERTY(QString formattedMessages READ formattedMessages NOTIFY formattedMessagesChanged)
1232
1233 // Q_PROPERTY(StatusTextHandler *statusTextHandler READ statusTextHandler NOTIFY statusTextHandlerChanged)
1234
1235public:
1236 Q_INVOKABLE void clearMessages();
1237
1238 int criticalMessageCount() const;
1239 QString formattedMessages() const;
1240
1241 // StatusTextHandler* statusTextHandler() { return m_statusTextHandler; }
1242
1243signals:
1244 void textMessageReceived(int sysid, int componentid, int severity, QString text, QString description);
1245
1251 void newFormattedMessage(QString formattedMessage);
1252
1253 // void statusTextHandlerChanged();
1254
1255private slots:
1256 void _onStatusTextFromEvent(uint8_t compid, int severity, const QString &text, const QString &description);
1257 void _textMessageReceived(MAV_COMPONENT componentid, MAV_SEVERITY severity, QString text, QString description);
1258 void _errorMessageReceived(QString message);
1259
1260private:
1261 void _createStatusTextHandler();
1262
1263 StatusTextHandler *m_statusTextHandler = nullptr;
1264
1265/*---------------------------------------------------------------------------*/
1266/*===========================================================================*/
1267/* Image Protocol Manager */
1268/*===========================================================================*/
1269private:
1270 Q_PROPERTY(uint flowImageIndex READ flowImageIndex NOTIFY flowImageIndexChanged)
1271
1272public:
1273 uint32_t flowImageIndex() const;
1274
1275signals:
1277
1278private:
1279 void _createImageProtocolManager();
1280 void _createSigningController();
1281
1282 ImageProtocolManager *_imageProtocolManager = nullptr;
1283
1284/*---------------------------------------------------------------------------*/
1285/*===========================================================================*/
1286/* MAVLink Log Manager */
1287/*===========================================================================*/
1288private:
1290
1291public:
1293
1294signals:
1296
1297private:
1298 void _createMAVLinkLogManager();
1299
1300 MAVLinkLogManager *_mavlinkLogManager = nullptr;
1301
1302/*---------------------------------------------------------------------------*/
1303/*===========================================================================*/
1304/* Camera Manager */
1305/*===========================================================================*/
1306private:
1307 Q_MOC_INCLUDE("QGCCameraManager.h")
1309 Q_PROPERTY(QVariantList staticCameraList READ staticCameraList CONSTANT)
1310
1311public:
1312 QGCCameraManager *cameraManager() { return _cameraManager; }
1313 const QVariantList &staticCameraList() const;
1314
1315signals:
1317
1318private:
1319 void _createCameraManager();
1320
1321 QGCCameraManager *_cameraManager = nullptr;
1322
1323/*---------------------------------------------------------------------------*/
1324/*===========================================================================*/
1325/* MAVLinkEventsManager */
1326/*===========================================================================*/
1327private:
1328 Q_MOC_INCLUDE("HealthAndArmingCheckReport.h")
1330
1331public:
1333
1334 void setEventsMetadata(uint8_t compid, const QString& metadataJsonFileName);
1335
1336private:
1337 void _createMAVLinkEventManager();
1338 void _handleEventMessage(const mavlink_message_t& msg);
1339 bool _healthAndArmingChecksSupported(uint8_t compid);
1340
1341 std::unique_ptr<MAVLinkEventManager> _eventManager;
1342};
struct __mavlink_message mavlink_message_t
struct __mavlink_command_ack_t mavlink_command_ack_t
struct __mavlink_command_long_t mavlink_command_long_t
The AutoPilotPlugin class is an abstract base class which represents the methods and objects which ar...
Dynamically manages FactGroupWithIds based on incoming messages.
Used to group Facts together into an object hierarachy.
Definition FactGroup.h:16
The FirmwarePlugin class represents the methods and objects which are specific to a certain Firmware ...
This is the base class for firmware specific geofence managers.
Supports the Mavlink image transmission protocol (https://mavlink.io/en/services/image_transmission....
State machine for initial vehicle connection sequence.
The link interface defines the interface for all links used to communicate with the ground station ap...
Owns per-component EventHandler instances and drives the Health & Arming Check report.
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.
Tracks per-component MAVLink message intervals and mediates SET_MESSAGE_INTERVAL commands plus MESSAG...
Camera Manager.
The QGCMapCircle represents a circular area which can be displayed on a Map control.
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...
Coordinates MAV_CMD_REQUEST_MESSAGE workflows: per-component queueing, ack/message correlation,...
Class which represents sensor info from the SYS_STATUS mavlink message.
NOTE: TerrainAtCoordinateQuery is not thread safe. All instances/calls to ElevationProvider must be o...
Coordinates the terrain-query workflows attached to a Vehicle:
Per-vehicle signing facade. Owns the wiring between Vehicle and the active SigningController (which l...
Q_INVOKABLE void triggerSimpleCamera(void)
Trigger camera using MAV_CMD_DO_DIGICAM_CONTROL command.
Definition Vehicle.cc:3195
bool sub() const
Definition Vehicle.cc:1765
bool readyToFly() const
Definition Vehicle.h:554
bool isInitialConnectComplete() const
Definition Vehicle.cc:2871
Q_INVOKABLE void guidedModeChangeAltitude(double altitudeChange, bool pauseVehicle)
Definition Vehicle.cc:1941
void _setLanding(bool landing)
Definition Vehicle.cc:1842
void autoDisarmChanged()
QGCCameraManager * cameraManager()
Definition Vehicle.h:1312
bool px4Firmware() const
Definition Vehicle.h:512
Q_INVOKABLE void motorInterlock(bool enable)
Command vehicle to Enable/Disable Motor Interlock.
Definition Vehicle.cc:3456
Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust)
Definition Vehicle.cc:1729
int32_t getMessageRate(uint8_t compId, uint16_t msgId)
Definition Vehicle.cc:3415
VehicleDistanceSensorFactGroup * _distanceSensorFactGroup
Definition Vehicle.h:1128
TerrainProtocolHandler * _terrainProtocolHandler
Definition Vehicle.h:1146
void firmwareTypeChanged()
bool hilMode() const
Definition Vehicle.h:561
QGCMAVLink::VehicleClass_t vehicleClass(void) const
Definition Vehicle.h:447
uint32_t effectiveCustomMode() const
Definition Vehicle.h:531
void setInitialGCSPressure(qreal pressure)
Definition Vehicle.h:432
Q_INVOKABLE void flashBootloader()
Definition Vehicle.cc:3444
uint messagesReceived() const
Definition Vehicle.h:515
void sensorsPresentBitsChanged(int sensorsPresentBits)
void airborneChanged(bool airborne)
void defaultHoverSpeedChanged(double hoverSpeed)
const QString _vibrationFactGroupName
Definition Vehicle.h:1105
bool _multirotor_speed_limits_available
Definition Vehicle.h:1096
void gcsControlStatusChanged()
void defaultCruiseSpeedChanged(double cruiseSpeed)
const QString _gpsFactGroupName
Definition Vehicle.h:1102
FactGroup * localPositionFactGroup()
Definition Vehicle.cc:425
void setActuatorsMetadata(uint8_t compid, const QString &metadataJsonFileName, const QJsonDocument &metadataJson)
Definition Vehicle.cc:1276
void haveMRSpeedLimChanged()
FactGroup * vibrationFactGroup()
Definition Vehicle.cc:420
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)
Definition Vehicle.cc:2212
BatteryFactGroupListModel * _batteryFactGroupListModel
Definition Vehicle.h:1143
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)
Definition Vehicle.cc:2173
VehicleLocalPositionFactGroup * _localPositionFactGroup
Definition Vehicle.h:1129
const QString _hygrometerFactGroupName
Definition Vehicle.h:1114
void messagesLostChanged()
Q_INVOKABLE void rebootVehicle()
Reboot vehicle.
Definition Vehicle.cc:2346
VehicleRPMFactGroup * _rpmFactGroup
Definition Vehicle.h:1135
const QString _localPositionFactGroupName
Definition Vehicle.h:1110
VehicleGPSFactGroup * _gps2FactGroup
Definition Vehicle.h:1122
void vtolInFwdFlightChanged(bool vtolInFwdFlight)
qreal getInitialGCSPressure() const
Definition Vehicle.h:430
QString missionFlightMode() const
Definition Vehicle.cc:2600
void readyToFlyAvailableChanged(bool readyToFlyAvailable)
void forceInitialPlanRequestComplete()
Definition Vehicle.cc:2774
void isROIEnabledChanged()
Actuators * actuators() const
Definition Vehicle.h:562
Q_INVOKABLE void guidedModeOrbit(const QGeoCoordinate &centerCoord, double radius, double amslAltitude)
Definition Vehicle.cc:1970
const QString _terrainFactGroupName
Definition Vehicle.h:1113
Actuators * _actuators
Definition Vehicle.h:1154
Autotune * autotune() const
Definition Vehicle.h:601
const QString _temperatureFactGroupName
Definition Vehicle.h:1106
void deleteGimbalController()
Delete gimbal controller, handy for RequestMessageTest.cc, otherwise gimbal controller message reques...
void _offlineVehicleTypeSettingChanged(QVariant varVehicleType)
Definition Vehicle.cc:498
Q_INVOKABLE void guidedModeTakeoff(double altitudeRelative)
Command vehicle to takeoff from current location.
Definition Vehicle.cc:1873
Q_INVOKABLE void sendGripperAction(GRIPPER_ACTIONS gripperOption)
Definition Vehicle.cc:3204
bool haveMRSpeedLimits() const
Definition Vehicle.h:422
QString flightMode() const
Definition Vehicle.cc:1485
bool orbitActive() const
Definition Vehicle.h:551
static QString mavCmdResultFailureCodeToString(MavCmdResultFailureCode_t failureCode)
Definition Vehicle.cc:3435
void setNewStableFirmwareVersion(const QString &version)
Definition Vehicle.cc:2365
QString stabilizedFlightMode() const
Definition Vehicle.cc:2640
int firmwareCustomMajorVersion() const
Definition Vehicle.h:683
const QVariantList & staticCameraList() const
Definition Vehicle.cc:3610
void requestOperatorControlReceived(int sysIdRequestingControl, int allowTakeover, int requestTimeoutSecs)
Q_INVOKABLE QVariant expandedToolbarIndicatorSource(const QString &indicatorName)
Definition Vehicle.cc:3425
uint messagesLost() const
Definition Vehicle.h:517
void sendJoystickAuxRcOverrideThreadSafe(const std::array< uint16_t, kAuxRcOverrideChannelCount > &channelValues, const std::array< bool, kAuxRcOverrideChannelCount > &channelEnabled, bool useRcOverride)
Definition Vehicle.cc:3108
bool vtol() const
Definition Vehicle.cc:1780
void setSoloFirmware(bool soloFirmware)
Definition Vehicle.cc:2502
void mavlinkLogManagerChanged()
void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate, bool sendMultiple=true)
Definition Vehicle.cc:1546
FactGroup * rpmFactGroup()
Definition Vehicle.cc:432
QGeoCoordinate homePosition()
Definition Vehicle.cc:1451
const QString _estimatorStatusFactGroupName
Definition Vehicle.h:1112
const QString _radioStatusFactGroupName
Definition Vehicle.h:1118
QString vehicleImageOutline() const
Definition Vehicle.cc:2653
MissionManager * _missionManager
Definition Vehicle.h:1148
void initialConnectComplete()
VehicleLocalPositionSetpointFactGroup * _localPositionSetpointFactGroup
Definition Vehicle.h:1130
void textMessageReceived(int sysid, int componentid, int severity, QString text, QString description)
void initialPlanRequestCompleteChanged(bool initialPlanRequestComplete)
Q_INVOKABLE double minimumEquivalentAirspeed()
Definition Vehicle.cc:1899
const QString _clockFactGroupName
Definition Vehicle.h:1107
bool rover() const
Definition Vehicle.cc:1760
bool multiRotor() const
Definition Vehicle.cc:1775
Q_INVOKABLE void stopGuidedModeROI()
Definition Vehicle.cc:2030
void firmwareCustomVersionChanged()
QString pauseFlightMode() const
Definition Vehicle.cc:2605
QString prearmError() const
Definition Vehicle.h:491
int sensorsEnabledBits() const
Definition Vehicle.h:534
EscStatusFactGroupListModel * _escStatusFactGroupListModel
Definition Vehicle.h:1144
float latitude()
Definition Vehicle.h:510
const QString _efiFactGroupName
Definition Vehicle.h:1116
void inFwdFlightChanged()
void setFirmwarePluginInstanceData(FirmwarePluginInstanceData *firmwarePluginInstanceData)
Definition Vehicle.cc:2594
Q_INVOKABLE double maximumHorizontalSpeedMultirotorMetersSecond()
Definition Vehicle.cc:1887
bool hasGripper() const
Definition Vehicle.cc:1904
void sendMessageMultiple(mavlink_message_t message)
Definition Vehicle.cc:1604
void capabilityBitsChanged(uint64_t capabilityBits)
bool haveFWSpeedLimits() const
Definition Vehicle.h:423
int sensorsUnhealthyBits() const
Definition Vehicle.h:536
void _setHomePosition(QGeoCoordinate &homeCoord)
Definition Vehicle.cc:1199
void hobbsMeterChanged()
bool airborne() const
Definition Vehicle.h:521
VehicleClockFactGroup * _clockFactGroup
Definition Vehicle.h:1126
uint64_t capabilityBits() const
Definition Vehicle.h:727
int criticalMessageCount() const
Definition Vehicle.cc:3478
Q_INVOKABLE void abortLanding(double climbOutAltitude)
Command vehicle to abort landing.
Definition Vehicle.cc:2083
void setGuidedMode(bool guidedMode)
Definition Vehicle.cc:2097
void readyToFlyChanged(bool readyToFy)
QString firmwareVersionTypeString() const
Definition Vehicle.cc:2319
QString landFlightMode() const
Definition Vehicle.cc:2620
static void showCommandAckError(const mavlink_command_ack_t &ack)
Definition Vehicle.cc:2232
void formattedMessagesChanged()
void newFormattedMessage(QString formattedMessage)
MAV_TYPE vehicleType() const
Definition Vehicle.h:446
VehicleLinkManager * vehicleLinkManager()
Definition Vehicle.h:597
uint32_t customMode() const
Definition Vehicle.h:528
void cameraManagerChanged()
VehicleSigningController * signingController()
Definition Vehicle.h:563
void underwayChanged(bool underway)
Q_INVOKABLE void sendParamMapRC(const QString &paramName, double scale, double centerValue, int tuningID, double minValue, double maxValue)
Sends PARAM_MAP_RC message to vehicle.
Definition Vehicle.cc:2988
HealthAndArmingCheckReport * healthAndArmingCheckReport()
Definition Vehicle.cc:3642
void armedChanged(bool armed)
void firmwareVersionChanged()
FactGroup * distanceSensorFactGroup()
Definition Vehicle.cc:424
void logEntry(uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num)
CheckList checkListState()
Definition Vehicle.h:757
void sendControlRequestAllowedChanged(bool sendControlRequestAllowed)
void hasGripperChanged()
FactGroup * generatorFactGroup()
Definition Vehicle.cc:430
void rcChannelsRawChanged(QVector< int > channelValues)
Q_INVOKABLE void acknowledgeNewStableFirmwareVersion()
Hides the update indicator until a newer stable firmware is released.
Definition Vehicle.cc:2376
FirmwarePlugin * firmwarePlugin()
Provides access to the Firmware Plugin for this Vehicle.
Definition Vehicle.h:462
quint64 mavlinkSentCount() const
Definition Vehicle.h:747
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)
Definition Vehicle.cc:2202
Q_INVOKABLE double minimumTakeoffAltitudeMeters()
Definition Vehicle.cc:1882
InitialConnectStateMachine * _initialConnectStateMachine
Definition Vehicle.h:1153
void sensorsParametersResetAck(bool success)
int firmwareBoardProductId() const
Definition Vehicle.h:687
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)
Definition Vehicle.cc:2178
ComponentInformationManager * compInfoManager()
Definition Vehicle.h:599
bool guidedMode() const
Definition Vehicle.cc:2092
void setEstimatorOrigin_SET_GPS_GLOBAL_ORIGIN(const QGeoCoordinate &centerCoord)
Fallback for setEstimatorOrigin which sends the deprecated SET_GPS_GLOBAL_ORIGIN message.
Definition Vehicle.cc:3232
const QString _distanceSensorFactGroupName
Definition Vehicle.h:1109
Q_INVOKABLE double maximumEquivalentAirspeed()
Definition Vehicle.cc:1893
PIDTuningTelemetryMode
Definition Vehicle.h:388
@ ModeDisabled
Definition Vehicle.h:389
@ ModeAltitudeAndAirspeed
Definition Vehicle.h:392
@ ModeVelocityAndPosition
Definition Vehicle.h:391
@ ModeRateAndAttitude
Definition Vehicle.h:390
void setPrearmError(const QString &prearmError)
Definition Vehicle.cc:2288
VehicleGPSFactGroup * gpsFactGroup()
Definition Vehicle.cc:410
bool landing() const
Definition Vehicle.h:523
VehicleVibrationFactGroup * _vibrationFactGroup
Definition Vehicle.h:1124
qreal getInitialGCSTemperature() const
Definition Vehicle.h:431
void checkListStateChanged()
~Vehicle()
Definition Vehicle.cc:387
void setFirmwareCustomVersion(int majorVersion, int minorVersion, int patchVersion)
Definition Vehicle.cc:2311
Q_INVOKABLE void startTimerRevertAllowTakeover()
Definition Vehicle.cc:3264
VehicleGeneratorFactGroup * _generatorFactGroup
Definition Vehicle.h:1133
const QString _generatorFactGroupName
Definition Vehicle.h:1115
int firmwareMinorVersion() const
Definition Vehicle.h:680
bool isOfflineEditingVehicle() const
Definition Vehicle.h:532
void messagesSentChanged()
quint64 mavlinkLossCount() const
Total number of sucessful messages received.
Definition Vehicle.h:749
Q_INVOKABLE void sendPlan(QString planFile)
Definition Vehicle.cc:2780
bool vtolInFwdFlight() const
Definition Vehicle.h:526
Q_INVOKABLE void startMission()
Definition Vehicle.cc:1915
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...
Definition Vehicle.cc:2222
void capabilitiesKnownChanged(bool capabilitiesKnown)
MAV_AUTOPILOT firmwareType() const
Definition Vehicle.h:445
Q_INVOKABLE void requestOperatorControl(bool allowOverride, int requestTimeoutSecs=0)
Definition Vehicle.cc:3280
void rcChannelsClampedChanged(QVector< int > channelValues)
VehicleEstimatorStatusFactGroup * _estimatorStatusFactGroup
Definition Vehicle.h:1131
VehicleTemperatureFactGroup * _temperatureFactGroup
Definition Vehicle.h:1125
void setCheckListState(CheckList cl)
Definition Vehicle.h:758
bool soloFirmware() const
Definition Vehicle.h:697
void coordinateChanged(QGeoCoordinate coordinate)
QString vehicleImageOpaque() const
Definition Vehicle.cc:2645
float _altitudeTuningOffset
Definition Vehicle.h:1093
Q_INVOKABLE void setPIDTuningTelemetryMode(PIDTuningTelemetryMode mode)
Definition Vehicle.cc:2820
void setRebootRequired()
Latches rebootRequired until the vehicle reboots.
Definition Vehicle.cc:2355
void currentConfigChanged()
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.
Definition Vehicle.cc:2108
void updateFlightDistance(double distance)
Definition Vehicle.cc:2983
int firmwareCustomPatchVersion() const
Definition Vehicle.h:685
int id() const
Definition Vehicle.h:443
Q_INVOKABLE bool guidedModeGotoLocation(const QGeoCoordinate &gotoCoord, double forwardFlightLoiterRadius=0.0f)
Definition Vehicle.cc:1920
void pairRX(int rxType, int rxSubType)
Definition Vehicle.cc:3255
const QString _setpointFactGroupName
Definition Vehicle.h:1108
Q_INVOKABLE void setCurrentMissionSequence(int seq)
Alter the current mission item on the vehicle.
Definition Vehicle.cc:2138
void toolIndicatorsChanged()
void roiRelativeAltitudeMetersChanged()
void sensorsUnhealthyBitsChanged(int sensorsUnhealthyBits)
bool newStableFirmwareVersionAcknowledged() const
Definition Vehicle.h:560
void landingChanged(bool landing)
bool sendMessageOnLinkThreadSafe(LinkInterface *link, mavlink_message_t message)
Definition Vehicle.cc:1401
VehicleWindFactGroup * _windFactGroup
Definition Vehicle.h:1123
bool inFwdFlight() const
Definition Vehicle.cc:2102
const QString _rpmFactGroupName
Definition Vehicle.h:1117
FactGroup * hygrometerFactGroup()
Definition Vehicle.cc:429
static const MAV_AUTOPILOT MAV_AUTOPILOT_TRACK
Definition Vehicle.h:127
Q_INVOKABLE void startTakeoff()
Definition Vehicle.cc:1909
VehicleHygrometerFactGroup * _hygrometerFactGroup
Definition Vehicle.h:1132
void setFlightMode(const QString &flightMode)
Definition Vehicle.cc:1495
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.
Definition Vehicle.cc:2183
float mavlinkLossPercent() const
Total number of lost messages.
Definition Vehicle.h:750
void loadProgressChanged(float value)
QString smartRTLFlightMode() const
Definition Vehicle.cc:2615
static const MAV_TYPE MAV_TYPE_TRACK
Definition Vehicle.h:128
QString followFlightMode() const
Definition Vehicle.cc:2630
bool _fixed_wing_airspeed_limits_available
Definition Vehicle.h:1097
GeoFenceManager * geoFenceManager()
Definition Vehicle.h:593
Q_INVOKABLE void motorTest(int motor, int percent, int timeoutSecs, bool showError)
Definition Vehicle.cc:2510
void mavlinkMessageReceived(const mavlink_message_t &message)
bool requiresGpsFix() const
Definition Vehicle.h:557
void setMessageRate(uint8_t compId, uint16_t msgId, int32_t rate)
Definition Vehicle.cc:3420
Q_INVOKABLE void resetCounters()
< Non-empty when vehicle firmware is older than this stable version
Definition Vehicle.cc:521
const QVariantList & toolIndicators()
Definition Vehicle.cc:2661
void _offlineFirmwareTypeSettingChanged(QVariant varFirmwareType)
Definition Vehicle.cc:485
FactGroup * localPositionSetpointFactGroup()
Definition Vehicle.cc:426
Q_INVOKABLE void guidedModeChangeEquivalentAirspeedMetersSecond(double airspeed)
Definition Vehicle.cc:1961
QmlObjectListModel * escs()
Definition Vehicle.cc:436
void guidedModeChanged(bool guidedMode)
FactGroup * efiFactGroup()
Definition Vehicle.cc:431
void setEventsMetadata(uint8_t compid, const QString &metadataJsonFileName)
Definition Vehicle.cc:3647
QString formattedMessages() const
Definition Vehicle.cc:3482
int _findMavCommandListEntryIndex(int targetCompId, MAV_CMD command)
Test-only helper: forwards to MavCommandQueue::findEntryIndex.
Definition Vehicle.cc:2227
void vehicleUIDChanged()
quint64 vehicleUID() const
Definition Vehicle.h:694
double roiRelativeAltitudeMeters() const
Last commanded ROI altitude in meters above home. Used to preserve the altitude when the ROI is re-po...
Definition Vehicle.h:755
bool autoDisarm()
Definition Vehicle.cc:2681
QGeoCoordinate armedPosition()
Definition Vehicle.h:428
void longitudeChanged()
double loadProgress() const
Definition Vehicle.h:760
RemoteIDManager * remoteIDManager()
Definition Vehicle.h:602
QObject * sysStatusSensorInfo()
Definition Vehicle.cc:438
const QString _vehicleFactGroupName
Definition Vehicle.h:1101
QString motorDetectionFlightMode() const
Definition Vehicle.cc:2635
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)
Definition Vehicle.cc:2217
uint8_t baseMode() const
Definition Vehicle.h:527
VehicleFactGroup * _vehicleFactGroup
Definition Vehicle.h:1120
void rebootRequiredChanged()
bool coaxialMotors()
Definition Vehicle.cc:1436
void orbitActiveChanged(bool orbitActive)
void allSensorsHealthyChanged(bool allSensorsHealthy)
FactGroup * vehicleFactGroup()
Definition Vehicle.h:569
static constexpr int kAuxRcOverrideChannelCount
Sends RC_CHANNELS_OVERRIDE for joystick aux axes mapped to RC channels 5–10 only.
Definition Vehicle.h:439
Q_INVOKABLE void guidedModeRTL(bool smartRTL)
Command vehicle to return to launch.
Definition Vehicle.cc:1855
bool xConfigMotors()
Definition Vehicle.cc:1441
void trackFirmwareVehicleTypeChanges(void)
Definition Vehicle.cc:213
QString newStableFirmwareVersion() const
Definition Vehicle.h:559
Q_INVOKABLE void landingGearDeploy()
Command vichecle to deploy landing gear.
Definition Vehicle.cc:2118
void _setUnderway(bool underway)
Definition Vehicle.cc:1824
void armedPositionChanged()
VehicleEFIFactGroup * _efiFactGroup
Definition Vehicle.h:1134
int motorCount()
Definition Vehicle.cc:1419
void stopMavlinkLog()
Definition Vehicle.cc:2540
static QString requestMessageResultHandlerFailureCodeToString(RequestMessageResultHandlerFailureCode_t failureCode)
Definition Vehicle.cc:3430
RemoteIDManager * _remoteIDManager
Definition Vehicle.h:1155
Q_INVOKABLE void doSetHome(const QGeoCoordinate &coord)
Set home from flight map coordinate.
Definition Vehicle.cc:2934
void soloFirmwareChanged(bool soloFirmware)
ParameterManager * parameterManager() const
Definition Vehicle.h:596
int firmwareVersionType() const
Definition Vehicle.h:682
uint32_t flowImageIndex() const
Definition Vehicle.cc:3577
int compId() const
Definition Vehicle.h:444
void homePositionChanged(const QGeoCoordinate &homePosition)
const VehicleSigningController * signingController() const
Definition Vehicle.h:564
QMap< uint8_t, uint8_t > _lowestBatteryChargeStateAnnouncedMap
Definition Vehicle.h:1091
FactGroup * radioStatusFactGroup()
Definition Vehicle.cc:433
Q_INVOKABLE bool guidedModeROI(const QGeoCoordinate &centerCoord, double relativeAltitudeMeters)
Definition Vehicle.cc:2002
Q_INVOKABLE void pauseVehicle()
Definition Vehicle.cc:2074
double defaultHoverSpeed() const
Definition Vehicle.h:547
void stopTrackingFirmwareVehicleTypeChanges(void)
Definition Vehicle.cc:222
FactGroup * windFactGroup()
Definition Vehicle.cc:419
void flightModesChanged()
const QString _gps2FactGroupName
Definition Vehicle.h:1103
int sensorsHealthBits() const
Definition Vehicle.h:535
FactGroup * temperatureFactGroup()
Definition Vehicle.cc:421
GimbalController * gimbalController()
Definition Vehicle.h:764
bool apmFirmware() const
Definition Vehicle.h:513
Q_INVOKABLE void closeVehicle()
Removes the vehicle from the system.
Definition Vehicle.cc:440
int sensorsPresentBits() const
Definition Vehicle.h:533
void flightModeChanged(const QString &flightMode)
bool allSensorsHealthy() const
Definition Vehicle.h:555
QString gitHash() const
Definition Vehicle.h:693
void flowImageIndexChanged()
void roiCoordChanged(const QGeoCoordinate &centerCoord)
VehicleObjectAvoidance * objectAvoidance()
Definition Vehicle.h:600
bool rebootRequired() const
Definition Vehicle.h:558
Q_INVOKABLE void clearAllParamMapRC(void)
Clears all PARAM_MAP_RC settings from vehicle.
Definition Vehicle.cc:3022
FactGroup * estimatorStatusFactGroup()
Definition Vehicle.cc:427
Q_INVOKABLE void setEstimatorOrigin(const QGeoCoordinate &centerCoord)
Definition Vehicle.cc:3214
void setVtolInFwdFlight(bool vtolInFwdFlight)
Definition Vehicle.cc:2524
Q_INVOKABLE void guidedModeChangeGroundSpeedMetersSecond(double groundspeed)
Definition Vehicle.cc:1951
int defaultComponentId() const
Definition Vehicle.h:700
void setInitialGCSTemperature(qreal temperature)
Definition Vehicle.h:433
void mavlinkStatusChanged()
quint64 mavlinkReceivedCount() const
Calculated total number of messages sent to us.
Definition Vehicle.h:748
MAVLinkLogManager * mavlinkLogManager() const
Definition Vehicle.cc:3592
RallyPointManager * rallyPointManager()
Definition Vehicle.h:594
Q_INVOKABLE void clearMessages()
Definition Vehicle.cc:3473
bool genericFirmware() const
Definition Vehicle.h:514
VehicleGPSFactGroup * gps2FactGroup()
Definition Vehicle.cc:415
FactGroup * setpointFactGroup()
Definition Vehicle.cc:423
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)
Definition Vehicle.cc:3048
QmlObjectListModel * cameraTriggerPoints()
Definition Vehicle.cc:439
FTPManager * _ftpManager
Definition Vehicle.h:1152
GeoFenceManager * _geoFenceManager
Definition Vehicle.h:1149
float longitude()
Definition Vehicle.h:511
QGCMapCircle * orbitMapCircle()
Definition Vehicle.h:552
bool flightModeSetAvailable()
Definition Vehicle.cc:1474
ParameterManager * parameterManager()
Definition Vehicle.h:595
VehicleGPSFactGroup * _gpsFactGroup
Definition Vehicle.h:1121
void gitHashChanged(QString hash)
int firmwareBoardVendorId() const
Definition Vehicle.h:686
void sensorsHealthBitsChanged(int sensorsHealthBits)
Q_INVOKABLE void guidedModeChangeHeading(const QGeoCoordinate &headingCoord)
Definition Vehicle.cc:2064
QString takeControlFlightMode() const
Definition Vehicle.cc:2625
void prepareDelete()
Vehicle is about to be deleted.
AutoPilotPlugin * autopilotPlugin()
Provides access to AutoPilotPlugin for this vehicle.
Definition Vehicle.h:459
bool initialPlanRequestComplete() const
Definition Vehicle.h:733
void messagesReceivedChanged()
const QString _localPositionSetpointFactGroupName
Definition Vehicle.h:1111
void setOfflineEditingDefaultComponentId(int defaultComponentId)
Sets the default component id for an offline editing vehicle.
Definition Vehicle.cc:2515
bool underway() const
Definition Vehicle.h:519
void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType=FIRMWARE_VERSION_TYPE_OFFICIAL)
Definition Vehicle.cc:2302
QString rtlFlightMode() const
Definition Vehicle.cc:2610
bool fixedWing() const
Definition Vehicle.cc:1755
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)
Definition Vehicle.cc:2282
int firmwarePatchVersion() const
Definition Vehicle.h:681
QGeoCoordinate coordinate()
Definition Vehicle.h:427
void startCalibration(QGCMAVLink::CalibrationType calType)
Definition Vehicle.cc:2408
QVector< int > _servoOutputRawValues
Definition Vehicle.h:1140
QString firmwareTypeString() const
Definition Vehicle.cc:516
FTPManager * ftpManager()
Definition Vehicle.h:598
FactGroup * clockFactGroup()
Definition Vehicle.cc:422
void stopCalibration(bool showError)
Definition Vehicle.cc:2488
void newStableFirmwareVersionChanged()
bool isROIEnabled() const
Running loss rate.
Definition Vehicle.h:752
@ CheckListFailed
Definition Vehicle.h:140
@ CheckListNotSetup
Definition Vehicle.h:138
@ CheckListPassed
Definition Vehicle.h:139
QmlObjectListModel * batteries()
Definition Vehicle.cc:435
void haveFWSpeedLimChanged()
RallyPointManager * _rallyPointManager
Definition Vehicle.h:1150
double defaultCruiseSpeed() const
Definition Vehicle.h:546
RadioStatusFactGroup * _radioStatusFactGroup
Definition Vehicle.h:1137
QString gotoFlightMode() const
Definition Vehicle.cc:1850
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)
Definition Vehicle.cc:2207
bool armed() const
Definition Vehicle.h:467
Q_INVOKABLE void landingGearRetract()
Command vichecle to retract landing gear.
Definition Vehicle.cc:2128
VehicleSupports * supports()
Definition Vehicle.h:420
bool capabilitiesKnown() const
Definition Vehicle.h:726
const QString _windFactGroupName
Definition Vehicle.h:1104
void mavCommandResult(int vehicleId, int targetComponent, int command, int ackResult, int failureCode)
int firmwareCustomMinorVersion() const
Definition Vehicle.h:684
void sensorsEnabledBitsChanged(int sensorsEnabledBits)
class FirmwarePluginInstanceData * firmwarePluginInstanceData()
Definition Vehicle.h:715
VehicleSetpointFactGroup * _setpointFactGroup
Definition Vehicle.h:1127
Q_INVOKABLE int versionCompare(const QString &compare) const
Used to check if running current version is equal or higher than the one being compared.
Definition Vehicle.cc:2810
int firmwareMajorVersion() const
Definition Vehicle.h:679
TerrainFactGroup * _terrainFactGroup
Definition Vehicle.h:1136
Q_INVOKABLE void forceArm()
Definition Vehicle.cc:1465
void requiresGpsFixChanged()
void setArmed(bool armed, bool showError)
Definition Vehicle.cc:1456
QStringList flightModes()
Definition Vehicle.cc:1479
void mavlinkMsgIntervalsChanged(uint8_t compid, uint16_t msgId, int32_t rate)
FactGroup * terrainFactGroup()
Definition Vehicle.cc:428
void mavlinkSerialControl(uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, QByteArray data)
Q_INVOKABLE QString vehicleClassInternalName() const
Definition Vehicle.cc:1790
VehicleLinkManager * _vehicleLinkManager
Definition Vehicle.h:1151
void servoOutputsChanged(QVector< int > servoValues)
QString hobbsMeter()
Definition Vehicle.cc:2785
TerrainQueryCoordinator * _terrainQueryCoordinator
Definition Vehicle.h:1159
MissionManager * missionManager()
Definition Vehicle.h:592
void prearmErrorChanged(const QString &prearmError)
void startMavlinkLog()
Definition Vehicle.cc:2535
void vehicleTypeChanged()
Q_INVOKABLE void guidedModeLand()
Command vehicle to land at current location.
Definition Vehicle.cc:1864
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.
Definition Vehicle.cc:2197
uint messagesSent() const
Definition Vehicle.h:516
void setArmedShowError(bool armed)
Definition Vehicle.h:469
bool airship() const
Definition Vehicle.cc:1750
StandardModes * _standardModes
Definition Vehicle.h:1156
QString vehicleUIDStr()
Definition Vehicle.cc:1019
bool spacecraft() const
Definition Vehicle.cc:1770
bool readyToFlyAvailable() const
Definition Vehicle.h:553
QString vehicleTypeString() const
Definition Vehicle.cc:1785
void logData(uint32_t ofs, uint16_t id, uint8_t count, const uint8_t *data)
void criticalMessageCountChanged()
void(* RequestMessageResultHandler)(void *resultHandlerData, MAV_RESULT commandResult, RequestMessageResultHandlerFailureCode_t failureCode, const mavlink_message_t &message)
Callback for requestMessage — delivered when the ack/message pair resolves or a failure occurs.
struct VehicleTypes::MavCmdAckHandlerInfo_s MavCmdAckHandlerInfo_t
Callback info bundle for sendMavCommandWithHandler.
RequestMessageResultHandlerFailureCode_t
static const int versionNotSetValue