From 0f00b7287a2ad159660c3c5b576020feb9d5ccf4 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 12 Feb 2025 20:11:28 -0800 Subject: [PATCH] Remove PX4 camera component --- .../AutoPilotPlugin/CustomAutoPilotPlugin.cc | 7 - src/AutoPilotPlugins/PX4/CMakeLists.txt | 2 - src/AutoPilotPlugins/PX4/CameraComponent.cc | 63 ---- src/AutoPilotPlugins/PX4/CameraComponent.h | 43 --- src/AutoPilotPlugins/PX4/CameraComponent.qml | 304 ------------------ .../PX4/CameraComponentSummary.qml | 59 ---- .../PX4/PX4AutoPilotPlugin.cc | 8 - src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h | 2 - src/FirmwarePlugin/PX4/PX4Resources.qrc | 2 - 9 files changed, 490 deletions(-) delete mode 100644 src/AutoPilotPlugins/PX4/CameraComponent.cc delete mode 100644 src/AutoPilotPlugins/PX4/CameraComponent.h delete mode 100644 src/AutoPilotPlugins/PX4/CameraComponent.qml delete mode 100644 src/AutoPilotPlugins/PX4/CameraComponentSummary.qml diff --git a/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc b/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc index 9281b9ab7..8680d93f2 100644 --- a/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc +++ b/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc @@ -70,13 +70,6 @@ const QVariantList& CustomAutoPilotPlugin::vehicleComponents() _tuningComponent = new PX4TuningComponent(_vehicle, this); _tuningComponent->setupTriggerSignals(); _components.append(QVariant::fromValue(reinterpret_cast(_tuningComponent))); - - //-- Is there support for cameras? - if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "TRIG_MODE")) { - _cameraComponent = new CameraComponent(_vehicle, this); - _cameraComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue(reinterpret_cast(_cameraComponent))); - } } } else { qWarning() << "Call to vehicleCompenents prior to parametersReady"; diff --git a/src/AutoPilotPlugins/PX4/CMakeLists.txt b/src/AutoPilotPlugins/PX4/CMakeLists.txt index 3cd8fecac..eaa01b46f 100644 --- a/src/AutoPilotPlugins/PX4/CMakeLists.txt +++ b/src/AutoPilotPlugins/PX4/CMakeLists.txt @@ -9,8 +9,6 @@ qt_add_library(PX4AutoPilotPlugin STATIC AirframeComponentAirframes.h AirframeComponentController.cc AirframeComponentController.h - CameraComponent.cc - CameraComponent.h FlightModesComponent.cc FlightModesComponent.h PowerComponent.cc diff --git a/src/AutoPilotPlugins/PX4/CameraComponent.cc b/src/AutoPilotPlugins/PX4/CameraComponent.cc deleted file mode 100644 index a4d31e426..000000000 --- a/src/AutoPilotPlugins/PX4/CameraComponent.cc +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2024 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -/// @file -/// @brief The Camera VehicleComponent is used to setup the camera modes and hardware -/// configuration to use it. -/// @author Gus Grubba - -#include "CameraComponent.h" -#include "PX4AutoPilotPlugin.h" - -CameraComponent::CameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - VehicleComponent(vehicle, autopilot, parent), - _name(tr("Camera")) -{ -} - -QString CameraComponent::name(void) const -{ - return _name; -} - -QString CameraComponent::description(void) const -{ - return tr("Camera setup is used to adjust camera and gimbal settings."); -} - -QString CameraComponent::iconResource(void) const -{ - return "/qmlimages/CameraComponentIcon.png"; -} - -bool CameraComponent::requiresSetup(void) const -{ - return false; -} - -bool CameraComponent::setupComplete(void) const -{ - return true; -} - -QStringList CameraComponent::setupCompleteChangedTriggerList(void) const -{ - return QStringList(); -} - -QUrl CameraComponent::setupSource(void) const -{ - return QUrl::fromUserInput("qrc:/qml/CameraComponent.qml"); -} - -QUrl CameraComponent::summaryQmlSource(void) const -{ - return QUrl::fromUserInput("qrc:/qml/CameraComponentSummary.qml"); -} diff --git a/src/AutoPilotPlugins/PX4/CameraComponent.h b/src/AutoPilotPlugins/PX4/CameraComponent.h deleted file mode 100644 index 3d7d55bf3..000000000 --- a/src/AutoPilotPlugins/PX4/CameraComponent.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2024 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -#pragma once - -#include "VehicleComponent.h" - -/// @file -/// @brief The Camera VehicleComponent is used to setup the camera modes and hardware -/// configuration to use it. -/// @author Gus Grubba - -class CameraComponent : public VehicleComponent -{ - Q_OBJECT - -public: - CameraComponent (Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = nullptr); - - // Virtuals from VehicleComponent - QStringList setupCompleteChangedTriggerList (void) const; - - // Virtuals from VehicleComponent - QString name (void) const final; - QString description (void) const final; - QString iconResource (void) const final; - bool requiresSetup (void) const final; - bool setupComplete (void) const final; - QUrl setupSource (void) const final; - QUrl summaryQmlSource (void) const final; - bool allowSetupWhileArmed (void) const final { return false; } - -private: - const QString _name; - QVariantList _summaryItems; -}; diff --git a/src/AutoPilotPlugins/PX4/CameraComponent.qml b/src/AutoPilotPlugins/PX4/CameraComponent.qml deleted file mode 100644 index 192521b48..000000000 --- a/src/AutoPilotPlugins/PX4/CameraComponent.qml +++ /dev/null @@ -1,304 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2020 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -import QtQuick -import QtQuick.Controls -import QtQuick.Layouts - -import QGroundControl -import QGroundControl.FactSystem -import QGroundControl.FactControls -import QGroundControl.Controls -import QGroundControl.ScreenTools - -SetupPage { - id: cameraPage - pageComponent: pageComponent - - Component { - id: pageComponent - - Item { - width: Math.max(availableWidth, innerColumn.width) - height: innerColumn.height - - FactPanelController { id: controller; } - - property real _margins: ScreenTools.defaultFontPixelHeight - property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 25 - - property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE") - property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false /* reportMissing */) - property Fact _camTriggerPol: controller.getParameterFact(-1, "TRIG_POLARITY", false /* reportMissing */) - property Fact _auxPins: controller.getParameterFact(-1, "TRIG_PINS", false /* reportMissing */) - - property bool _rebooting: false - property var _auxChannels: [ 0, 0, 0, 0, 0, 0] - - function clearAuxArray() { - for(var i = 0; i < 6; i++) { - _auxChannels[i] = 0 - } - } - - function setAuxPins() { - if(_auxPins) { - var values = "" - for(var i = 0; i < 6; i++) { - if(_auxChannels[i]) { - values += ((i+1).toString()) - } - } - _auxPins.value = parseInt(values) - } - } - - Component.onCompleted: { - if(_auxPins) { - clearAuxArray() - var values = _auxPins.value.toString() - for(var i = 0; i < values.length; i++) { - var b = parseInt(values[i]) - 1 - if(b >= 0 && b < 6) { - _auxChannels[b] = 1 - } - } - } - } - - ColumnLayout { - id: innerColumn - anchors.horizontalCenter: parent.horizontalCenter - - RowLayout { - id: applyAndRestart - spacing: _margins - visible: false - - QGCLabel { - text: qsTr("Vehicle must be restarted for changes to take effect.") - } - QGCButton { - text: qsTr("Apply and Restart") - onClicked: { - //-- This will reboot the vehicle! We're set not to allow changes if armed. - QGroundControl.multiVehicleManager.activeVehicle.rebootVehicle() - applyAndRestart.visible = false - _rebooting = true - } - } - } - - QGCGroupBox { - title: qsTr("Camera Trigger Settings") - Layout.fillWidth: true - - GridLayout { - id: cameraTrggerGrid - rows: 4 - columns: 3 - columnSpacing: ScreenTools.defaultFontPixelWidth - - QGCColoredImage { - id: triggerImage - color: qgcPal.text - height: ScreenTools.defaultFontPixelWidth * 10 - width: ScreenTools.defaultFontPixelWidth * 20 - sourceSize.width: width - mipmap: true - fillMode: Image.PreserveAspectFit - source: "/qmlimages/CameraTrigger.svg" - Layout.rowSpan: 4 - } - - QGCLabel { - Layout.alignment: Qt.AlignVCenter - text: qsTr("Trigger mode") - } - FactComboBox { - fact: _camTriggerMode - indexModel: false - enabled: !_rebooting - Layout.alignment: Qt.AlignVCenter - Layout.minimumWidth: _editFieldWidth - onActivated: (index) => { - applyAndRestart.visible = true - } - } - - QGCLabel { - Layout.alignment: Qt.AlignVCenter - text: qsTr("Trigger interface") - } - FactComboBox { - fact: _camTriggerInterface - indexModel: false - enabled: !_rebooting && (_camTriggerInterface ? true : false) - Layout.alignment: Qt.AlignVCenter - Layout.minimumWidth: _editFieldWidth - onActivated: (index) => { - applyAndRestart.visible = true - } - } - - QGCLabel { - text: qsTr("Time Interval") - Layout.alignment: Qt.AlignVCenter - color: qgcPal.text - visible: timeIntervalField.visible - } - FactTextField { - id: timeIntervalField - fact: controller.getParameterFact(-1, "TRIG_INTERVAL", false) - showUnits: true - Layout.minimumWidth: _editFieldWidth - Layout.alignment: Qt.AlignVCenter - visible: _camTriggerMode.value === 2 - } - - QGCLabel { - text: qsTr("Distance Interval") - Layout.alignment: Qt.AlignVCenter - color: qgcPal.text - visible: trigDistField.visible - } - FactTextField { - id: trigDistField - fact: controller.getParameterFact(-1, "TRIG_DISTANCE", false) - showUnits: true - Layout.alignment: Qt.AlignVCenter - Layout.minimumWidth: _editFieldWidth - visible: _camTriggerMode.value === 3 - } - } - } // QGCGroupBox - Camera Trigger - - QGCGroupBox { - title: qsTr("Hardware Settings") - visible: _auxPins - Layout.fillWidth: true - - RowLayout { - spacing: _margins - - // Aux pin assignment - ColumnLayout { - spacing: _margins - - QGCLabel { - horizontalAlignment: Text.AlignHCenter - text: qsTr("AUX Pin Assignment") - Layout.minimumWidth: triggerImage.width - } - - Row { - spacing: _margins - Layout.alignment: Qt.AlignHCenter - - GridLayout { - rows: 2 - columns: 6 - - Repeater { - model: _auxChannels - - QGCLabel { - horizontalAlignment: Text.AlignHCenter - text: model.index + 1 - } - } - Repeater { - model: _auxChannels - - Rectangle { - id: auxPin - width: ScreenTools.defaultFontPixelWidth * 2 - height: ScreenTools.defaultFontPixelWidth * 2 - border.color: qgcPal.text - color: { - if(_auxPins) { - var pins = _auxPins.value.toString() - var pin = (model.index + 1).toString() - if(pins.indexOf(pin) < 0) - return qgcPal.windowShadeDark - else - return "green" - } else { - return qgcPal.windowShade - } - } - MouseArea { - anchors.fill: parent - onClicked: { - _auxChannels[model.index] = 1 - _auxChannels[model.index] - auxPin.color = _auxChannels[model.index] ? "green" : qgcPal.windowShadeDark - setAuxPins() - } - } - } - } - } - } - } // ColumnLayout - Aux pins - - // Trigger Pin Setup - ColumnLayout { - visible: !_camTriggerInterface || (_camTriggerInterface.value === 1) - spacing: _margins * 0.5 - - QGCLabel { text: qsTr("Trigger Pin Polarity") } - - Row { - Item { height: 1; width: _margins; } - Column { - spacing: _margins * 0.5 - QGCRadioButton { - checked: _camTriggerPol && _camTriggerPol.value === 0 - text: "Low (0V)" - onClicked: { - if(_camTriggerPol) { - _camTriggerPol.value = 0 - } - } - } - QGCRadioButton { - checked: _camTriggerPol && _camTriggerPol.value > 0 - text: "High (3.3V)" - onClicked: { - if(_camTriggerPol) { - _camTriggerPol.value = 1 - } - } - } - } - } - - Row { - spacing: ScreenTools.defaultFontPixelWidth - - QGCLabel { - text: qsTr("Trigger Period") - anchors.baseline: trigPeriodField.baseline - color: qgcPal.text - } - FactTextField { - id: trigPeriodField - fact: controller.getParameterFact(-1, "TRIG_ACT_TIME", false) - showUnits: true - width: _editFieldWidth - } - } - } - } - } // QGCGroupBox - Hardware Settings - } - } - } -} diff --git a/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml b/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml deleted file mode 100644 index 5115ea608..000000000 --- a/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick -import QtQuick.Controls - -import QGroundControl.FactSystem -import QGroundControl.FactControls -import QGroundControl.Controls -import QGroundControl.Palette - -Item { - anchors.fill: parent - - FactPanelController { id: controller; } - - property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE", false) - property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false) - property Fact _camTriggerPol: controller.getParameterFact(-1, "TRIG_POLARITY", false) // Don't bitch about missing as these only exist if trigger mode is enabled - property Fact _auxPins: controller.getParameterFact(-1, "TRIG_PINS", false) // Ditto - property Fact _timeInterval: controller.getParameterFact(-1, "TRIG_INTERVAL", false) // Ditto - property Fact _distanceInterval:controller.getParameterFact(-1, "TRIG_DISTANCE", false) // Ditto - - Column { - anchors.fill: parent - - VehicleSummaryRow { - labelText: qsTr("Trigger interface") - valueText: _camTriggerInterface ? _camTriggerInterface.enumStringValue : "" - } - - VehicleSummaryRow { - labelText: qsTr("Trigger mode") - valueText: _camTriggerMode ? _camTriggerMode.enumStringValue : "" - } - - VehicleSummaryRow { - visible: _timeInterval && _camTriggerMode.value === 2 - labelText: qsTr("Time interval") - valueText: _timeInterval ? _timeInterval.value : "" - } - - VehicleSummaryRow { - visible: _distanceInterval && _camTriggerMode.value === 3 - labelText: qsTr("Distance interval") - valueText: _distanceInterval ? _distanceInterval.value : "" - } - - VehicleSummaryRow { - visible: _auxPins - labelText: qsTr("AUX pins") - valueText: _auxPins ? _auxPins.value : "" - } - - VehicleSummaryRow { - visible: _camTriggerPol - labelText: qsTr("AUX pin polarity") - valueText: _camTriggerPol ? (_camTriggerPol.value ? qsTr("High (3.3V)") : qsTr("Low (0V)")) : "" - } - - } -} diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index ed17270c4..bb2925250 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -35,7 +35,6 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) , _flightModesComponent(nullptr) , _sensorsComponent(nullptr) , _safetyComponent(nullptr) - , _cameraComponent(nullptr) , _powerComponent(nullptr) , _motorComponent(nullptr) , _actuatorComponent(nullptr) @@ -114,13 +113,6 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) _components.append(QVariant::fromValue(static_cast(_flightBehavior))); } - //-- Is there support for cameras? - if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "TRIG_MODE")) { - _cameraComponent = new CameraComponent(_vehicle, this, this); - _cameraComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue(static_cast(_cameraComponent))); - } - //-- Is there an ESP8266 Connected? if(_vehicle->parameterManager()->parameterExists(MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) { _esp8266Component = new ESP8266Component(_vehicle, this, this); diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h index f12622fb6..ed7903cb3 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h @@ -19,7 +19,6 @@ #include "FlightModesComponent.h" #include "SensorsComponent.h" #include "SafetyComponent.h" -#include "CameraComponent.h" #include "PowerComponent.h" #include "MotorComponent.h" #include "PX4TuningComponent.h" @@ -54,7 +53,6 @@ protected: FlightModesComponent* _flightModesComponent; SensorsComponent* _sensorsComponent; SafetyComponent* _safetyComponent; - CameraComponent* _cameraComponent; PowerComponent* _powerComponent; MotorComponent* _motorComponent; ActuatorComponent* _actuatorComponent; diff --git a/src/FirmwarePlugin/PX4/PX4Resources.qrc b/src/FirmwarePlugin/PX4/PX4Resources.qrc index 3c4e3f66a..2fe9f1931 100644 --- a/src/FirmwarePlugin/PX4/PX4Resources.qrc +++ b/src/FirmwarePlugin/PX4/PX4Resources.qrc @@ -2,8 +2,6 @@ ../../AutoPilotPlugins/PX4/AirframeComponent.qml ../../AutoPilotPlugins/PX4/AirframeComponentSummary.qml - ../../AutoPilotPlugins/PX4/CameraComponent.qml - ../../AutoPilotPlugins/PX4/CameraComponentSummary.qml ../../AutoPilotPlugins/PX4/FlightModesComponentSummary.qml ../../AutoPilotPlugins/PX4/PowerComponent.qml ../../AutoPilotPlugins/PX4/PowerComponentSummary.qml