diff --git a/qgcresources.qrc b/qgcresources.qrc index 72b12dc336066d81177b1900df407b6137c884b7..ad1f6b519694fa8d1c5c26976774d7ec0ce07290 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -14,6 +14,7 @@ src/QmlControls/arrow-down.png src/VehicleSetup/FirmwareUpgradeIcon.png src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png + src/AutoPilotPlugins/PX4/Images/CameraComponentIcon.png src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_01cell.svg src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_02cell.svg src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_03cell.svg @@ -25,6 +26,7 @@ src/AutoPilotPlugins/PX4/Images/ReturnToHomeAltitude.svg src/AutoPilotPlugins/PX4/Images/SafetyComponentIcon.png src/AutoPilotPlugins/PX4/Images/SensorsComponentIcon.png + src/AutoPilotPlugins/PX4/Images/TuningComponentIcon.png resources/CogWheels.png src/AutoPilotPlugins/PX4/Images/VehicleDown.png src/AutoPilotPlugins/PX4/Images/VehicleDownRotate.png diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 15c1ba3cbf7c30ed75afeaf9d66239b34a852cb7..76b97c5b93e3abb750ab9fc9f565b397cd9fe213 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -560,6 +560,7 @@ HEADERS+= \ src/AutoPilotPlugins/APM/APMAirframeComponent.h \ src/AutoPilotPlugins/APM/APMAirframeComponentController.h \ src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.h \ + src/AutoPilotPlugins/APM/APMCameraComponent.h \ src/AutoPilotPlugins/APM/APMCompassCal.h \ src/AutoPilotPlugins/APM/APMComponent.h \ src/AutoPilotPlugins/APM/APMFlightModesComponent.h \ @@ -614,6 +615,7 @@ SOURCES += \ src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc \ src/AutoPilotPlugins/APM/APMAirframeComponent.cc \ src/AutoPilotPlugins/APM/APMAirframeComponentController.cc \ + src/AutoPilotPlugins/APM/APMCameraComponent.cc \ src/AutoPilotPlugins/APM/APMCompassCal.cc \ src/AutoPilotPlugins/APM/APMComponent.cc \ src/AutoPilotPlugins/APM/APMFlightModesComponent.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index ae36d2193730ff885d6af0c966beb5f666f8f122..07ac0d0eb5a01070a3500bc45604c60bc0329ba6 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -106,6 +106,8 @@ src/AutoPilotPlugins/Common/RadioComponent.qml src/AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml src/AutoPilotPlugins/APM/APMNotSupported.qml + src/AutoPilotPlugins/APM/APMCameraComponent.qml + src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml src/AutoPilotPlugins/APM/APMPowerComponent.qml src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index e0bdf1676fa58d48387ebb35c459615fccb1621b..418edb25eeab26ee2d8e0084c40c459046b95e92 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -39,12 +39,14 @@ #include "APMTuningComponent.h" #include "APMSensorsComponent.h" #include "APMPowerComponent.h" +#include "APMCameraComponent.h" /// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type. APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) : AutoPilotPlugin(vehicle, parent) , _incorrectParameterVersion(false) , _airframeComponent(NULL) + , _cameraComponent(NULL) , _flightModesComponent(NULL) , _powerComponent(NULL) , _radioComponent(NULL) @@ -75,6 +77,10 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) qWarning() << "new APMAirframeComponent failed"; } + _cameraComponent = new APMCameraComponent(_vehicle, this); + _cameraComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent)); + _flightModesComponent = new APMFlightModesComponent(_vehicle, this); if (_flightModesComponent) { _flightModesComponent->setupTriggerSignals(); diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h index 9eedfe9486c949e8dd3e78d6a62dc56b9f44c3a7..67dd583f25c3c8dbe46b7132fdcc7b634a731abc 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h @@ -35,6 +35,7 @@ class APMTuningComponent; class APMSafetyComponent; class APMSensorsComponent; class APMPowerComponent; +class APMCameraComponent; /// This is the APM specific implementation of the AutoPilot class. class APMAutoPilotPlugin : public AutoPilotPlugin @@ -49,6 +50,7 @@ public: virtual const QVariantList& vehicleComponents(void); APMAirframeComponent* airframeComponent (void) { return _airframeComponent; } + APMCameraComponent* cameraComponent (void) { return _cameraComponent; } APMFlightModesComponent* flightModesComponent(void) { return _flightModesComponent; } APMPowerComponent* powerComponent (void) { return _powerComponent; } APMRadioComponent* radioComponent (void) { return _radioComponent; } @@ -65,13 +67,14 @@ private: QVariantList _components; APMAirframeComponent* _airframeComponent; + APMCameraComponent* _cameraComponent; APMFlightModesComponent* _flightModesComponent; APMPowerComponent* _powerComponent; APMRadioComponent* _radioComponent; APMSafetyComponent* _safetyComponent; APMSensorsComponent* _sensorsComponent; APMTuningComponent* _tuningComponent; - APMAirframeLoader* _airframeFacts; + APMAirframeLoader* _airframeFacts; }; #endif diff --git a/src/AutoPilotPlugins/APM/APMCameraComponent.cc b/src/AutoPilotPlugins/APM/APMCameraComponent.cc new file mode 100644 index 0000000000000000000000000000000000000000..d4613e4bf7797adf3cbd86a62fa27622fd68c283 --- /dev/null +++ b/src/AutoPilotPlugins/APM/APMCameraComponent.cc @@ -0,0 +1,88 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2014 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Don Gagne + +#include "APMCameraComponent.h" +#include "QGCQmlWidgetHolder.h" +#include "APMAutoPilotPlugin.h" +#include "APMAirframeComponent.h" + +APMCameraComponent::APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) + : APMComponent(vehicle, autopilot, parent) + , _name(tr("Camera")) +{ +} + +QString APMCameraComponent::name(void) const +{ + return _name; +} + +QString APMCameraComponent::description(void) const +{ + return tr("The Camera Component is used to setup camera and gimbal settings."); +} + +QString APMCameraComponent::iconResource(void) const +{ + return "/qmlimages/CameraComponentIcon.png"; +} + +bool APMCameraComponent::requiresSetup(void) const +{ + return false; +} + +bool APMCameraComponent::setupComplete(void) const +{ + return true; +} + +QStringList APMCameraComponent::setupCompleteChangedTriggerList(void) const +{ + return QStringList(); +} + +QUrl APMCameraComponent::setupSource(void) const +{ + return QUrl::fromUserInput("qrc:/qml/APMCameraComponent.qml"); +} + +QUrl APMCameraComponent::summaryQmlSource(void) const +{ + return QUrl::fromUserInput("qrc:/qml/APMCameraComponentSummary.qml"); +} + +QString APMCameraComponent::prerequisiteSetup(void) const +{ + APMAutoPilotPlugin* plugin = dynamic_cast(_autopilot); + Q_ASSERT(plugin); + + if (!plugin->airframeComponent()->setupComplete()) { + return plugin->airframeComponent()->name(); + } + + return QString(); +} diff --git a/src/AutoPilotPlugins/APM/APMCameraComponent.h b/src/AutoPilotPlugins/APM/APMCameraComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..354c802e7e7774a13af42eaf7a5965db1c9da6df --- /dev/null +++ b/src/AutoPilotPlugins/APM/APMCameraComponent.h @@ -0,0 +1,53 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2014 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +#ifndef APMCameraComponent_H +#define APMCameraComponent_H + +#include "APMComponent.h" + +class APMCameraComponent : public APMComponent +{ + Q_OBJECT + +public: + APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); + + // Virtuals from PX4Component + virtual QStringList setupCompleteChangedTriggerList(void) const; + + // Virtuals from VehicleComponent + virtual QString name(void) const; + virtual QString description(void) const; + virtual QString iconResource(void) const; + virtual bool requiresSetup(void) const; + virtual bool setupComplete(void) const; + virtual QUrl setupSource(void) const; + virtual QUrl summaryQmlSource(void) const; + virtual QString prerequisiteSetup(void) const; + +private: + const QString _name; +}; + +#endif diff --git a/src/AutoPilotPlugins/APM/APMCameraComponent.qml b/src/AutoPilotPlugins/APM/APMCameraComponent.qml new file mode 100644 index 0000000000000000000000000000000000000000..479990f99d0240e1df36dcc83a3aa4624052ab14 --- /dev/null +++ b/src/AutoPilotPlugins/APM/APMCameraComponent.qml @@ -0,0 +1,490 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +import QtQuick 2.5 +import QtQuick.Controls 1.2 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +QGCView { + id: _cameraView + viewPanel: panel + anchors.fill: parent + + FactPanelController { id: controller; factPanel: panel } + + QGCPalette { id: palette; colorGroupEnabled: enabled } + + property Fact _mountRetractX: controller.getParameterFact(-1, "MNT_RETRACT_X") + property Fact _mountRetractY: controller.getParameterFact(-1, "MNT_RETRACT_Y") + property Fact _mountRetractZ: controller.getParameterFact(-1, "MNT_RETRACT_Z") + + property Fact _mountNeutralX: controller.getParameterFact(-1, "MNT_NEUTRAL_X") + property Fact _mountNeutralY: controller.getParameterFact(-1, "MNT_NEUTRAL_Y") + property Fact _mountNeutralZ: controller.getParameterFact(-1, "MNT_NEUTRAL_Z") + + /* + property Fact _mountControlX: controller.getParameterFact(-1, "MNT_CONTROL_X") + property Fact _mountControlY: controller.getParameterFact(-1, "MNT_CONTROL_Y") + property Fact _mountControlZ: controller.getParameterFact(-1, "MNT_CONTROL_Z") + */ + + property Fact _mountRCInTilt: controller.getParameterFact(-1, "MNT_RC_IN_TILT") + property Fact _mountStabTilt: controller.getParameterFact(-1, "MNT_STAB_TILT") + property Fact _mountAngMinTilt: controller.getParameterFact(-1, "MNT_ANGMIN_TIL") + property Fact _mountAngMaxTilt: controller.getParameterFact(-1, "MNT_ANGMAX_TIL") + + property Fact _mountRCInRoll: controller.getParameterFact(-1, "MNT_RC_IN_ROLL") + property Fact _mountStabRoll: controller.getParameterFact(-1, "MNT_STAB_ROLL") + property Fact _mountAngMinRoll: controller.getParameterFact(-1, "MNT_ANGMIN_ROL") + property Fact _mountAngMaxRoll: controller.getParameterFact(-1, "MNT_ANGMAX_ROL") + + property Fact _mountRCInPan: controller.getParameterFact(-1, "MNT_RC_IN_PAN") + property Fact _mountStabPan: controller.getParameterFact(-1, "MNT_STAB_PAN") + property Fact _mountAngMinPan: controller.getParameterFact(-1, "MNT_ANGMIN_PAN") + property Fact _mountAngMaxPan: controller.getParameterFact(-1, "MNT_ANGMAX_PAN") + + // FIXME: WHat do we set this to? APM Planner sets to RC Tracking whenever a value is changed. + // Check default iris settings. + property Fact _mountDefaultMode: controller.getParameterFact(-1, "MNT_DEFLT_MODE") + property Fact _mountType: controller.getParameterFact(-1, "MNT_TYPE") + + property Fact _rc5Function: controller.getParameterFact(-1, "RC5_FUNCTION") + property Fact _rc6Function: controller.getParameterFact(-1, "RC6_FUNCTION") + property Fact _rc7Function: controller.getParameterFact(-1, "RC7_FUNCTION") + property Fact _rc8Function: controller.getParameterFact(-1, "RC8_FUNCTION") + property Fact _rc9Function: controller.getParameterFact(-1, "RC9_FUNCTION") + property Fact _rc10Function: controller.getParameterFact(-1, "RC10_FUNCTION") + property Fact _rc11Function: controller.getParameterFact(-1, "RC11_FUNCTION") + property Fact _rc12Function: controller.getParameterFact(-1, "RC12_FUNCTION") + property Fact _rc13Function: controller.getParameterFact(-1, "RC13_FUNCTION") + property Fact _rc14Function: controller.getParameterFact(-1, "RC14_FUNCTION") + + property bool _tiltEnabled: false + property bool _panEnabled: false + property bool _rollEnabled: false + + readonly property real _margins: ScreenTools.defaultFontPixelHeight + readonly property int _rcFunctionDisabled: 0 + readonly property int _rcFunctionMountPan: 6 + readonly property int _rcFunctionMountTilt: 7 + readonly property int _rcFunctionMountRoll: 8 + readonly property int _firstGimbalOutChannel: 5 + readonly property int _lastGimbalOutChannel: 14 + readonly property int _mountDefaultModeRCTargetting: 3 + + function setGimbalSettingsServoInfo(loader, channel) { + var rcPrefix = "RC" + channel + "_" + + loader.gimbalOutIndex = channel - 4 + loader.servoPWMMinFact = controller.getParameterFact(-1, rcPrefix + "MIN") + loader.servoPWMMaxFact = controller.getParameterFact(-1, rcPrefix + "MAX") + loader.servoReverseFact = controller.getParameterFact(-1, rcPrefix + "REV") + } + + /// Gimbal output channels are stored in RC#_FUNCTION parameters. We need to loop through those + /// to find them and setup the ui accordindly. + function calcGimbalOutValues() { + gimbalDirectionTiltLoader.gimbalOutIndex = 0 + gimbalDirectionPanLoader.gimbalOutIndex = 0 + gimbalDirectionRollLoader.gimbalOutIndex = 0 + _tiltEnabled = false + _panEnabled = false + _rollEnabled = false + for (var channel=_firstGimbalOutChannel; channel<=_lastGimbalOutChannel; channel++) { + var functionFact = controller.getParameterFact(-1, "RC" + channel + "_FUNCTION") + if (functionFact.value == _rcFunctionMountTilt) { + _tiltEnabled = true + setGimbalSettingsServoInfo(gimbalDirectionTiltLoader, channel) + } else if (functionFact.value == _rcFunctionMountPan) { + _panEnabled = true + setGimbalSettingsServoInfo(gimbalDirectionPanLoader, channel) + } else if (functionFact.value == _rcFunctionMountRoll) { + _rollEnabled = true + setGimbalSettingsServoInfo(gimbalDirectionRollLoader, channel) + } + } + } + + function setRCFunction(channel, rcFunction) { + // First clear any previous settings for this function + for (var index=_firstGimbalOutChannel; index<=_lastGimbalOutChannel; index++) { + var functionFact = controller.getParameterFact(-1, "RC" + index + "_FUNCTION") + if (functionFact.value != _rcFunctionDisabled && functionFact.value == rcFunction) { + functionFact.value = _rcFunctionDisabled + } + } + + // Now set the function into the new channel + if (channel != 0) { + var functionFact = controller.getParameterFact(-1, "RC" + channel + "_FUNCTION") + functionFact.value = rcFunction + } + } + + Component.onCompleted: calcGimbalOutValues() + + // Whenever any RC#_FUNCTION parameters chagnes we need to go looking for gimbal output channels again + Connections { target: _rc5Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc6Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc7Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc8Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc9Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc10Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc11Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc12Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc13Function; onValueChanged: calcGimbalOutValues() } + Connections { target: _rc14Function; onValueChanged: calcGimbalOutValues() } + + // Whenever an MNT_RC_IN_* setting is changed make sure to turn on RC targetting + Connections { + target: _mountRCInPan + onValueChanged: _mountDefaultMode.value = _mountDefaultModeRCTargetting + } + + Connections { + target: _mountRCInRoll + onValueChanged: _mountDefaultMode.value = _mountDefaultModeRCTargetting + } + + Connections { + target: _mountRCInTilt + onValueChanged: _mountDefaultMode.value = _mountDefaultModeRCTargetting + } + + ListModel { + id: gimbalOutModel + ListElement { text: "Disabled"; value: 0 } + ListElement { text: "Channel 5"; value: 5 } + ListElement { text: "Channel 6"; value: 6 } + ListElement { text: "Channel 7"; value: 7 } + ListElement { text: "Channel 8"; value: 8 } + ListElement { text: "Channel 9"; value: 9 } + ListElement { text: "Channel 10"; value: 10 } + ListElement { text: "Channel 11"; value: 11 } + ListElement { text: "Channel 12"; value: 12 } + ListElement { text: "Channel 13"; value: 13 } + ListElement { text: "Channel 14"; value: 14 } + } + + Component { + id: gimbalDirectionSettings + + // The following properties must be set in the Loader + // property string directionTitle + // property bool directionEnabled + // property int gimbalOutIndex + // property Fact mountRcInFact + // property Fact mountStabFact + // property Fact mountAngMinFact + // property Fact mountAngMaxFact + // property Fact servoPWMMinFact + // property Fact servoPWMMaxFact + // property Fact servoReverseFact + // property int rcFunction + + Item { + width: rectangle.x + rectangle.width + height: rectangle.y + rectangle.height + + QGCLabel { + id: directionLabel + text: "Gimbal " + directionTitle + font.weight: Font.DemiBold + } + + Rectangle { + id: rectangle + anchors.topMargin: _margins / 2 + anchors.left: parent.left + anchors.top: directionLabel.bottom + width: mountAngMaxField.x + mountAngMaxField.width + _margins + height: servoPWMMaxField.y + servoPWMMaxField.height + _margins + color: palette.windowShade + + FactCheckBox { + id: mountStabCheckBox + anchors.topMargin: _margins + anchors.left: servoReverseCheckBox.left + anchors.top: parent.top + text: "Stabilize" + fact: mountStabFact + checkedValue: 1 + uncheckedValue: 0 + enabled: directionEnabled + } + + FactCheckBox { + id: servoReverseCheckBox + anchors.margins: _margins + anchors.top: mountStabCheckBox.bottom + anchors.right: parent.right + text: "Servo reverse" + checkedValue: 1 + uncheckedValue: 0 + fact: servoReverseFact + enabled: directionEnabled + } + + QGCLabel { + id: gimbalOutLabel + anchors.margins: _margins + anchors.left: parent.left + anchors.baseline: gimbalOutCombo.baseline + text: "Output channel:" + } + + QGCComboBox { + id: gimbalOutCombo + anchors.margins: _margins + anchors.top: parent.top + anchors.left: gimbalOutLabel.right + width: mountAngMinField.width + model: gimbalOutModel + currentIndex: gimbalOutIndex + + onActivated: setRCFunction(gimbalOutModel.get(index).value, rcFunction) + } + + QGCLabel { + id: mountRcInLabel + anchors.margins: _margins + anchors.left: parent.left + anchors.baseline: mountRcInCombo.baseline + text: "Input channel:" + enabled: directionEnabled + } + + FactComboBox { + id: mountRcInCombo + anchors.topMargin: _margins / 2 + anchors.top: gimbalOutCombo.bottom + anchors.left: gimbalOutCombo.left + width: mountAngMinField.width + fact: mountRcInFact + indexModel: false + enabled: directionEnabled + } + + QGCLabel { + id: mountAngLabel + anchors.margins: _margins + anchors.left: parent.left + anchors.baseline: mountAngMinField.baseline + text: "Gimbal angle limits:" + enabled: directionEnabled + } + + QGCLabel { + id: mountAngMinLabel + anchors.margins: _margins + anchors.left: mountAngLabel.right + anchors.baseline: mountAngMinField.baseline + text: "min" + enabled: directionEnabled + } + + FactTextField { + id: mountAngMinField + anchors.margins: _margins + anchors.top: mountRcInCombo.bottom + anchors.left: mountAngMinLabel.right + fact: mountAngMinFact + enabled: directionEnabled + } + + QGCLabel { + id: mountAngMaxLabel + anchors.margins: _margins + anchors.left: mountAngMinField.right + anchors.baseline: mountAngMinField.baseline + text: "max" + enabled: directionEnabled + } + + FactTextField { + id: mountAngMaxField + anchors.leftMargin: _margins + anchors.top: mountAngMinField.top + anchors.left: mountAngMaxLabel.right + fact: mountAngMaxFact + enabled: directionEnabled + } + + QGCLabel { + id: servoPWMLabel + anchors.margins: _margins + anchors.left: parent.left + anchors.baseline: servoPWMMinField.baseline + text: "Servo PWM limits:" + enabled: directionEnabled + } + + QGCLabel { + id: servoPWMMinLabel + anchors.left: mountAngMinLabel.left + anchors.baseline: servoPWMMinField.baseline + text: "min" + enabled: directionEnabled + } + + FactTextField { + id: servoPWMMinField + anchors.topMargin: _margins / 2 + anchors.leftMargin: _margins + anchors.top: mountAngMaxField.bottom + anchors.left: servoPWMMinLabel.right + fact: servoPWMMinFact + enabled: directionEnabled + } + + QGCLabel { + id: servoPWMMaxLabel + anchors.margins: _margins + anchors.left: servoPWMMinField.right + anchors.baseline: servoPWMMinField.baseline + text: "max" + enabled: directionEnabled + } + + FactTextField { + id: servoPWMMaxField + anchors.leftMargin: _margins + anchors.top: servoPWMMinField.top + anchors.left: servoPWMMaxLabel.right + fact: servoPWMMaxFact + enabled: directionEnabled + } + } // Rectangle + } // Item + } // Component - gimbalDirectionSettings + + QGCViewPanel { + id: panel + anchors.fill: parent + + Flickable { + clip: true + anchors.fill: parent + contentHeight: gimbalDirectionPanLoader.y + gimbalDirectionPanLoader.height + contentWidth: gimbalTypeRectangle.x + gimbalTypeRectangle.width + + Loader { + id: gimbalDirectionTiltLoader + sourceComponent: gimbalDirectionSettings + + property string directionTitle: "Tilt" + property bool directionEnabled: _tiltEnabled + property int gimbalOutIndex: 0 + property Fact mountRcInFact: _mountRCInTilt + property Fact mountStabFact: _mountStabTilt + property Fact mountAngMinFact: _mountAngMinTilt + property Fact mountAngMaxFact: _mountAngMaxTilt + property Fact servoPWMMinFact: Fact { } + property Fact servoPWMMaxFact: Fact { } + property Fact servoReverseFact: Fact { } + property int rcFunction: _rcFunctionMountTilt + } + + Loader { + id: gimbalDirectionRollLoader + anchors.margins: _margins + anchors.top: gimbalDirectionTiltLoader.bottom + sourceComponent: gimbalDirectionSettings + + property string directionTitle: "Roll" + property bool directionEnabled: _rollEnabled + property int gimbalOutIndex: 0 + property Fact mountRcInFact: _mountRCInRoll + property Fact mountStabFact: _mountStabRoll + property Fact mountAngMinFact: _mountAngMinRoll + property Fact mountAngMaxFact: _mountAngMaxRoll + property Fact servoPWMMinFact: Fact { } + property Fact servoPWMMaxFact: Fact { } + property Fact servoReverseFact: Fact { } + property int rcFunction: _rcFunctionMountRoll + } + + Loader { + id: gimbalDirectionPanLoader + anchors.margins: _margins + anchors.top: gimbalDirectionRollLoader.bottom + sourceComponent: gimbalDirectionSettings + + property string directionTitle: "Pan" + property bool directionEnabled: _panEnabled + property int gimbalOutIndex: 0 + property Fact mountRcInFact: _mountRCInPan + property Fact mountStabFact: _mountStabPan + property Fact mountAngMinFact: _mountAngMinPan + property Fact mountAngMaxFact: _mountAngMaxPan + property Fact servoPWMMinFact: Fact { } + property Fact servoPWMMaxFact: Fact { } + property Fact servoReverseFact: Fact { } + property int rcFunction: _rcFunctionMountPan + } + + QGCLabel { + id: typeLabel + anchors.leftMargin: _margins + anchors.left: gimbalDirectionTiltLoader.right + text: "Gimbal Type" + font.weight: Font.DemiBold + } + + Rectangle { + id: gimbalTypeRectangle + anchors.topMargin: _margins / 2 + anchors.left: typeLabel.left + anchors.top: typeLabel.bottom + width: rebootLabel.x + rebootLabel.width + _margins + height: rebootLabel.y + rebootLabel.height + _margins + color: palette.windowShade + + FactComboBox { + id: gimbalTypeCombo + anchors.margins: _margins + anchors.top: parent.top + anchors.left: parent.left + width: ScreenTools.defaultFontPixelWidth * 15 + fact: _mountType + indexModel: false + } + + QGCLabel { + id: rebootLabel + anchors.topMargin: _margins / 2 + anchors.left: gimbalTypeCombo.left + anchors.top: gimbalTypeCombo.bottom + width: ScreenTools.defaultFontPixelWidth * 25 + wrapMode: Text.WordWrap + text: "Gimbal Type changes takes affect next reboot of autopilot" + } + } + } // Flickable + } // QGCViewPanel +} // QGCView diff --git a/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml b/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml new file mode 100644 index 0000000000000000000000000000000000000000..62ebfae01fbafaa52fde7b30b85674c4b803d01d --- /dev/null +++ b/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml @@ -0,0 +1,46 @@ +import QtQuick 2.5 +import QtQuick.Controls 1.2 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 + +FactPanel { + id: panel + anchors.fill: parent + color: qgcPal.windowShadeDark + + QGCPalette { id: qgcPal; colorGroupEnabled: enabled } + FactPanelController { id: controller; factPanel: panel } + + property Fact _mountRCInTilt: controller.getParameterFact(-1, "MNT_RC_IN_TILT") + property Fact _mountRCInRoll: controller.getParameterFact(-1, "MNT_RC_IN_ROLL") + property Fact _mountRCInPan: controller.getParameterFact(-1, "MNT_RC_IN_PAN") + property Fact _mountType: controller.getParameterFact(-1, "MNT_TYPE") + + Column { + anchors.fill: parent + anchors.margins: 8 + + VehicleSummaryRow { + labelText: "Gimbal type:" + valueText: _mountType.enumStringValue + } + + VehicleSummaryRow { + labelText: "Tilt input channel:" + valueText: _mountRCInTilt.enumStringValue + } + + VehicleSummaryRow { + labelText: "Pan input channel:" + valueText: _mountRCInPan.enumStringValue + } + + VehicleSummaryRow { + labelText: "Roll input channel:" + valueText: _mountRCInRoll.enumStringValue + } + } +} diff --git a/src/AutoPilotPlugins/APM/APMTuningComponent.cc b/src/AutoPilotPlugins/APM/APMTuningComponent.cc index 7275d9829a98d771b201a287993715678f9b69f0..e8dfdcd6bae48c6f6519649b64ff5c0e2a4a0df0 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponent.cc +++ b/src/AutoPilotPlugins/APM/APMTuningComponent.cc @@ -43,7 +43,7 @@ QString APMTuningComponent::description(void) const QString APMTuningComponent::iconResource(void) const { - return "/qmlimages/subMenuButtonImage.png"; + return "/qmlimages/TuningComponentIcon.png"; } bool APMTuningComponent::requiresSetup(void) const diff --git a/src/AutoPilotPlugins/PX4/Images/CameraComponentIcon.png b/src/AutoPilotPlugins/PX4/Images/CameraComponentIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..cc784b2e028b0e6ebf13c1679c807672fa1fca15 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/Images/CameraComponentIcon.png differ diff --git a/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png b/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png index cba13b67525fa2e315ea53d7ac3e0eb3474cb834..83f6caf8f85a2652bad7cf78668177a14c8f40cf 100644 Binary files a/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png and b/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png differ diff --git a/src/AutoPilotPlugins/PX4/Images/TuningComponentIcon.png b/src/AutoPilotPlugins/PX4/Images/TuningComponentIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..059b5868af30b75b18a3d3d0503d1a5e02c0fe67 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/Images/TuningComponentIcon.png differ