Remove PX4 camera component
This commit is contained in:
@@ -70,13 +70,6 @@ const QVariantList& CustomAutoPilotPlugin::vehicleComponents()
|
||||
_tuningComponent = new PX4TuningComponent(_vehicle, this);
|
||||
_tuningComponent->setupTriggerSignals();
|
||||
_components.append(QVariant::fromValue(reinterpret_cast<VehicleComponent*>(_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<VehicleComponent*>(_cameraComponent)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Call to vehicleCompenents prior to parametersReady";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
*
|
||||
* 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 <gus@auterion.com>
|
||||
|
||||
#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");
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
*
|
||||
* 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 <gus@auterion.com>
|
||||
|
||||
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;
|
||||
};
|
||||
@@ -1,304 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
*
|
||||
* 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)")) : ""
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<VehicleComponent*>(_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<VehicleComponent*>(_cameraComponent)));
|
||||
}
|
||||
|
||||
//-- Is there an ESP8266 Connected?
|
||||
if(_vehicle->parameterManager()->parameterExists(MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) {
|
||||
_esp8266Component = new ESP8266Component(_vehicle, this, this);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
<qresource prefix="/qml">
|
||||
<file alias="AirframeComponent.qml">../../AutoPilotPlugins/PX4/AirframeComponent.qml</file>
|
||||
<file alias="AirframeComponentSummary.qml">../../AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
|
||||
<file alias="CameraComponent.qml">../../AutoPilotPlugins/PX4/CameraComponent.qml</file>
|
||||
<file alias="CameraComponentSummary.qml">../../AutoPilotPlugins/PX4/CameraComponentSummary.qml</file>
|
||||
<file alias="FlightModesComponentSummary.qml">../../AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
|
||||
<file alias="PowerComponent.qml">../../AutoPilotPlugins/PX4/PowerComponent.qml</file>
|
||||
<file alias="PowerComponentSummary.qml">../../AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
|
||||
|
||||
Reference in New Issue
Block a user