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;
55class Autotune;
58class FirmwarePlugin;
59class FTPManager;
60class GeoFenceManager;
64class LinkInterface;
66class MavCommandQueue;
68class MissionManager;
73class RemoteIDManager;
74class RequestMessageTest;
75class RetryableRequestMessageStateTest;
76class SendMavCommandWithHandlerTest;
77class SendMavCommandWithSignallingTest;
78class StandardModes;
84class VehicleSupports;
85
87{
88 Q_OBJECT
89 QML_ELEMENT
90 QML_UNCREATABLE("")
91 Q_MOC_INCLUDE("Actuators.h")
92 Q_MOC_INCLUDE("AutoPilotPlugin.h")
93 Q_MOC_INCLUDE("Autotune.h")
94 Q_MOC_INCLUDE("GimbalController.h")
95 Q_MOC_INCLUDE("LinkInterface.h")
96 Q_MOC_INCLUDE("MAVLinkLogManager.h")
97 Q_MOC_INCLUDE("ParameterManager.h")
98 Q_MOC_INCLUDE("QGCMapCircle.h")
99 Q_MOC_INCLUDE("QmlObjectListModel.h")
100 Q_MOC_INCLUDE("RemoteIDManager.h")
101 Q_MOC_INCLUDE("TrajectoryPoints.h")
102 Q_MOC_INCLUDE("VehicleLinkManager.h")
103 Q_MOC_INCLUDE("VehicleObjectAvoidance.h")
104 Q_MOC_INCLUDE("VehicleSupports.h")
105
107 friend class VehicleLinkManager;
108 friend class FactGroupListModel; // Allow call _addFactGroup
109#ifdef QGC_UNITTEST_BUILD
110 friend class SendMavCommandWithSignallingTest; // Unit test
111 friend class SendMavCommandWithHandlerTest; // Unit test
112 friend class RequestMessageTest; // Unit test
113 friend class RetryableRequestMessageStateTest; // Unit test
114#endif
115 friend class GimbalController; // Allow GimbalController to call _addFactGroup
116
117public:
119 int vehicleId,
121 MAV_AUTOPILOT firmwareType,
122 MAV_TYPE vehicleType,
123 QObject* parent = nullptr);
124
125 // Pass these into the offline constructor to create an offline vehicle which tracks the offline vehicle settings.
126 // Keep these as valid enum values to avoid UBSan failures on enum loads/comparisons.
127 // Use ENUM_END sentinels — no real component should report these values.
128 static const MAV_AUTOPILOT MAV_AUTOPILOT_TRACK = MAV_AUTOPILOT_ENUM_END;
129 static const MAV_TYPE MAV_TYPE_TRACK = MAV_TYPE_ENUM_END;
130
131 // The following is used to create a disconnected Vehicle for use while offline editing.
132 Vehicle(MAV_AUTOPILOT firmwareType,
133 MAV_TYPE vehicleType,
134 QObject* parent = nullptr);
135
136 ~Vehicle();
137
143 Q_ENUM(CheckList)
144
145 Q_PROPERTY(int id READ id CONSTANT)
146 Q_PROPERTY(AutoPilotPlugin* autopilotPlugin MEMBER _autopilotPlugin CONSTANT)
147 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged)
148 Q_PROPERTY(QGeoCoordinate homePosition READ homePosition NOTIFY homePositionChanged)
149 Q_PROPERTY(QGeoCoordinate armedPosition READ armedPosition NOTIFY armedPositionChanged)
150 Q_PROPERTY(bool armed READ armed WRITE setArmedShowError NOTIFY armedChanged)
151 Q_PROPERTY(bool autoDisarm READ autoDisarm NOTIFY autoDisarmChanged)
152 Q_PROPERTY(bool flightModeSetAvailable READ flightModeSetAvailable CONSTANT)
153 Q_PROPERTY(QStringList flightModes READ flightModes NOTIFY flightModesChanged)
154 Q_PROPERTY(QString flightMode READ flightMode WRITE setFlightMode NOTIFY flightModeChanged)
155 Q_PROPERTY(TrajectoryPoints* trajectoryPoints MEMBER _trajectoryPoints CONSTANT)
157 Q_PROPERTY(float latitude READ latitude NOTIFY coordinateChanged)
158 Q_PROPERTY(float longitude READ longitude NOTIFY coordinateChanged)
159 Q_PROPERTY(bool px4Firmware READ px4Firmware NOTIFY firmwareTypeChanged)
160 Q_PROPERTY(bool apmFirmware READ apmFirmware NOTIFY firmwareTypeChanged)
161 Q_PROPERTY(bool soloFirmware READ soloFirmware WRITE setSoloFirmware NOTIFY soloFirmwareChanged)
162 Q_PROPERTY(bool genericFirmware READ genericFirmware CONSTANT)
164 Q_PROPERTY(uint messagesSent READ messagesSent NOTIFY messagesSentChanged)
165 Q_PROPERTY(uint messagesLost READ messagesLost NOTIFY messagesLostChanged)
166 Q_PROPERTY(bool airship READ airship NOTIFY vehicleTypeChanged)
167 Q_PROPERTY(bool fixedWing READ fixedWing NOTIFY vehicleTypeChanged)
168 Q_PROPERTY(bool multiRotor READ multiRotor NOTIFY vehicleTypeChanged)
169 Q_PROPERTY(bool vtol READ vtol NOTIFY vehicleTypeChanged)
170 Q_PROPERTY(bool rover READ rover NOTIFY vehicleTypeChanged)
171 Q_PROPERTY(bool sub READ sub NOTIFY vehicleTypeChanged)
172 Q_PROPERTY(VehicleSupports* supports READ supports CONSTANT)
173 Q_PROPERTY(QString prearmError READ prearmError WRITE setPrearmError NOTIFY prearmErrorChanged)
174 Q_PROPERTY(int motorCount READ motorCount CONSTANT)
175 Q_PROPERTY(bool coaxialMotors READ coaxialMotors CONSTANT)
176 Q_PROPERTY(bool xConfigMotors READ xConfigMotors CONSTANT)
177 Q_PROPERTY(bool isOfflineEditingVehicle READ isOfflineEditingVehicle CONSTANT)
182 Q_PROPERTY(QString missionFlightMode READ missionFlightMode CONSTANT)
183 Q_PROPERTY(QString pauseFlightMode READ pauseFlightMode CONSTANT)
184 Q_PROPERTY(QString rtlFlightMode READ rtlFlightMode CONSTANT)
185 Q_PROPERTY(QString smartRTLFlightMode READ smartRTLFlightMode CONSTANT)
186 Q_PROPERTY(QString landFlightMode READ landFlightMode CONSTANT)
187 Q_PROPERTY(QString takeControlFlightMode READ takeControlFlightMode CONSTANT)
188 Q_PROPERTY(QString followFlightMode READ followFlightMode CONSTANT)
189 Q_PROPERTY(QString motorDetectionFlightMode READ motorDetectionFlightMode CONSTANT)
190 Q_PROPERTY(QString stabilizedFlightMode READ stabilizedFlightMode CONSTANT)
191 Q_PROPERTY(QString firmwareTypeString READ firmwareTypeString NOTIFY firmwareTypeChanged)
192 Q_PROPERTY(QString vehicleTypeString READ vehicleTypeString NOTIFY vehicleTypeChanged)
193 Q_PROPERTY(QString vehicleImageOpaque READ vehicleImageOpaque CONSTANT)
194 Q_PROPERTY(QString vehicleImageOutline READ vehicleImageOutline CONSTANT)
195 Q_PROPERTY(QVariantList toolIndicators READ toolIndicators NOTIFY toolIndicatorsChanged)
197 Q_PROPERTY(QString hobbsMeter READ hobbsMeter NOTIFY hobbsMeterChanged)
198 Q_PROPERTY(bool inFwdFlight READ inFwdFlight NOTIFY inFwdFlightChanged)
200 Q_PROPERTY(quint64 mavlinkSentCount READ mavlinkSentCount NOTIFY mavlinkStatusChanged)
202 Q_PROPERTY(quint64 mavlinkLossCount READ mavlinkLossCount NOTIFY mavlinkStatusChanged)
204 Q_PROPERTY(GimbalController* gimbalController READ gimbalController CONSTANT)
205 Q_PROPERTY(bool hasGripper READ hasGripper NOTIFY hasGripperChanged)
206 Q_PROPERTY(bool isROIEnabled READ isROIEnabled NOTIFY isROIEnabledChanged)
210 Q_PROPERTY(bool readyToFly READ readyToFly NOTIFY readyToFlyChanged)
211 Q_PROPERTY(QObject* sysStatusSensorInfo READ sysStatusSensorInfo CONSTANT)
212 Q_PROPERTY(bool allSensorsHealthy READ allSensorsHealthy NOTIFY allSensorsHealthyChanged) //< true: all sensors in SYS_STATUS reported as healthy
213 Q_PROPERTY(bool requiresGpsFix READ requiresGpsFix NOTIFY requiresGpsFixChanged)
214 Q_PROPERTY(double loadProgress READ loadProgress NOTIFY loadProgressChanged)
216
217 // The following properties relate to Orbit status
218 Q_PROPERTY(bool orbitActive READ orbitActive NOTIFY orbitActiveChanged)
219 Q_PROPERTY(QGCMapCircle* orbitMapCircle READ orbitMapCircle CONSTANT)
220
221 // Vehicle state used for guided control
222 Q_PROPERTY(bool flying READ flying NOTIFY flyingChanged)
223 Q_PROPERTY(bool landing READ landing NOTIFY landingChanged)
224 Q_PROPERTY(bool guidedMode READ guidedMode WRITE setGuidedMode NOTIFY guidedModeChanged)
225 Q_PROPERTY(QString gotoFlightMode READ gotoFlightMode CONSTANT)
228
229 Q_PROPERTY(ParameterManager* parameterManager READ parameterManager CONSTANT)
232 Q_PROPERTY(Autotune* autotune READ autotune CONSTANT)
233 Q_PROPERTY(RemoteIDManager* remoteIDManager READ remoteIDManager CONSTANT)
234
235 // FactGroup object model properties
236
237 Q_PROPERTY(FactGroup* vehicle READ vehicleFactGroup CONSTANT)
238 Q_PROPERTY(FactGroup* gps READ gpsFactGroup CONSTANT)
239 Q_PROPERTY(FactGroup* gps2 READ gps2FactGroup CONSTANT)
240 Q_PROPERTY(FactGroup* gpsAggregate READ gpsAggregateFactGroup CONSTANT)
241 Q_PROPERTY(FactGroup* wind READ windFactGroup CONSTANT)
242 Q_PROPERTY(FactGroup* vibration READ vibrationFactGroup CONSTANT)
243 Q_PROPERTY(FactGroup* temperature READ temperatureFactGroup CONSTANT)
244 Q_PROPERTY(FactGroup* clock READ clockFactGroup CONSTANT)
245 Q_PROPERTY(FactGroup* setpoint READ setpointFactGroup CONSTANT)
246 Q_PROPERTY(FactGroup* estimatorStatus READ estimatorStatusFactGroup CONSTANT)
247 Q_PROPERTY(FactGroup* terrain READ terrainFactGroup CONSTANT)
248 Q_PROPERTY(FactGroup* distanceSensors READ distanceSensorFactGroup CONSTANT)
249 Q_PROPERTY(FactGroup* localPosition READ localPositionFactGroup CONSTANT)
250 Q_PROPERTY(FactGroup* localPositionSetpoint READ localPositionSetpointFactGroup CONSTANT)
251 Q_PROPERTY(FactGroup* hygrometer READ hygrometerFactGroup CONSTANT)
252 Q_PROPERTY(FactGroup* generator READ generatorFactGroup CONSTANT)
253 Q_PROPERTY(FactGroup* efi READ efiFactGroup CONSTANT)
254 Q_PROPERTY(FactGroup* radioStatus READ radioStatusFactGroup CONSTANT)
255 Q_PROPERTY(Actuators* actuators READ actuators CONSTANT)
256
257 // Dynamic FactGroupListModel properties
258 Q_PROPERTY(QmlObjectListModel* batteries READ batteries CONSTANT)
259 Q_PROPERTY(QmlObjectListModel* escs READ escs CONSTANT)
260
269 Q_PROPERTY(QString gitHash READ gitHash NOTIFY gitHashChanged)
270 Q_PROPERTY(quint64 vehicleUID READ vehicleUID NOTIFY vehicleUIDChanged)
271 Q_PROPERTY(QString vehicleUIDStr READ vehicleUIDStr NOTIFY vehicleUIDChanged)
272
274
275
276 Q_INVOKABLE void resetCounters ();
277
278 Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust);
279
281 Q_INVOKABLE void guidedModeRTL(bool smartRTL);
282
284 Q_INVOKABLE void guidedModeLand();
285
287 Q_INVOKABLE void guidedModeTakeoff(double altitudeRelative);
288
290 Q_INVOKABLE double minimumTakeoffAltitudeMeters();
291
294
296 Q_INVOKABLE double maximumEquivalentAirspeed();
297
299 Q_INVOKABLE double minimumEquivalentAirspeed();
300
303 Q_INVOKABLE bool guidedModeGotoLocation(const QGeoCoordinate& gotoCoord, double forwardFlightLoiterRadius = 0.0f);
304
308 Q_INVOKABLE void guidedModeChangeAltitude(double altitudeChange, bool pauseVehicle);
309
312 Q_INVOKABLE void guidedModeChangeHeading(const QGeoCoordinate &headingCoord);
313
316 Q_INVOKABLE void guidedModeChangeGroundSpeedMetersSecond(double groundspeed);
319 Q_INVOKABLE void guidedModeChangeEquivalentAirspeedMetersSecond(double airspeed);
320
325 Q_INVOKABLE void guidedModeOrbit(const QGeoCoordinate& centerCoord, double radius, double amslAltitude);
326
331 Q_INVOKABLE bool guidedModeROI(const QGeoCoordinate &centerCoord, double relativeAltitudeMeters);
332 Q_INVOKABLE void stopGuidedModeROI();
333
336 Q_INVOKABLE void pauseVehicle();
337
339 Q_INVOKABLE void emergencyStop();
340
342 Q_INVOKABLE void abortLanding(double climbOutAltitude);
343
345 Q_INVOKABLE void landingGearDeploy();
346
348 Q_INVOKABLE void landingGearRetract();
349
350 Q_INVOKABLE void startTakeoff();
351
352 Q_INVOKABLE void startMission();
353
355 Q_INVOKABLE void setCurrentMissionSequence(int seq);
356
358 Q_INVOKABLE void rebootVehicle();
359
360 Q_INVOKABLE void sendPlan(QString planFile);
361 Q_INVOKABLE void setEstimatorOrigin(const QGeoCoordinate& centerCoord);
362
364 void setEstimatorOrigin_SET_GPS_GLOBAL_ORIGIN(const QGeoCoordinate& centerCoord);
365
367 // returns 1 if current > compare, 0 if current == compare, -1 if current < compare
368 Q_INVOKABLE int versionCompare(const QString& compare) const;
369 Q_INVOKABLE int versionCompare(int major, int minor, int patch) const;
370
375 Q_INVOKABLE void motorTest(int motor, int percent, int timeoutSecs, bool showError);
376
384
386
387 Q_INVOKABLE void forceArm ();
388
390 Q_INVOKABLE void sendParamMapRC(const QString& paramName, double scale, double centerValue, int tuningID, double minValue, double maxValue);
391
393 Q_INVOKABLE void clearAllParamMapRC(void);
394
396 Q_INVOKABLE void closeVehicle();
397
399 Q_INVOKABLE void triggerSimpleCamera(void);
400
402 Q_INVOKABLE void doSetHome(const QGeoCoordinate& coord);
403
404 Q_INVOKABLE QVariant expandedToolbarIndicatorSource(const QString& indicatorName);
405
406 bool isInitialConnectComplete() const;
407 QString gotoFlightMode () const;
408
409 VehicleSupports* supports() { return _vehicleSupports; }
410 bool hasGripper () const;
413
414 // Property accessors
415
416 QGeoCoordinate coordinate() { return _coordinate; }
417 QGeoCoordinate armedPosition () { return _armedPosition; }
418
419 qreal getInitialGCSPressure() const { return _initialGCSPressure; }
420 qreal getInitialGCSTemperature() const { return _initialGCSTemperature; }
421 void setInitialGCSPressure(qreal pressure) { _initialGCSPressure = pressure; }
422 void setInitialGCSTemperature(qreal temperature) { _initialGCSTemperature = temperature; }
423
424 void updateFlightDistance(double distance);
425
426 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);
428 static constexpr int kAuxRcOverrideChannelCount = 6;
429 void sendJoystickAuxRcOverrideThreadSafe(const std::array<uint16_t, kAuxRcOverrideChannelCount> &channelValues, const std::array<bool, kAuxRcOverrideChannelCount> &channelEnabled, bool useRcOverride);
430
431 // Property accesors
432 int id() const{ return _systemID; }
433 int compId() const{ return _compID; }
434 MAV_AUTOPILOT firmwareType() const { return _firmwareType; }
435 MAV_TYPE vehicleType() const { return _vehicleType; }
437 Q_INVOKABLE QString vehicleClassInternalName() const;
438
442
446
448 AutoPilotPlugin* autopilotPlugin() { return _autopilotPlugin; }
449
451 FirmwarePlugin* firmwarePlugin() { return _firmwarePlugin; }
452
453
454 QGeoCoordinate homePosition();
455
456 bool armed () const{ return _armed; }
457 void setArmed (bool armed, bool showError);
458 void setArmedShowError (bool armed) { setArmed(armed, true); }
459
461 QStringList flightModes ();
462 QString flightMode () const;
463 void setFlightMode (const QString& flightMode);
464
465 bool airship() const;
466
467 void pairRX(int rxType, int rxSubType);
468
469 bool fixedWing() const;
470 bool multiRotor() const;
471 bool vtol() const;
472 bool rover() const;
473 bool sub() const;
474 bool spacecraft() const;
475
476
477
478 void setGuidedMode(bool guidedMode);
479
480 QString prearmError() const { return _prearmError; }
481 void setPrearmError(const QString& prearmError);
482
484
485 //-- Mavlink Logging
486 void startMavlinkLog();
487 void stopMavlinkLog();
488
493 void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate, bool sendMultiple = true);
494
495 // The follow method are used to turn on/off the tracking of settings updates for firmware/vehicle type on offline vehicles.
498
499 float latitude () { return static_cast<float>(_coordinate.latitude()); }
500 float longitude () { return static_cast<float>(_coordinate.longitude()); }
501 bool px4Firmware () const { return _firmwareType == MAV_AUTOPILOT_PX4; }
502 bool apmFirmware () const { return _firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA; }
503 bool genericFirmware () const { return !px4Firmware() && !apmFirmware(); }
504 uint messagesReceived () const{ return _messagesReceived; }
505 uint messagesSent () const{ return _messagesSent; }
506 uint messagesLost () const{ return _messagesLost; }
507 bool flying () const { return _flying; }
508 bool landing () const { return _landing; }
509 bool guidedMode () const;
510 bool inFwdFlight () const;
511 bool vtolInFwdFlight () const { return _vtolInFwdFlight; }
512 uint8_t baseMode () const { return _base_mode; }
513 uint32_t customMode () const { return _custom_mode; }
516 uint32_t effectiveCustomMode () const { return _has_custom_mode_user_intention ? _custom_mode_user_intention : _custom_mode; }
517 bool isOfflineEditingVehicle () const { return _offlineEditingVehicle; }
518 int sensorsPresentBits () const { return static_cast<int>(_onboardControlSensorsPresent); }
519 int sensorsEnabledBits () const { return static_cast<int>(_onboardControlSensorsEnabled); }
520 int sensorsHealthBits () const { return static_cast<int>(_onboardControlSensorsHealth); }
521 int sensorsUnhealthyBits () const { return static_cast<int>(_onboardControlSensorsUnhealthy); }
522 QString missionFlightMode () const;
523 QString pauseFlightMode () const;
524 QString rtlFlightMode () const;
525 QString smartRTLFlightMode () const;
526 QString landFlightMode () const;
527 QString takeControlFlightMode () const;
528 QString followFlightMode () const;
529 QString motorDetectionFlightMode () const;
530 QString stabilizedFlightMode () const;
531 double defaultCruiseSpeed () const { return _defaultCruiseSpeed; }
532 double defaultHoverSpeed () const { return _defaultHoverSpeed; }
533 QString firmwareTypeString () const;
534 QString vehicleTypeString () const;
535 bool autoDisarm ();
536 bool orbitActive () const { return _orbitActive; }
537 QGCMapCircle* orbitMapCircle () { return _orbitMapCircle.get(); }
538 bool readyToFlyAvailable () const{ return _readyToFlyAvailable; }
539 bool readyToFly () const{ return _readyToFly; }
540 bool allSensorsHealthy () const{ return _allSensorsHealthy; }
541 QObject* sysStatusSensorInfo ();
542 bool requiresGpsFix () const { return static_cast<bool>(_onboardControlSensorsPresent & MAV_SYS_STATUS_SENSOR_GPS); }
543 bool hilMode () const { return _base_mode & MAV_MODE_FLAG_HIL_ENABLED; }
544 Actuators* actuators () const { return _actuators; }
545 VehicleSigningController* signingController() { return _signingController; }
546 const VehicleSigningController* signingController() const { return _signingController; }
547
549 void stopCalibration (bool showError);
550
570
573
577 ParameterManager* parameterManager () { return _parameterManager; }
578 ParameterManager* parameterManager () const { return _parameterManager; }
581 ComponentInformationManager* compInfoManager () { return _componentInformationManager; }
582 VehicleObjectAvoidance* objectAvoidance () { return _objectAvoidance; }
583 Autotune* autotune () const { return _autotune; }
585
586 static void showCommandAckError(const mavlink_command_ack_t& ack);
587
594 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);
595 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);
596 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);
597
612 bool isMavCommandPending(int targetCompId, MAV_CMD command);
613
615 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);
616
618
619 // MavCmdProgressHandler, MavCmdResultHandler, MavCmdAckHandlerInfo_t are inherited from VehicleTypes.
620
623 const MavCmdAckHandlerInfo_t* ackHandlerInfo,
624 int compId, MAV_CMD command,
625 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);
626
631 const MavCmdAckHandlerInfo_t* ackHandlerInfo,
632 int compId, MAV_CMD command, MAV_FRAME frame,
633 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);
634
638 std::function<void()> lambda,
639 int compId, MAV_CMD command,
640 bool showError,
641 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);
642
646 std::function<void()> lambda,
647 int compId, MAV_CMD command, MAV_FRAME frame,
648 bool showError,
649 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);
650
651
653
654 // RequestMessageResultHandler is inherited from VehicleTypes.
655
659 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);
660
661 int firmwareMajorVersion() const { return _firmwareMajorVersion; }
662 int firmwareMinorVersion() const { return _firmwareMinorVersion; }
663 int firmwarePatchVersion() const { return _firmwarePatchVersion; }
664 int firmwareVersionType() const { return _firmwareVersionType; }
665 int firmwareCustomMajorVersion() const { return _firmwareCustomMajorVersion; }
666 int firmwareCustomMinorVersion() const { return _firmwareCustomMinorVersion; }
667 int firmwareCustomPatchVersion() const { return _firmwareCustomPatchVersion; }
668 int firmwareBoardVendorId() const { return _firmwareBoardVendorId; }
669 int firmwareBoardProductId() const { return _firmwareBoardProductId; }
670 QString firmwareVersionTypeString() const;
671 void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType = FIRMWARE_VERSION_TYPE_OFFICIAL);
672 void setFirmwareCustomVersion(int majorVersion, int minorVersion, int patchVersion);
673 // versionNotSetValue inherited from VehicleTypes
674
675 QString gitHash() const { return _gitHash; }
676 quint64 vehicleUID() const { return _uid; }
677 QString vehicleUIDStr();
678
679 bool soloFirmware() const { return _soloFirmware; }
680 void setSoloFirmware(bool soloFirmware);
681
682 int defaultComponentId() const{ return _defaultComponentId; }
683
686
688 int motorCount();
689
691 bool coaxialMotors();
692
694 bool xConfigMotors();
695
697 class FirmwarePluginInstanceData* firmwarePluginInstanceData() { return _firmwarePluginInstanceData; }
698
702
703 QString vehicleImageOpaque () const;
704 QString vehicleImageOutline () const;
705
706 const QVariantList& toolIndicators();
707
708 bool capabilitiesKnown () const { return _capabilityBitsKnown; }
709 uint64_t capabilityBits () const { return _capabilityBits; } // Change signalled by capabilityBitsChanged
710
711 QString hobbsMeter ();
712
715 bool initialPlanRequestComplete() const { return _initialPlanRequestComplete; }
716
718
719 void _setFlying(bool flying);
720 void _setLanding(bool landing);
721 void _setHomePosition(QGeoCoordinate& homeCoord);
722
725
728
729 quint64 mavlinkSentCount () const{ return _mavlinkSentCount; }
730 quint64 mavlinkReceivedCount () const{ return _mavlinkReceivedCount; }
731 quint64 mavlinkLossCount () const{ return _mavlinkLossCount; }
732 float mavlinkLossPercent () const{ return _mavlinkLossPercent; }
733
734 bool isROIEnabled () const{ return _isROIEnabled; }
735
737 double roiRelativeAltitudeMeters() const{ return _roiRelativeAltitudeMeters; }
738
739 CheckList checkListState () { return _checkListState; }
740 void setCheckListState (CheckList cl) { _checkListState = cl; emit checkListStateChanged(); }
741
742 double loadProgress () const { return _loadProgress; }
743
744 void setActuatorsMetadata(uint8_t compid, const QString& metadataJsonFileName, const QJsonDocument& metadataJson);
745
746 GimbalController* gimbalController () { return _gimbalController; }
747
748public slots:
750 void _offlineFirmwareTypeSettingChanged (QVariant varFirmwareType); // Should only be used by MissionControler to set firmware from Plan file
751 void _offlineVehicleTypeSettingChanged (QVariant varVehicleType); // Should only be used by MissionController to set vehicle type from Plan file
752 Q_INVOKABLE void sendGripperAction(GRIPPER_ACTIONS gripperOption);
753
754signals:
755 void coordinateChanged (QGeoCoordinate coordinate);
757 void homePositionChanged (const QGeoCoordinate& homePosition);
759 void armedChanged (bool armed);
760 void flightModeChanged (const QString& flightMode);
766 void prearmErrorChanged (const QString& prearmError);
768 void defaultCruiseSpeedChanged (double cruiseSpeed);
769 void defaultHoverSpeedChanged (double hoverSpeed);
788 void readyToFlyChanged (bool readyToFy);
794
797 void gitHashChanged (QString hash);
799 void loadProgressChanged (float value);
800
803 void rcChannelsRawChanged(QVector<int> channelValues);
804
807 void rcChannelsClampedChanged(QVector<int> channelValues);
808
811 void servoOutputsChanged(QVector<int> servoValues);
812
813 // Mavlink Log Download
814 void mavlinkLogData (Vehicle* vehicle, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint8_t first_message, QByteArray data, bool acked);
815
822 void mavCommandResult (int vehicleId, int targetComponent, int command, int ackResult, int failureCode);
823
824 // MAVlink Serial Data
825 void mavlinkSerialControl (uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, QByteArray data);
826
828
831 void roiCoordChanged (const QGeoCoordinate& centerCoord);
833
834 void sensorsParametersResetAck (bool success);
835
836 void logEntry (uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num);
837 void logData (uint32_t ofs, uint16_t id, uint8_t count, const uint8_t* data);
838
839private slots:
840 void _mavlinkMessageReceived (LinkInterface* link, mavlink_message_t message);
841 void _sendMessageMultipleNext ();
842 void _parametersReady (bool parametersReady);
843 void _handleFlightModeChanged (const QString& flightMode);
844 void _announceArmedChanged (bool armed);
845 void _offlineCruiseSpeedSettingChanged (QVariant value);
846 void _offlineHoverSpeedSettingChanged (QVariant value);
847 void _prearmErrorTimeout ();
848 void _firstMissionLoadComplete ();
849 void _firstGeoFenceLoadComplete ();
850 void _firstRallyPointLoadComplete ();
851 void _clearCameraTriggerPoints ();
852 void _updateDistanceHeadingHome ();
853 void _updateMissionItemIndex ();
854 void _updateHeadingToNextWP ();
855 void _updateDistanceHeadingGCS ();
856 void _updateHomepoint ();
857 void _updateHobbsMeter ();
858 void _vehicleParamLoaded (bool ready);
859 void _sendQGCTimeToVehicle ();
860 void _mavlinkMessageStatus (int uasId, uint64_t totalSent, uint64_t totalReceived, uint64_t totalLoss, float lossPercent);
861 void _orbitTelemetryTimeout ();
862 void _updateFlightTime ();
863 void _gotProgressUpdate (float progressValue);
864
865private:
866 void _activeVehicleChanged (Vehicle* newActiveVehicle);
867 void _handlePing (LinkInterface* link, mavlink_message_t& message);
868 void _handleHomePosition (mavlink_message_t& message);
869 void _handleHeartbeat (mavlink_message_t& message);
870 void _handleCurrentMode (mavlink_message_t& message);
871 void _handleRCChannels (mavlink_message_t& message);
872 void _handleBatteryStatus (mavlink_message_t& message);
873 void _handleSysStatus (mavlink_message_t& message);
874 void _handleExtendedSysState (mavlink_message_t& message);
875 void _handleCommandAck (mavlink_message_t& message);
876 void _handleGpsRawInt (mavlink_message_t& message);
877 void _handleGlobalPositionInt (mavlink_message_t& message);
878 void _handleHighLatency (mavlink_message_t& message);
879 void _handleHighLatency2 (mavlink_message_t& message);
880 void _handleOrbitExecutionStatus (const mavlink_message_t& message);
881 void _handleGimbalOrientation (const mavlink_message_t& message);
882 void _handleObstacleDistance (const mavlink_message_t& message);
883 void _handleFenceStatus (const mavlink_message_t& message);
884
885 // ArduPilot dialect messages
886 void _handleCameraFeedback (const mavlink_message_t& message);
887 void _handleCameraImageCaptured (const mavlink_message_t& message);
888 void _handleCommandLong (const mavlink_message_t& message);
889 void _missionManagerError (int errorCode, const QString& errorMsg);
890 void _geoFenceManagerError (int errorCode, const QString& errorMsg);
891 void _rallyPointManagerError (int errorCode, const QString& errorMsg);
892 void _say (const QString& text);
893 QString _vehicleIdSpeech ();
894 void _handleMavlinkLoggingData (mavlink_message_t& message);
895 void _handleMavlinkLoggingDataAcked (mavlink_message_t& message);
896 void _ackMavlinkLogData (uint16_t sequence);
897 void _commonInit (LinkInterface* link);
898 void _setupAutoDisarmSignalling ();
899 void _setCapabilities (uint64_t capabilityBits);
900 void _updateArmed (bool armed);
901 bool _apmArmingNotRequired ();
902 void _initializeCsv ();
903 void _writeCsvLine ();
904 void _flightTimerStart ();
905 void _flightTimerStop ();
906 void _setMessageInterval (int messageId, int rate);
907 bool setFlightModeCustom (const QString& flightMode, uint8_t* base_mode, uint32_t* custom_mode);
908 QString _formatMavCommand (MAV_CMD command, float param1);
909
910 static void _rebootCommandResultHandler(void* resultHandlerData, int compId, const mavlink_command_ack_t& ack, MavCmdResultFailureCode_t failureCode);
911
912 // The following methods should only be called by unit tests
913 void _deleteGimbalController();
914 void _deleteCameraManager();
915
918 void _stopCommandProcessing();
919
920 int _systemID;
921 int _defaultComponentId;
922 bool _offlineEditingVehicle = false;
923
924 MAV_AUTOPILOT _firmwareType;
925 MAV_TYPE _vehicleType;
926 FirmwarePlugin* _firmwarePlugin = nullptr;
927 class FirmwarePluginInstanceData* _firmwarePluginInstanceData = nullptr;
928 AutoPilotPlugin* _autopilotPlugin = nullptr;
929 bool _soloFirmware = false;
930
931 QTimer _csvLogTimer;
932 QFile _csvLogFile;
933
934 bool _isActiveVehicle = false;
935
936 QGeoCoordinate _coordinate;
937 QGeoCoordinate _homePosition;
938 QGeoCoordinate _armedPosition;
939
940 qreal _initialGCSPressure = 0.;
941 qreal _initialGCSTemperature = 0.;
942
943 bool _flying = false;
944 bool _landing = false;
945 bool _vtolInFwdFlight = false;
946 uint32_t _onboardControlSensorsPresent = 0;
947 uint32_t _onboardControlSensorsEnabled = 0;
948 uint32_t _onboardControlSensorsHealth = 0;
949 uint32_t _onboardControlSensorsUnhealthy = 0;
950 bool _gpsRawIntMessageAvailable = false;
951 bool _gps2RawMessageAvailable = false;
952 bool _globalPositionIntMessageAvailable = false;
953 bool _cameraImageCapturedMessageAvailable = false;
954 double _defaultCruiseSpeed = qQNaN();
955 double _defaultHoverSpeed = qQNaN();
956 bool _capabilityBitsKnown = false;
957 uint64_t _capabilityBits = 0;
958 CheckList _checkListState = CheckListNotSetup;
959 bool _readyToFlyAvailable = false;
960 bool _readyToFly = false;
961 bool _allSensorsHealthy = true;
962 VehicleSigningController* _signingController = nullptr;
963 std::atomic<bool> _joystickAuxRcOverrideActive = false;
964
965 std::unique_ptr<SysStatusSensorInfo> _sysStatusSensorInfo;
966
967
968 QString _prearmError;
969 QTimer _prearmErrorTimer;
970 static const int _prearmErrorTimeoutMSecs = 35 * 1000;
971
972 bool _initialPlanRequestComplete = false;
973
974 ParameterManager* _parameterManager = nullptr;
975 ComponentInformationManager* _componentInformationManager = nullptr;
976 VehicleObjectAvoidance* _objectAvoidance = nullptr;
977 Autotune* _autotune = nullptr;
978 GimbalController* _gimbalController = nullptr;
979 VehicleSupports* _vehicleSupports = nullptr;
980
981 bool _armed = false;
982 uint8_t _base_mode = 0;
983 uint32_t _custom_mode = 0;
984 uint32_t _custom_mode_user_intention = 0;
985 bool _has_custom_mode_user_intention = false;
986 QString _lastAnnouncedFlightMode;
987
989 typedef struct {
990 mavlink_message_t message;
991 int retryCount;
992 } SendMessageMultipleInfo_t;
993
994 QList<SendMessageMultipleInfo_t> _sendMessageMultipleList;
995
996 static const int _sendMessageMultipleRetries = 5;
997 static const int _sendMessageMultipleIntraMessageDelay = 500;
998
999 QTimer _sendMultipleTimer;
1000 int _nextSendMessageMultipleIndex = 0;
1001
1002 QElapsedTimer _flightTimer;
1003 QTimer _flightTimeUpdater;
1004 TrajectoryPoints* _trajectoryPoints = nullptr;
1005 std::unique_ptr<QmlObjectListModel> _cameraTriggerPoints;
1006 //QMap<QString, ADSBVehicle*> _trafficVehicleMap;
1007
1008 bool _allLinksRemovedSent = false;
1009
1010 uint _messagesReceived = 0;
1011 uint _messagesSent = 0;
1012 uint _messagesLost = 0;
1013 uint8_t _messageSeq = 0;
1014 uint8_t _compID = 0;
1015 bool _heardFrom = false;
1016
1017 bool _isROIEnabled = false;
1018 double _roiRelativeAltitudeMeters = 0;
1019\
1020 bool _checkLatestStableFWDone = false;
1021 int _firmwareMajorVersion = versionNotSetValue;
1022 int _firmwareMinorVersion = versionNotSetValue;
1023 int _firmwarePatchVersion = versionNotSetValue;
1024 int _firmwareCustomMajorVersion = versionNotSetValue;
1025 int _firmwareCustomMinorVersion = versionNotSetValue;
1026 int _firmwareCustomPatchVersion = versionNotSetValue;
1027 FIRMWARE_VERSION_TYPE _firmwareVersionType = FIRMWARE_VERSION_TYPE_OFFICIAL;
1028
1029 // Vendor and Product as reported from the first autopilot version message
1030 // during the initial connect. They may be zero eg ArduPilot SITL reports 0
1031 // by default.
1032 uint16_t _firmwareBoardVendorId = 0;
1033 uint16_t _firmwareBoardProductId = 0;
1034
1035
1036 QString _gitHash;
1037 quint64 _uid = 0;
1038
1039 uint64_t _mavlinkSentCount = 0;
1040 uint64_t _mavlinkReceivedCount = 0;
1041 uint64_t _mavlinkLossCount = 0;
1042 float _mavlinkLossPercent = 0.0f;
1043
1044 float _loadProgress = 0.0f;
1045
1046 QMap<QString, QTime> _noisySpokenPrearmMap;
1047
1048 // Orbit status values
1049 bool _orbitActive = false;
1050 std::unique_ptr<QGCMapCircle> _orbitMapCircle;
1051 QTimer _orbitTelemetryTimer;
1052 static const int _orbitTelemetryTimeoutMsecs = 3000; // No telemetry for this amount and orbit will go inactive
1053
1054 std::unique_ptr<MAVLinkStreamConfig> _mavlinkStreamConfig;
1055
1056 MavCommandQueue* _mavCmdQueue = nullptr;
1057 RequestMessageCoordinator* _reqMsgCoord = nullptr;
1058
1059public:
1062 static constexpr int _mavCommandMaxRetryCount = 3;
1063 static constexpr int kTestMavCommandAckTimeoutMs = 500;
1065
1067 int _findMavCommandListEntryIndex(int targetCompId, MAV_CMD command);
1068
1069 QMap<uint8_t /* batteryId */, uint8_t /* MAV_BATTERY_CHARGE_STATE_OK */> _lowestBatteryChargeStateAnnouncedMap;
1070
1071 float _altitudeTuningOffset = qQNaN(); // altitude offset, so the plotted value is around 0
1072
1073 // these flags are used to determine if the speed change action from fly view should be shown
1076
1077 // FactGroup facts
1078
1079 const QString _vehicleFactGroupName = QStringLiteral("vehicle");
1080 const QString _gpsFactGroupName = QStringLiteral("gps");
1081 const QString _gps2FactGroupName = QStringLiteral("gps2");
1082 const QString _gpsAggregateFactGroupName = QStringLiteral("gpsAggregate");
1083 const QString _windFactGroupName = QStringLiteral("wind");
1084 const QString _vibrationFactGroupName = QStringLiteral("vibration");
1085 const QString _temperatureFactGroupName = QStringLiteral("temperature");
1086 const QString _clockFactGroupName = QStringLiteral("clock");
1087 const QString _setpointFactGroupName = QStringLiteral("setpoint");
1088 const QString _distanceSensorFactGroupName = QStringLiteral("distanceSensor");
1089 const QString _localPositionFactGroupName = QStringLiteral("localPosition");
1090 const QString _localPositionSetpointFactGroupName = QStringLiteral("localPositionSetpoint");
1091 const QString _estimatorStatusFactGroupName = QStringLiteral("estimatorStatus");
1092 const QString _terrainFactGroupName = QStringLiteral("terrain");
1093 const QString _hygrometerFactGroupName = QStringLiteral("hygrometer");
1094 const QString _generatorFactGroupName = QStringLiteral("generator");
1095 const QString _efiFactGroupName = QStringLiteral("efi");
1096 const QString _rpmFactGroupName = QStringLiteral("rpm");
1097 const QString _radioStatusFactGroupName = QStringLiteral("radioStatus");
1098
1118
1119 // Live SERVO_OUTPUT_RAW values (microseconds). Indexed 0..15 -> SERVO1..SERVO16.
1120 QVector<int> _servoOutputRawValues = QVector<int>(16, -1);
1121
1122 // Dynamic FactGroups
1125
1127
1137
1138 // All terrain query workflows (doSetHome, ROI, altAboveTerrain) live in the coordinator.
1140
1141public:
1142 int32_t getMessageRate(uint8_t compId, uint16_t msgId);
1143 void setMessageRate(uint8_t compId, uint16_t msgId, int32_t rate);
1144
1145signals:
1146 // Re-emitted from MessageIntervalManager so existing consumers keep working.
1147 void mavlinkMsgIntervalsChanged(uint8_t compid, uint16_t msgId, int32_t rate);
1148
1149private:
1150 MessageIntervalManager* _messageIntervalManager = nullptr;
1151
1152/*---------------------------------------------------------------------------*/
1153/*===========================================================================*/
1154/* ardupilotmega Dialect */
1155/*===========================================================================*/
1156public:
1157 Q_INVOKABLE void flashBootloader();
1158
1160 Q_INVOKABLE void motorInterlock(bool enable);
1161
1162/*---------------------------------------------------------------------------*/
1163/*===========================================================================*/
1164/* CONTROL STATUS HANDLER */
1165/*===========================================================================*/
1166public:
1167 Q_INVOKABLE void startTimerRevertAllowTakeover();
1168 Q_INVOKABLE void requestOperatorControl(bool allowOverride, int requestTimeoutSecs = 0);
1169
1170private:
1171 void _handleControlStatus(const mavlink_message_t& message);
1172 void _handleCommandRequestOperatorControl(const mavlink_command_long_t commandLong);
1173 static void _requestOperatorControlAckHandler(void* resultHandlerData, int compId, const mavlink_command_ack_t& ack, MavCmdResultFailureCode_t failureCode);
1174
1175 Q_PROPERTY(uint8_t gcsMain READ gcsMain NOTIFY gcsControlStatusChanged)
1176 Q_PROPERTY(bool gcsControlStatusFlags_SystemManager READ gcsControlStatusFlags_SystemManager NOTIFY gcsControlStatusChanged)
1177 Q_PROPERTY(bool gcsControlStatusFlags_TakeoverAllowed READ gcsControlStatusFlags_TakeoverAllowed NOTIFY gcsControlStatusChanged)
1178 Q_PROPERTY(bool firstControlStatusReceived READ firstControlStatusReceived NOTIFY gcsControlStatusChanged)
1179 Q_PROPERTY(int operatorControlTakeoverTimeoutMsecs READ operatorControlTakeoverTimeoutMsecs CONSTANT)
1180 Q_PROPERTY(int requestOperatorControlRemainingMsecs READ requestOperatorControlRemainingMsecs CONSTANT)
1181 Q_PROPERTY(bool sendControlRequestAllowed READ sendControlRequestAllowed NOTIFY sendControlRequestAllowedChanged)
1182
1183 uint8_t gcsMain() const { return _gcsMain; }
1184 bool gcsControlStatusFlags_SystemManager() const { return _gcsControlStatusFlags_SystemManager; }
1185 bool gcsControlStatusFlags_TakeoverAllowed() const { return _gcsControlStatusFlags_TakeoverAllowed; }
1186 bool firstControlStatusReceived() const { return _firstControlStatusReceived; }
1187 int operatorControlTakeoverTimeoutMsecs() const;
1188 int requestOperatorControlRemainingMsecs() const { return _timerRequestOperatorControl.remainingTime(); }
1189 bool sendControlRequestAllowed() const { return _sendControlRequestAllowed; }
1190 void requestOperatorControlStartTimer(int requestTimeoutMsecs);
1191
1192 uint8_t _gcsMain = 0;
1193 uint8_t _gcsControlStatusFlags = 0;
1194 bool _gcsControlStatusFlags_SystemManager = 0;
1195 bool _gcsControlStatusFlags_TakeoverAllowed = 0;
1196 bool _firstControlStatusReceived = false;
1197 QTimer _timerRevertAllowTakeover;
1198 QTimer _timerRequestOperatorControl;
1199 bool _sendControlRequestAllowed = true;
1200
1201signals:
1203 void requestOperatorControlReceived(int sysIdRequestingControl, int allowTakeover, int requestTimeoutSecs);
1204 void sendControlRequestAllowedChanged(bool sendControlRequestAllowed);
1205
1206/*===========================================================================*/
1207/* STATUS TEXT HANDLER */
1208/*===========================================================================*/
1209private:
1210 Q_PROPERTY(bool messageTypeNone READ messageTypeNone NOTIFY messageTypeChanged)
1211 Q_PROPERTY(bool messageTypeNormal READ messageTypeNormal NOTIFY messageTypeChanged)
1212 Q_PROPERTY(bool messageTypeWarning READ messageTypeWarning NOTIFY messageTypeChanged)
1213 Q_PROPERTY(bool messageTypeError READ messageTypeError NOTIFY messageTypeChanged)
1214 Q_PROPERTY(int messageCount READ messageCount NOTIFY messageCountChanged)
1215 Q_PROPERTY(QString formattedMessages READ formattedMessages NOTIFY formattedMessagesChanged)
1216
1217 // Q_PROPERTY(StatusTextHandler *statusTextHandler READ statusTextHandler NOTIFY statusTextHandlerChanged)
1218
1219public:
1220 Q_INVOKABLE void resetAllMessages();
1221 Q_INVOKABLE void resetErrorLevelMessages();
1222 Q_INVOKABLE void clearMessages();
1223
1224 bool messageTypeNone() const;
1225 bool messageTypeNormal() const;
1226 bool messageTypeWarning() const;
1227 bool messageTypeError() const;
1228 int messageCount() const;
1229 QString formattedMessages() const;
1230
1231 // StatusTextHandler* statusTextHandler() { return m_statusTextHandler; }
1232
1233signals:
1234 void textMessageReceived(int sysid, int componentid, int severity, QString text, QString description);
1235
1242 void newFormattedMessage(QString formattedMessage);
1243
1244 // void statusTextHandlerChanged();
1245
1246private slots:
1247 void _onStatusTextFromEvent(uint8_t compid, int severity, const QString &text, const QString &description);
1248 void _textMessageReceived(MAV_COMPONENT componentid, MAV_SEVERITY severity, QString text, QString description);
1249 void _errorMessageReceived(QString message);
1250
1251private:
1252 void _createStatusTextHandler();
1253
1254 StatusTextHandler *m_statusTextHandler = nullptr;
1255
1256/*---------------------------------------------------------------------------*/
1257/*===========================================================================*/
1258/* Image Protocol Manager */
1259/*===========================================================================*/
1260private:
1261 Q_PROPERTY(uint flowImageIndex READ flowImageIndex NOTIFY flowImageIndexChanged)
1262
1263public:
1264 uint32_t flowImageIndex() const;
1265
1266signals:
1268
1269private:
1270 void _createImageProtocolManager();
1271 void _createSigningController();
1272
1273 ImageProtocolManager *_imageProtocolManager = nullptr;
1274
1275/*---------------------------------------------------------------------------*/
1276/*===========================================================================*/
1277/* MAVLink Log Manager */
1278/*===========================================================================*/
1279private:
1281
1282public:
1284
1285signals:
1287
1288private:
1289 void _createMAVLinkLogManager();
1290
1291 MAVLinkLogManager *_mavlinkLogManager = nullptr;
1292
1293/*---------------------------------------------------------------------------*/
1294/*===========================================================================*/
1295/* Camera Manager */
1296/*===========================================================================*/
1297private:
1298 Q_MOC_INCLUDE("QGCCameraManager.h")
1300 Q_PROPERTY(QVariantList staticCameraList READ staticCameraList CONSTANT)
1301
1302public:
1303 QGCCameraManager *cameraManager() { return _cameraManager; }
1304 const QVariantList &staticCameraList() const;
1305
1306signals:
1308
1309private:
1310 void _createCameraManager();
1311
1312 QGCCameraManager *_cameraManager = nullptr;
1313
1314/*---------------------------------------------------------------------------*/
1315/*===========================================================================*/
1316/* MAVLinkEventsManager */
1317/*===========================================================================*/
1318private:
1319 Q_MOC_INCLUDE("HealthAndArmingCheckReport.h")
1321
1322public:
1324
1325 void setEventsMetadata(uint8_t compid, const QString& metadataJsonFileName);
1326
1327private:
1328 void _createMAVLinkEventManager();
1329 void _handleEventMessage(const mavlink_message_t& msg);
1330 bool _healthAndArmingChecksSupported(uint8_t compid);
1331
1332 std::unique_ptr<MAVLinkEventManager> _eventManager;
1333};
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:3115
bool sub() const
Definition Vehicle.cc:1748
bool readyToFly() const
Definition Vehicle.h:539
bool isInitialConnectComplete() const
Definition Vehicle.cc:2791
Q_INVOKABLE void guidedModeChangeAltitude(double altitudeChange, bool pauseVehicle)
Definition Vehicle.cc:1914
void _setLanding(bool landing)
Definition Vehicle.cc:1815
void autoDisarmChanged()
QGCCameraManager * cameraManager()
Definition Vehicle.h:1303
bool px4Firmware() const
Definition Vehicle.h:501
Q_INVOKABLE void motorInterlock(bool enable)
Command vehicle to Enable/Disable Motor Interlock.
Definition Vehicle.cc:3376
Q_INVOKABLE void virtualTabletJoystickValue(double roll, double pitch, double yaw, double thrust)
Definition Vehicle.cc:1712
int32_t getMessageRate(uint8_t compId, uint16_t msgId)
Definition Vehicle.cc:3335
VehicleDistanceSensorFactGroup * _distanceSensorFactGroup
Definition Vehicle.h:1108
TerrainProtocolHandler * _terrainProtocolHandler
Definition Vehicle.h:1126
void firmwareTypeChanged()
bool hilMode() const
Definition Vehicle.h:543
QGCMAVLink::VehicleClass_t vehicleClass(void) const
Definition Vehicle.h:436
uint32_t effectiveCustomMode() const
Definition Vehicle.h:516
void setInitialGCSPressure(qreal pressure)
Definition Vehicle.h:421
Q_INVOKABLE void flashBootloader()
Definition Vehicle.cc:3364
uint messagesReceived() const
Definition Vehicle.h:504
void sensorsPresentBitsChanged(int sensorsPresentBits)
void defaultHoverSpeedChanged(double hoverSpeed)
const QString _vibrationFactGroupName
Definition Vehicle.h:1084
bool _multirotor_speed_limits_available
Definition Vehicle.h:1074
void gcsControlStatusChanged()
void defaultCruiseSpeedChanged(double cruiseSpeed)
bool messageTypeError() const
Definition Vehicle.cc:3399
const QString _gpsFactGroupName
Definition Vehicle.h:1080
FactGroup * localPositionFactGroup()
Definition Vehicle.cc:420
void setActuatorsMetadata(uint8_t compid, const QString &metadataJsonFileName, const QJsonDocument &metadataJson)
Definition Vehicle.cc:1267
void haveMRSpeedLimChanged()
FactGroup * vibrationFactGroup()
Definition Vehicle.cc:415
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:2185
BatteryFactGroupListModel * _batteryFactGroupListModel
Definition Vehicle.h:1123
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:2146
VehicleLocalPositionFactGroup * _localPositionFactGroup
Definition Vehicle.h:1109
const QString _hygrometerFactGroupName
Definition Vehicle.h:1093
void messagesLostChanged()
Q_INVOKABLE void rebootVehicle()
Reboot vehicle.
Definition Vehicle.cc:2319
FactGroup * gpsAggregateFactGroup()
Definition Vehicle.cc:413
VehicleRPMFactGroup * _rpmFactGroup
Definition Vehicle.h:1115
const QString _localPositionFactGroupName
Definition Vehicle.h:1089
void vtolInFwdFlightChanged(bool vtolInFwdFlight)
qreal getInitialGCSPressure() const
Definition Vehicle.h:419
QString missionFlightMode() const
Definition Vehicle.cc:2520
void readyToFlyAvailableChanged(bool readyToFlyAvailable)
void forceInitialPlanRequestComplete()
Definition Vehicle.cc:2694
void isROIEnabledChanged()
Actuators * actuators() const
Definition Vehicle.h:544
Q_INVOKABLE void guidedModeOrbit(const QGeoCoordinate &centerCoord, double radius, double amslAltitude)
Definition Vehicle.cc:1943
const QString _terrainFactGroupName
Definition Vehicle.h:1092
Actuators * _actuators
Definition Vehicle.h:1134
Autotune * autotune() const
Definition Vehicle.h:583
const QString _temperatureFactGroupName
Definition Vehicle.h:1085
void deleteGimbalController()
Delete gimbal controller, handy for RequestMessageTest.cc, otherwise gimbal controller message reques...
void _offlineVehicleTypeSettingChanged(QVariant varVehicleType)
Definition Vehicle.cc:493
Q_INVOKABLE void guidedModeTakeoff(double altitudeRelative)
Command vehicle to takeoff from current location.
Definition Vehicle.cc:1846
Q_INVOKABLE void sendGripperAction(GRIPPER_ACTIONS gripperOption)
Definition Vehicle.cc:3124
bool haveMRSpeedLimits() const
Definition Vehicle.h:411
QString flightMode() const
Definition Vehicle.cc:1468
bool orbitActive() const
Definition Vehicle.h:536
static QString mavCmdResultFailureCodeToString(MavCmdResultFailureCode_t failureCode)
Definition Vehicle.cc:3355
QString stabilizedFlightMode() const
Definition Vehicle.cc:2560
int firmwareCustomMajorVersion() const
Definition Vehicle.h:665
const QVariantList & staticCameraList() const
Definition Vehicle.cc:3529
void requestOperatorControlReceived(int sysIdRequestingControl, int allowTakeover, int requestTimeoutSecs)
Q_INVOKABLE QVariant expandedToolbarIndicatorSource(const QString &indicatorName)
Definition Vehicle.cc:3345
uint messagesLost() const
Definition Vehicle.h:506
void sendJoystickAuxRcOverrideThreadSafe(const std::array< uint16_t, kAuxRcOverrideChannelCount > &channelValues, const std::array< bool, kAuxRcOverrideChannelCount > &channelEnabled, bool useRcOverride)
Definition Vehicle.cc:3028
bool vtol() const
Definition Vehicle.cc:1763
void setSoloFirmware(bool soloFirmware)
Definition Vehicle.cc:2422
void mavlinkLogManagerChanged()
void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate, bool sendMultiple=true)
Definition Vehicle.cc:1529
FactGroup * rpmFactGroup()
Definition Vehicle.cc:427
QGeoCoordinate homePosition()
Definition Vehicle.cc:1434
const QString _estimatorStatusFactGroupName
Definition Vehicle.h:1091
const QString _radioStatusFactGroupName
Definition Vehicle.h:1097
QString vehicleImageOutline() const
Definition Vehicle.cc:2573
MissionManager * _missionManager
Definition Vehicle.h:1128
void initialConnectComplete()
VehicleLocalPositionSetpointFactGroup * _localPositionSetpointFactGroup
Definition Vehicle.h:1110
void textMessageReceived(int sysid, int componentid, int severity, QString text, QString description)
void initialPlanRequestCompleteChanged(bool initialPlanRequestComplete)
Q_INVOKABLE double minimumEquivalentAirspeed()
Definition Vehicle.cc:1872
const QString _clockFactGroupName
Definition Vehicle.h:1086
bool rover() const
Definition Vehicle.cc:1743
bool multiRotor() const
Definition Vehicle.cc:1758
bool flying() const
Definition Vehicle.h:507
Q_INVOKABLE void stopGuidedModeROI()
Definition Vehicle.cc:2003
void firmwareCustomVersionChanged()
QString pauseFlightMode() const
Definition Vehicle.cc:2525
QString prearmError() const
Definition Vehicle.h:480
int sensorsEnabledBits() const
Definition Vehicle.h:519
EscStatusFactGroupListModel * _escStatusFactGroupListModel
Definition Vehicle.h:1124
float latitude()
Definition Vehicle.h:499
const QString _efiFactGroupName
Definition Vehicle.h:1095
void inFwdFlightChanged()
void flyingChanged(bool flying)
void setFirmwarePluginInstanceData(FirmwarePluginInstanceData *firmwarePluginInstanceData)
Definition Vehicle.cc:2514
Q_INVOKABLE double maximumHorizontalSpeedMultirotorMetersSecond()
Definition Vehicle.cc:1860
bool hasGripper() const
Definition Vehicle.cc:1877
void sendMessageMultiple(mavlink_message_t message)
Definition Vehicle.cc:1587
void capabilityBitsChanged(uint64_t capabilityBits)
bool messageTypeNone() const
Definition Vehicle.cc:3396
bool haveFWSpeedLimits() const
Definition Vehicle.h:412
int sensorsUnhealthyBits() const
Definition Vehicle.h:521
void _setHomePosition(QGeoCoordinate &homeCoord)
Definition Vehicle.cc:1190
void hobbsMeterChanged()
VehicleClockFactGroup * _clockFactGroup
Definition Vehicle.h:1106
uint64_t capabilityBits() const
Definition Vehicle.h:709
Q_INVOKABLE void abortLanding(double climbOutAltitude)
Command vehicle to abort landing.
Definition Vehicle.cc:2056
void setGuidedMode(bool guidedMode)
Definition Vehicle.cc:2070
void readyToFlyChanged(bool readyToFy)
QString firmwareVersionTypeString() const
Definition Vehicle.cc:2292
QString landFlightMode() const
Definition Vehicle.cc:2540
static void showCommandAckError(const mavlink_command_ack_t &ack)
Definition Vehicle.cc:2205
void formattedMessagesChanged()
void newFormattedMessage(QString formattedMessage)
MAV_TYPE vehicleType() const
Definition Vehicle.h:435
VehicleLinkManager * vehicleLinkManager()
Definition Vehicle.h:579
uint32_t customMode() const
Definition Vehicle.h:513
void cameraManagerChanged()
VehicleSigningController * signingController()
Definition Vehicle.h:545
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:2908
HealthAndArmingCheckReport * healthAndArmingCheckReport()
Definition Vehicle.cc:3561
void armedChanged(bool armed)
void firmwareVersionChanged()
FactGroup * distanceSensorFactGroup()
Definition Vehicle.cc:419
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:739
void sendControlRequestAllowedChanged(bool sendControlRequestAllowed)
void hasGripperChanged()
FactGroup * generatorFactGroup()
Definition Vehicle.cc:425
void rcChannelsRawChanged(QVector< int > channelValues)
FirmwarePlugin * firmwarePlugin()
Provides access to the Firmware Plugin for this Vehicle.
Definition Vehicle.h:451
quint64 mavlinkSentCount() const
Definition Vehicle.h:729
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:2175
Q_INVOKABLE double minimumTakeoffAltitudeMeters()
Definition Vehicle.cc:1855
InitialConnectStateMachine * _initialConnectStateMachine
Definition Vehicle.h:1133
void sensorsParametersResetAck(bool success)
int firmwareBoardProductId() const
Definition Vehicle.h:669
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:2151
ComponentInformationManager * compInfoManager()
Definition Vehicle.h:581
bool guidedMode() const
Definition Vehicle.cc:2065
void setEstimatorOrigin_SET_GPS_GLOBAL_ORIGIN(const QGeoCoordinate &centerCoord)
Fallback for setEstimatorOrigin which sends the deprecated SET_GPS_GLOBAL_ORIGIN message.
Definition Vehicle.cc:3152
const QString _distanceSensorFactGroupName
Definition Vehicle.h:1088
Q_INVOKABLE double maximumEquivalentAirspeed()
Definition Vehicle.cc:1866
PIDTuningTelemetryMode
Definition Vehicle.h:377
@ ModeDisabled
Definition Vehicle.h:378
@ ModeAltitudeAndAirspeed
Definition Vehicle.h:381
@ ModeVelocityAndPosition
Definition Vehicle.h:380
@ ModeRateAndAttitude
Definition Vehicle.h:379
void setPrearmError(const QString &prearmError)
Definition Vehicle.cc:2261
bool landing() const
Definition Vehicle.h:508
VehicleVibrationFactGroup * _vibrationFactGroup
Definition Vehicle.h:1104
qreal getInitialGCSTemperature() const
Definition Vehicle.h:420
void checkListStateChanged()
~Vehicle()
Definition Vehicle.cc:388
void setFirmwareCustomVersion(int majorVersion, int minorVersion, int patchVersion)
Definition Vehicle.cc:2284
Q_INVOKABLE void startTimerRevertAllowTakeover()
Definition Vehicle.cc:3184
int messageCount() const
Definition Vehicle.cc:3400
VehicleGeneratorFactGroup * _generatorFactGroup
Definition Vehicle.h:1113
const QString _generatorFactGroupName
Definition Vehicle.h:1094
int firmwareMinorVersion() const
Definition Vehicle.h:662
bool isOfflineEditingVehicle() const
Definition Vehicle.h:517
void messagesSentChanged()
quint64 mavlinkLossCount() const
Total number of sucessful messages received.
Definition Vehicle.h:731
Q_INVOKABLE void sendPlan(QString planFile)
Definition Vehicle.cc:2700
bool vtolInFwdFlight() const
Definition Vehicle.h:511
Q_INVOKABLE void startMission()
Definition Vehicle.cc:1888
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:2195
void capabilitiesKnownChanged(bool capabilitiesKnown)
MAV_AUTOPILOT firmwareType() const
Definition Vehicle.h:434
Q_INVOKABLE void requestOperatorControl(bool allowOverride, int requestTimeoutSecs=0)
Definition Vehicle.cc:3200
void rcChannelsClampedChanged(QVector< int > channelValues)
VehicleEstimatorStatusFactGroup * _estimatorStatusFactGroup
Definition Vehicle.h:1111
VehicleTemperatureFactGroup * _temperatureFactGroup
Definition Vehicle.h:1105
void setCheckListState(CheckList cl)
Definition Vehicle.h:740
bool soloFirmware() const
Definition Vehicle.h:679
void coordinateChanged(QGeoCoordinate coordinate)
QString vehicleImageOpaque() const
Definition Vehicle.cc:2565
float _altitudeTuningOffset
Definition Vehicle.h:1071
Q_INVOKABLE void setPIDTuningTelemetryMode(PIDTuningTelemetryMode mode)
Definition Vehicle.cc:2740
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:2081
void updateFlightDistance(double distance)
Definition Vehicle.cc:2903
int firmwareCustomPatchVersion() const
Definition Vehicle.h:667
int id() const
Definition Vehicle.h:432
const QString _gpsAggregateFactGroupName
Definition Vehicle.h:1082
Q_INVOKABLE bool guidedModeGotoLocation(const QGeoCoordinate &gotoCoord, double forwardFlightLoiterRadius=0.0f)
Definition Vehicle.cc:1893
void pairRX(int rxType, int rxSubType)
Definition Vehicle.cc:3175
const QString _setpointFactGroupName
Definition Vehicle.h:1087
Q_INVOKABLE void setCurrentMissionSequence(int seq)
Alter the current mission item on the vehicle.
Definition Vehicle.cc:2111
FactGroup * gps2FactGroup()
Definition Vehicle.cc:412
void toolIndicatorsChanged()
void roiRelativeAltitudeMetersChanged()
void sensorsUnhealthyBitsChanged(int sensorsUnhealthyBits)
void landingChanged(bool landing)
bool sendMessageOnLinkThreadSafe(LinkInterface *link, mavlink_message_t message)
Definition Vehicle.cc:1392
VehicleWindFactGroup * _windFactGroup
Definition Vehicle.h:1103
bool inFwdFlight() const
Definition Vehicle.cc:2075
const QString _rpmFactGroupName
Definition Vehicle.h:1096
FactGroup * hygrometerFactGroup()
Definition Vehicle.cc:424
static const MAV_AUTOPILOT MAV_AUTOPILOT_TRACK
Definition Vehicle.h:128
Q_INVOKABLE void startTakeoff()
Definition Vehicle.cc:1882
Q_INVOKABLE void resetAllMessages()
Definition Vehicle.cc:3393
VehicleHygrometerFactGroup * _hygrometerFactGroup
Definition Vehicle.h:1112
void setFlightMode(const QString &flightMode)
Definition Vehicle.cc:1478
bool messageTypeWarning() const
Definition Vehicle.cc:3398
static constexpr int kTestMavCommandMaxWaitMs
Definition Vehicle.h:1064
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:2156
float mavlinkLossPercent() const
Total number of lost messages.
Definition Vehicle.h:732
void loadProgressChanged(float value)
QString smartRTLFlightMode() const
Definition Vehicle.cc:2535
static const MAV_TYPE MAV_TYPE_TRACK
Definition Vehicle.h:129
QString followFlightMode() const
Definition Vehicle.cc:2550
bool _fixed_wing_airspeed_limits_available
Definition Vehicle.h:1075
GeoFenceManager * geoFenceManager()
Definition Vehicle.h:575
Q_INVOKABLE void motorTest(int motor, int percent, int timeoutSecs, bool showError)
Definition Vehicle.cc:2430
void mavlinkMessageReceived(const mavlink_message_t &message)
bool requiresGpsFix() const
Definition Vehicle.h:542
void setMessageRate(uint8_t compId, uint16_t msgId, int32_t rate)
Definition Vehicle.cc:3340
Q_INVOKABLE void resetCounters()
< Flight mode vehicle is in while performing goto
Definition Vehicle.cc:516
const QVariantList & toolIndicators()
Definition Vehicle.cc:2581
void _offlineFirmwareTypeSettingChanged(QVariant varFirmwareType)
Definition Vehicle.cc:480
FactGroup * localPositionSetpointFactGroup()
Definition Vehicle.cc:421
Q_INVOKABLE void guidedModeChangeEquivalentAirspeedMetersSecond(double airspeed)
Definition Vehicle.cc:1934
QmlObjectListModel * escs()
Definition Vehicle.cc:431
void guidedModeChanged(bool guidedMode)
FactGroup * efiFactGroup()
Definition Vehicle.cc:426
void setEventsMetadata(uint8_t compid, const QString &metadataJsonFileName)
Definition Vehicle.cc:3566
QString formattedMessages() const
Definition Vehicle.cc:3401
int _findMavCommandListEntryIndex(int targetCompId, MAV_CMD command)
Test-only helper: forwards to MavCommandQueue::findEntryIndex.
Definition Vehicle.cc:2200
void vehicleUIDChanged()
quint64 vehicleUID() const
Definition Vehicle.h:676
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:737
bool autoDisarm()
Definition Vehicle.cc:2601
QGeoCoordinate armedPosition()
Definition Vehicle.h:417
void longitudeChanged()
double loadProgress() const
Definition Vehicle.h:742
RemoteIDManager * remoteIDManager()
Definition Vehicle.h:584
QObject * sysStatusSensorInfo()
Definition Vehicle.cc:433
const QString _vehicleFactGroupName
Definition Vehicle.h:1079
QString motorDetectionFlightMode() const
Definition Vehicle.cc:2555
Q_INVOKABLE void resetErrorLevelMessages()
Definition Vehicle.cc:3394
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:2190
uint8_t baseMode() const
Definition Vehicle.h:512
VehicleFactGroup * _vehicleFactGroup
Definition Vehicle.h:1099
bool coaxialMotors()
Definition Vehicle.cc:1419
void orbitActiveChanged(bool orbitActive)
bool messageTypeNormal() const
Definition Vehicle.cc:3397
void allSensorsHealthyChanged(bool allSensorsHealthy)
FactGroup * vehicleFactGroup()
Definition Vehicle.h:551
static constexpr int kAuxRcOverrideChannelCount
Sends RC_CHANNELS_OVERRIDE for joystick aux axes mapped to RC channels 5–10 only.
Definition Vehicle.h:428
Q_INVOKABLE void guidedModeRTL(bool smartRTL)
Command vehicle to return to launch.
Definition Vehicle.cc:1828
VehicleGPS2FactGroup * _gps2FactGroup
Definition Vehicle.h:1101
bool xConfigMotors()
Definition Vehicle.cc:1424
void trackFirmwareVehicleTypeChanges(void)
Definition Vehicle.cc:212
Q_INVOKABLE void landingGearDeploy()
Command vichecle to deploy landing gear.
Definition Vehicle.cc:2091
static constexpr int kTestMavCommandAckTimeoutMs
Definition Vehicle.h:1063
void armedPositionChanged()
VehicleEFIFactGroup * _efiFactGroup
Definition Vehicle.h:1114
int motorCount()
Definition Vehicle.cc:1410
void stopMavlinkLog()
Definition Vehicle.cc:2460
static QString requestMessageResultHandlerFailureCodeToString(RequestMessageResultHandlerFailureCode_t failureCode)
Definition Vehicle.cc:3350
RemoteIDManager * _remoteIDManager
Definition Vehicle.h:1135
Q_INVOKABLE void doSetHome(const QGeoCoordinate &coord)
Set home from flight map coordinate.
Definition Vehicle.cc:2854
void soloFirmwareChanged(bool soloFirmware)
ParameterManager * parameterManager() const
Definition Vehicle.h:578
int firmwareVersionType() const
Definition Vehicle.h:664
uint32_t flowImageIndex() const
Definition Vehicle.cc:3496
int compId() const
Definition Vehicle.h:433
void homePositionChanged(const QGeoCoordinate &homePosition)
const VehicleSigningController * signingController() const
Definition Vehicle.h:546
QMap< uint8_t, uint8_t > _lowestBatteryChargeStateAnnouncedMap
Definition Vehicle.h:1069
FactGroup * radioStatusFactGroup()
Definition Vehicle.cc:428
Q_INVOKABLE bool guidedModeROI(const QGeoCoordinate &centerCoord, double relativeAltitudeMeters)
Definition Vehicle.cc:1975
Q_INVOKABLE void pauseVehicle()
Definition Vehicle.cc:2047
double defaultHoverSpeed() const
Definition Vehicle.h:532
void stopTrackingFirmwareVehicleTypeChanges(void)
Definition Vehicle.cc:221
FactGroup * windFactGroup()
Definition Vehicle.cc:414
void flightModesChanged()
const QString _gps2FactGroupName
Definition Vehicle.h:1081
int sensorsHealthBits() const
Definition Vehicle.h:520
FactGroup * temperatureFactGroup()
Definition Vehicle.cc:416
GimbalController * gimbalController()
Definition Vehicle.h:746
bool apmFirmware() const
Definition Vehicle.h:502
Q_INVOKABLE void closeVehicle()
Removes the vehicle from the system.
Definition Vehicle.cc:435
int sensorsPresentBits() const
Definition Vehicle.h:518
void flightModeChanged(const QString &flightMode)
bool allSensorsHealthy() const
Definition Vehicle.h:540
QString gitHash() const
Definition Vehicle.h:675
void flowImageIndexChanged()
void roiCoordChanged(const QGeoCoordinate &centerCoord)
VehicleObjectAvoidance * objectAvoidance()
Definition Vehicle.h:582
Q_INVOKABLE void clearAllParamMapRC(void)
Clears all PARAM_MAP_RC settings from vehicle.
Definition Vehicle.cc:2942
void messageTypeChanged()
FactGroup * estimatorStatusFactGroup()
Definition Vehicle.cc:422
Q_INVOKABLE void setEstimatorOrigin(const QGeoCoordinate &centerCoord)
Definition Vehicle.cc:3134
void setVtolInFwdFlight(bool vtolInFwdFlight)
Definition Vehicle.cc:2444
Q_INVOKABLE void guidedModeChangeGroundSpeedMetersSecond(double groundspeed)
Definition Vehicle.cc:1924
int defaultComponentId() const
Definition Vehicle.h:682
void setInitialGCSTemperature(qreal temperature)
Definition Vehicle.h:422
void mavlinkStatusChanged()
quint64 mavlinkReceivedCount() const
Calculated total number of messages sent to us.
Definition Vehicle.h:730
MAVLinkLogManager * mavlinkLogManager() const
Definition Vehicle.cc:3511
RallyPointManager * rallyPointManager()
Definition Vehicle.h:576
Q_INVOKABLE void clearMessages()
Definition Vehicle.cc:3395
bool genericFirmware() const
Definition Vehicle.h:503
FactGroup * setpointFactGroup()
Definition Vehicle.cc:418
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:2968
QmlObjectListModel * cameraTriggerPoints()
Definition Vehicle.cc:434
FTPManager * _ftpManager
Definition Vehicle.h:1132
GeoFenceManager * _geoFenceManager
Definition Vehicle.h:1129
float longitude()
Definition Vehicle.h:500
QGCMapCircle * orbitMapCircle()
Definition Vehicle.h:537
bool flightModeSetAvailable()
Definition Vehicle.cc:1457
ParameterManager * parameterManager()
Definition Vehicle.h:577
VehicleGPSFactGroup * _gpsFactGroup
Definition Vehicle.h:1100
void gitHashChanged(QString hash)
int firmwareBoardVendorId() const
Definition Vehicle.h:668
void sensorsHealthBitsChanged(int sensorsHealthBits)
void _setFlying(bool flying)
Definition Vehicle.cc:1807
Q_INVOKABLE void guidedModeChangeHeading(const QGeoCoordinate &headingCoord)
Definition Vehicle.cc:2037
QString takeControlFlightMode() const
Definition Vehicle.cc:2545
void prepareDelete()
Vehicle is about to be deleted.
AutoPilotPlugin * autopilotPlugin()
Provides access to AutoPilotPlugin for this vehicle.
Definition Vehicle.h:448
bool initialPlanRequestComplete() const
Definition Vehicle.h:715
void messagesReceivedChanged()
const QString _localPositionSetpointFactGroupName
Definition Vehicle.h:1090
void setOfflineEditingDefaultComponentId(int defaultComponentId)
Sets the default component id for an offline editing vehicle.
Definition Vehicle.cc:2435
void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType=FIRMWARE_VERSION_TYPE_OFFICIAL)
Definition Vehicle.cc:2275
QString rtlFlightMode() const
Definition Vehicle.cc:2530
bool fixedWing() const
Definition Vehicle.cc:1738
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:2255
int firmwarePatchVersion() const
Definition Vehicle.h:663
QGeoCoordinate coordinate()
Definition Vehicle.h:416
void startCalibration(QGCMAVLink::CalibrationType calType)
Definition Vehicle.cc:2328
QVector< int > _servoOutputRawValues
Definition Vehicle.h:1120
QString firmwareTypeString() const
Definition Vehicle.cc:511
static constexpr int _mavCommandMaxRetryCount
Definition Vehicle.h:1062
FTPManager * ftpManager()
Definition Vehicle.h:580
FactGroup * clockFactGroup()
Definition Vehicle.cc:417
void stopCalibration(bool showError)
Definition Vehicle.cc:2408
void messageCountChanged()
bool isROIEnabled() const
Running loss rate.
Definition Vehicle.h:734
@ CheckListFailed
Definition Vehicle.h:141
@ CheckListNotSetup
Definition Vehicle.h:139
@ CheckListPassed
Definition Vehicle.h:140
QmlObjectListModel * batteries()
Definition Vehicle.cc:430
void haveFWSpeedLimChanged()
RallyPointManager * _rallyPointManager
Definition Vehicle.h:1130
double defaultCruiseSpeed() const
Definition Vehicle.h:531
RadioStatusFactGroup * _radioStatusFactGroup
Definition Vehicle.h:1117
QString gotoFlightMode() const
Definition Vehicle.cc:1823
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:2180
bool armed() const
Definition Vehicle.h:456
Q_INVOKABLE void landingGearRetract()
Command vichecle to retract landing gear.
Definition Vehicle.cc:2101
VehicleSupports * supports()
Definition Vehicle.h:409
bool capabilitiesKnown() const
Definition Vehicle.h:708
const QString _windFactGroupName
Definition Vehicle.h:1083
void mavCommandResult(int vehicleId, int targetComponent, int command, int ackResult, int failureCode)
VehicleGPSAggregateFactGroup * _gpsAggregateFactGroup
Definition Vehicle.h:1102
FactGroup * gpsFactGroup()
Definition Vehicle.cc:411
int firmwareCustomMinorVersion() const
Definition Vehicle.h:666
void sensorsEnabledBitsChanged(int sensorsEnabledBits)
class FirmwarePluginInstanceData * firmwarePluginInstanceData()
Definition Vehicle.h:697
VehicleSetpointFactGroup * _setpointFactGroup
Definition Vehicle.h:1107
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:2730
int firmwareMajorVersion() const
Definition Vehicle.h:661
TerrainFactGroup * _terrainFactGroup
Definition Vehicle.h:1116
Q_INVOKABLE void forceArm()
Definition Vehicle.cc:1448
void requiresGpsFixChanged()
void setArmed(bool armed, bool showError)
Definition Vehicle.cc:1439
QStringList flightModes()
Definition Vehicle.cc:1462
void mavlinkMsgIntervalsChanged(uint8_t compid, uint16_t msgId, int32_t rate)
FactGroup * terrainFactGroup()
Definition Vehicle.cc:423
void mavlinkSerialControl(uint8_t device, uint8_t flags, uint16_t timeout, uint32_t baudrate, QByteArray data)
Q_INVOKABLE QString vehicleClassInternalName() const
Definition Vehicle.cc:1773
VehicleLinkManager * _vehicleLinkManager
Definition Vehicle.h:1131
void servoOutputsChanged(QVector< int > servoValues)
QString hobbsMeter()
Definition Vehicle.cc:2705
TerrainQueryCoordinator * _terrainQueryCoordinator
Definition Vehicle.h:1139
MissionManager * missionManager()
Definition Vehicle.h:574
void prearmErrorChanged(const QString &prearmError)
void startMavlinkLog()
Definition Vehicle.cc:2455
void vehicleTypeChanged()
Q_INVOKABLE void guidedModeLand()
Command vehicle to land at current location.
Definition Vehicle.cc:1837
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:2170
uint messagesSent() const
Definition Vehicle.h:505
void setArmedShowError(bool armed)
Definition Vehicle.h:458
bool airship() const
Definition Vehicle.cc:1733
StandardModes * _standardModes
Definition Vehicle.h:1136
QString vehicleUIDStr()
Definition Vehicle.cc:1014
bool spacecraft() const
Definition Vehicle.cc:1753
bool readyToFlyAvailable() const
Definition Vehicle.h:538
QString vehicleTypeString() const
Definition Vehicle.cc:1768
void logData(uint32_t ofs, uint16_t id, uint8_t count, const uint8_t *data)
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