Commit c6fd7bbd authored by Gus Grubba's avatar Gus Grubba

Merge pull request #3294 from dogmaphobic/cameraComponent

Camera component
parents ba38b9c1 df39e229
......@@ -48,6 +48,7 @@
<file alias="arrow-down.png">src/QmlControls/arrow-down.png</file>
<file alias="FirmwareUpgradeIcon.png">src/VehicleSetup/FirmwareUpgradeIcon.png</file>
<file alias="FlightModesComponentIcon.png">src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png</file>
<file alias="CameraTrigger.svg">src/AutoPilotPlugins/PX4/Images/CameraTrigger.svg</file>
<file alias="CameraComponentIcon.png">src/AutoPilotPlugins/PX4/Images/CameraComponentIcon.png</file>
<file alias="DatalinkLoss.svg">src/AutoPilotPlugins/PX4/Images/DatalinkLoss.svg</file>
<file alias="DatalinkLossLight.svg">src/AutoPilotPlugins/PX4/Images/DatalinkLossLight.svg</file>
......
......@@ -651,6 +651,7 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/PowerComponentController.h \
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h \
src/AutoPilotPlugins/PX4/PX4RadioComponent.h \
src/AutoPilotPlugins/PX4/CameraComponent.h \
src/AutoPilotPlugins/PX4/SafetyComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponentController.h \
......@@ -708,6 +709,7 @@ SOURCES += \
src/AutoPilotPlugins/PX4/PowerComponentController.cc \
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc \
src/AutoPilotPlugins/PX4/PX4RadioComponent.cc \
src/AutoPilotPlugins/PX4/CameraComponent.cc \
src/AutoPilotPlugins/PX4/SafetyComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponentController.cc \
......
......@@ -140,6 +140,8 @@
<file alias="APMSafetyComponentSummaryPlane.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml</file>
<file alias="APMSafetyComponentSummaryRover.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml</file>
<file alias="APMTuningComponentCopter.qml">src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml</file>
<file alias="CameraComponent.qml">src/AutoPilotPlugins/PX4/CameraComponent.qml</file>
<file alias="CameraComponentSummary.qml">src/AutoPilotPlugins/PX4/CameraComponentSummary.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file>
<file alias="SafetyComponentSummary.qml">src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file>
<file alias="SensorsComponent.qml">src/AutoPilotPlugins/PX4/SensorsComponent.qml</file>
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @brief The Camera VehicleComponent is used to setup the camera modes and hardware
/// configuration to use it.
/// @author Gus Grubba <mavlink@grubba.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("The Camera is used to setup the camera modes and hardware configuration to use it.");
}
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");
}
QString CameraComponent::prerequisiteSetup(void) const
{
return QString();
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef CameraComponent_H
#define CameraComponent_H
#include "VehicleComponent.h"
/// @file
/// @brief The Camera VehicleComponent is used to setup the camera modes and hardware
/// configuration to use it.
/// @author Gus Grubba <mavlink@grubba.com>
class CameraComponent : public VehicleComponent
{
Q_OBJECT
public:
CameraComponent (Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// 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;
QString prerequisiteSetup (void) const final;
bool allowSetupWhileArmed (void) const final { return false; }
private:
const QString _name;
QVariantList _summaryItems;
};
#endif
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import QGroundControl 1.0
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 real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 22
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 18
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE")
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 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
}
}
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
Item {
id: applyAndRestart
visible: false
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 10
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 10
height: applyButton.height
QGCLabel {
anchors.left: parent.left
text: qsTr("Vehicle must be restarted for changes to take effect. ")
}
QGCButton {
id: applyButton
anchors.right: parent.right
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
}
}
}
QGCFlickable {
clip: true
anchors.top: applyAndRestart.visible ? applyAndRestart.bottom : parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: mainCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: mainCol
spacing: _margins
anchors.horizontalCenter: parent.horizontalCenter
/*
**** Camera Trigger ****
*/
QGCLabel {
text: qsTr("Camera Trigger Settings")
font.weight: Font.DemiBold
}
Rectangle {
id: camTrigRect
color: palette.windowShade
width: camTrigRow.width + _margins * 2
height: camTrigRow.height + _margins * 2
Row {
id: camTrigRow
spacing: _margins
anchors.verticalCenter: parent.verticalCenter
Item { width: _margins * 0.5; height: 1; }
QGCColoredImage {
color: palette.text
height: ScreenTools.defaultFontPixelWidth * 10
width: ScreenTools.defaultFontPixelWidth * 20
mipmap: true
fillMode: Image.PreserveAspectFit
source: "/qmlimages/CameraTrigger.svg"
anchors.verticalCenter: parent.verticalCenter
}
Item { width: _margins * 0.5; height: 1; }
Column {
spacing: _margins * 0.5
anchors.verticalCenter: parent.verticalCenter
Row {
visible: !controller.fixedWing
QGCLabel {
anchors.baseline: camTrigCombo.baseline
width: _middleRowWidth
text: qsTr("Trigger mode:")
}
FactComboBox {
id: camTrigCombo
width: _editFieldWidth
fact: _camTriggerMode
indexModel: false
enabled: !_rebooting
onActivated: {
applyAndRestart.visible = true
}
}
}
Row {
QGCLabel {
text: qsTr("Time Interval")
width: _middleRowWidth
anchors.baseline: timeIntervalField.baseline
color: palette.text
}
FactTextField {
id: timeIntervalField
fact: controller.getParameterFact(-1, "TRIG_INTERVAL", false)
showUnits: true
width: _editFieldWidth
enabled: _auxPins && _camTriggerMode.value === 2
}
}
Row {
QGCLabel {
text: qsTr("Distance Interval")
width: _middleRowWidth
anchors.baseline: trigDistField.baseline
color: palette.text
}
FactTextField {
id: trigDistField
fact: controller.getParameterFact(-1, "TRIG_DISTANCE", false)
showUnits: true
width: _editFieldWidth
enabled: _auxPins && _camTriggerMode.value === 3
}
}
}
}
}
/*
**** Camera Hardware ****
*/
Item { width: 1; height: _margins * 0.5; }
QGCLabel {
text: qsTr("Hardware Settings")
font.weight: Font.DemiBold
visible: _auxPins
}
Rectangle {
color: palette.windowShade
width: camTrigRect.width
height: camHardwareRow.height + _margins * 2
visible: _auxPins
Row {
id: camHardwareRow
spacing: _margins
anchors.verticalCenter: parent.verticalCenter
Item { width: _margins * 0.5; height: 1; }
Item {
height: ScreenTools.defaultFontPixelWidth * 10
width: ScreenTools.defaultFontPixelWidth * 20
Column {
spacing: ScreenTools.defaultFontPixelHeight
anchors.centerIn: parent
QGCLabel {
text: "AUX Pin Assignment"
anchors.horizontalCenter: parent.horizontalCenter
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Repeater {
model: _auxChannels
Column {
spacing: ScreenTools.defaultFontPixelWidth * 0.5
QGCLabel {
text: model.index + 1
color: palette.text
anchors.horizontalCenter: parent.horizontalCenter
}
Rectangle {
id: auxPin
width: ScreenTools.defaultFontPixelWidth * 2
height: ScreenTools.defaultFontPixelWidth * 2
border.color: palette.text
color: {
if(_auxPins) {
var pins = _auxPins.value.toString()
var pin = (model.index + 1).toString()
if(pins.indexOf(pin) < 0)
return palette.windowShadeDark
else
return "green"
} else {
return palette.windowShade
}
}
MouseArea {
anchors.fill: parent
onClicked: {
_auxChannels[model.index] = 1 - _auxChannels[model.index]
auxPin.color = _auxChannels[model.index] ? "green" : palette.windowShadeDark
setAuxPins()
}
}
}
}
}
}
}
}
Item { width: _margins * 0.5; height: 1; }
Column {
spacing: _margins * 0.5
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
id: returnHomeLabel
text: "Trigger Pin Polarity:"
}
Row {
Item { height: 1; width: _margins; }
Column {
spacing: _margins * 0.5
ExclusiveGroup { id: polarityGroup }
QGCRadioButton {
checked: _camTriggerPol && _camTriggerPol.value === 0
exclusiveGroup: polarityGroup
text: "Low (0V)"
onClicked: {
if(_camTriggerPol) {
_camTriggerPol.value = 0
}
}
}
QGCRadioButton {
checked: _camTriggerPol && _camTriggerPol.value > 0
exclusiveGroup: polarityGroup
text: "High (3.3V)"
onClicked: {
if(_camTriggerPol) {
_camTriggerPol.value = 1
}
}
}
}
}
Item { width: 1; height: _margins * 0.5; }
Row {
QGCLabel {
text: qsTr("Trigger Period")
width: _middleRowWidth
anchors.baseline: trigPeriodField.baseline
color: palette.text
}
FactTextField {
id: trigPeriodField
fact: controller.getParameterFact(-1, "TRIG_ACT_TIME", false)
showUnits: true
width: _editFieldWidth
}
}
}
}
}
}
}
}
}
import QtQuick 2.2
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 _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE")
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
anchors.margins: 8
VehicleSummaryRow {
labelText: qsTr("Camera 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 ? "High (3.3V)" : "Low (0V)") : ""
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 81.199 100.262" style="enable-background:new 0 0 81.199 100.262;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#010101;stroke-linecap:round;stroke-linejoin:round;}
.st1{fill:#FFFFFF;fill-opacity:0.6;stroke:#010101;stroke-linecap:round;stroke-linejoin:round;}
.st2{fill:#FFFFFF;fill-opacity:0.7;stroke:#010101;stroke-linecap:round;stroke-linejoin:round;}
.st3{fill:#FFFFFF;stroke:#FFFFFF;}
.st4{fill:none;stroke:#FFFFFF;stroke-width:3;stroke-linecap:round;}
.st5{fill:none;stroke:#FFFFFF;stroke-width:3;}
.st6{fill:#FFFFFF;stroke:#FFFFFF;stroke-width:3;}
</style>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="282.69484" inkscape:cy="221.0125" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1017" inkscape:window-maximized="1" inkscape:window-width="1920" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:zoom="2.8" pagecolor="#ffffff" showgrid="true" showguides="true">
<sodipodi:guide id="guide2985" orientation="1,0" position="250,420"></sodipodi:guide>
<inkscape:grid empspacing="10" enabled="true" id="grid2987" snapvisiblegridlinesonly="true" type="xygrid" visible="true">
</inkscape:grid>
<sodipodi:guide id="guide2989" orientation="0,1" position="270,250"></sodipodi:guide>
</sodipodi:namedview>
<g>
<path class="st0" d="M39.633,25.991l-1.565,40.431L1.289,84.29"/>
<path class="st0" d="M79.934,74.639l-41.866-8.217"/>
<path class="st1" d="M1.185,84.232L46.181,98.97l33.753-24.331L39.399,25.802L1.185,84.232z"/>
<path class="st2" d="M39.633,25.991l6.544,72.726"/>
</g>
<g>
<defs>
<inkscape:path-effect copytype="repeated" effect="skeletal" fuse_tolerance="0" id="path-effect4881" is_visible="true" normal_offset="0" pattern="M 0,0 1,0" prop_scale="1" prop_units="false" scale_y_rel="false" spacing="0" tang_offset="0" vertical_pattern="false">
</inkscape:path-effect>
<inkscape:path-effect bendpath="m 110,180 140,0" effect="bend_path" id="path-effect3765" is_visible="true" prop_scale="1" scale_y_rel="false" vertical="false">
</inkscape:path-effect>
</defs>
<g>
<g>
<path id="path2991_3_" sodipodi:cx="110" sodipodi:cy="110" sodipodi:rx="20" sodipodi:ry="20" sodipodi:type="arc" class="st3" d="
M33.994,8.727c-0.66,0.819-1.935,1.336-2.821,1.119c-0.886-0.216-1.009-1.074-0.301-1.881c0.708-0.807,1.941-1.27,2.779-1.065
C34.489,7.105,34.654,7.908,33.994,8.727z"/>
<path id="path3761_3_" sodipodi:cx="110" sodipodi:cy="110" sodipodi:end="6.4866523" sodipodi:open="true" sodipodi:rx="50" sodipodi:ry="50" sodipodi:start="1.374765" sodipodi:type="arc" class="st4" d="
M29.76,12.939c-3.179-0.137-4.293-2.573-2.549-5.084c1.743-2.51,5.315-4.173,8.016-4.031c2.701,0.143,3.868,2.055,2.603,4.559
c-0.306,0.606-0.752,1.213-1.325,1.782"/>
<path id="path2991-6_3_" inkscape:transform-center-x="-140.5" inkscape:transform-center-y="-140.5" sodipodi:cx="110" sodipodi:cy="110" sodipodi:rx="20" sodipodi:ry="20" sodipodi:type="arc" class="st3" d="
M57.354,9.847c-1.146,0.216-1.801-0.3-1.476-1.119c0.324-0.819,1.455-1.623,2.539-1.827c1.084-0.205,1.761,0.258,1.499,1.065
C59.654,8.772,58.5,9.63,57.354,9.847z"/>
<path id="path3761-1_3_" inkscape:transform-center-x="-140.5" inkscape:transform-center-y="-140.50478" sodipodi:cx="110" sodipodi:cy="110" sodipodi:end="6.4866523" sodipodi:open="true" sodipodi:rx="50" sodipodi:ry="50" sodipodi:start="1.374765" sodipodi:type="arc" class="st4" d="
M51.643,10.135c0.489-2.362,3.551-4.902,6.726-5.901c3.175-0.999,5.694-0.217,5.764,1.944c0.069,2.161-2.797,5.08-6.53,6.279
c-0.903,0.29-1.792,0.455-2.598,0.484"/>
<path id="path2991-9_3_" sodipodi:cx="110" sodipodi:cy="110" sodipodi:rx="20" sodipodi:ry="20" sodipodi:type="arc" class="st3" d="
M47.629,29.565c0.324-0.819,1.803-1.679,3.323-1.965c1.52-0.287,2.554,0.098,2.292,0.906c-0.262,0.807-1.773,1.742-3.354,2.041
C48.307,30.844,47.304,30.384,47.629,29.565z"/>
<path id="path3761-2_3_" sodipodi:cx="110" sodipodi:cy="110" sodipodi:end="6.4866523" sodipodi:open="true" sodipodi:rx="50" sodipodi:ry="50" sodipodi:start="1.374765" sodipodi:type="arc" class="st4" d="
M50.445,25.017c4.447-1.22,8.247-0.762,8.579,1.331c0.332,2.093-3.401,5.257-8.424,6.718c-5.023,1.461-8.943,0.448-8.7-1.886
c0.059-0.565,0.349-1.172,0.837-1.785"/>
<path id="path2991-6-9_3_" inkscape:transform-center-x="140.5" inkscape:transform-center-y="140.50002" sodipodi:cx="110" sodipodi:cy="110" sodipodi:rx="20" sodipodi:ry="20" sodipodi:type="arc" class="st3" d="
M16.242,27.599c1.175,0.287,1.621,1.146,0.961,1.965c-0.66,0.819-2.216,1.28-3.439,0.981s-1.61-1.233-0.902-2.041
C13.57,27.697,15.067,27.312,16.242,27.599z"/>
<path id="path3761-1-5_3_" inkscape:transform-center-x="140.5" inkscape:transform-center-y="140.50476" sodipodi:cx="110" sodipodi:cy="110" sodipodi:end="6.4866523" sodipodi:open="true" sodipodi:rx="50" sodipodi:ry="50" sodipodi:start="1.374765" sodipodi:type="arc" class="st4" d="
M22.283,29.43c-1.053,2.532-5.388,4.65-9.573,4.292c-4.185-0.359-6.191-3.118-4.628-5.696c1.563-2.578,5.707-3.996,9.382-3.592
c0.889,0.098,1.711,0.301,2.428,0.599"/>
</g>
<path class="st5" d="M15.002,29.072c15.224-4.416,30.109-11.214,42.884-20.699"/>
<path class="st5" d="M50.423,29.072c-8.375-2.807-16.821-11.688-18.01-20.699"/>
<path class="st6" d="M47.009,19.801c-1.545,3.318-7.4,6.579-12.68,6.579c-5.28,0-7.217-3.26-4.774-6.579
c2.443-3.318,7.674-5.536,12.053-5.536S48.553,16.483,47.009,19.801z"/>
</g>
</g>
</svg>
......@@ -126,6 +126,10 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
_tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent));
_cameraComponent = new CameraComponent(_vehicle, this);
_cameraComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent));
//-- Is there an ESP8266 Connected?
if(factExists(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) {
_esp8266Component = new ESP8266Component(_vehicle, this);
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef PX4AUTOPILOT_H
......@@ -32,6 +32,7 @@
#include "FlightModesComponent.h"
#include "SensorsComponent.h"
#include "SafetyComponent.h"
#include "CameraComponent.h"
#include "PowerComponent.h"
#include "PX4TuningComponent.h"
#include "Vehicle.h"
......@@ -60,13 +61,14 @@ public:
FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; }
SensorsComponent* sensorsComponent(void) { return _sensorsComponent; }
SafetyComponent* safetyComponent(void) { return _safetyComponent; }
CameraComponent* cameraComponent(void) { return _cameraComponent; }
PowerComponent* powerComponent(void) { return _powerComponent; }
PX4TuningComponent* tuningComponent(void) { return _tuningComponent; }
public slots:
// FIXME: This is public until we restructure AutoPilotPlugin/FirmwarePlugin/Vehicle
void _parametersReadyPreChecks(bool missingParameters);
private:
PX4AirframeLoader* _airframeFacts;
QVariantList _components;
......@@ -76,6 +78,7 @@ private:
FlightModesComponent* _flightModesComponent;
SensorsComponent* _sensorsComponent;
SafetyComponent* _safetyComponent;
CameraComponent* _cameraComponent;
PowerComponent* _powerComponent;
PX4TuningComponent* _tuningComponent;
bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
......
......@@ -129,14 +129,15 @@ void FactPanelController::_checkForMissingFactPanel(void)
}
}
Fact* FactPanelController::getParameterFact(int componentId, const QString& name)
Fact* FactPanelController::getParameterFact(int componentId, const QString& name, bool reportMissing)
{
if (_autopilot && _autopilot->parameterExists(componentId, name)) {
Fact* fact = _autopilot->getParameterFact(componentId, name);
QQmlEngine::setObjectOwnership(fact, QQmlEngine::CppOwnership);
return fact;
} else {
_reportMissingParameter(componentId, name);
if(reportMissing)
_reportMissingParameter(componentId, name);
return NULL;
}
}
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef FactPanelController_H
......@@ -40,34 +40,34 @@ Q_DECLARE_LOGGING_CATEGORY(FactPanelControllerLog)
/// missing Facts from C++ code.
class FactPanelController : public QObject
{
Q_OBJECT
Q_OBJECT
public:
FactPanelController(void);
FactPanelController(void);
Q_PROPERTY(QQuickItem* factPanel READ factPanel WRITE setFactPanel)
Q_INVOKABLE Fact* getParameterFact(int componentId, const QString& name);
Q_INVOKABLE bool parameterExists(int componentId, const QString& name);
Q_INVOKABLE Fact* getParameterFact (int componentId, const QString& name, bool reportMissing = true);
Q_INVOKABLE bool parameterExists (int componentId, const QString& name);
QQuickItem* factPanel(void);
void setFactPanel(QQuickItem* panel);
protected:
/// Checks for existence of the specified parameters
/// @return true: all parameters exists, false: parameters missing and reported
bool _allParametersExists(int componentId, QStringList names);
/// Report a missing parameter to the FactPanel Qml element
void _reportMissingParameter(int componentId, const QString& name);
Vehicle* _vehicle;
UASInterface* _uas;
AutoPilotPlugin* _autopilot;
private slots:
void _checkForMissingFactPanel(void);
private:
void _notifyPanelMissingParameter(const QString& missingParam);
void _notifyPanelErrorMsg(const QString& errorMsg);
......@@ -77,4 +77,4 @@ private:
QStringList _delayedMissingParams;
};
#endif
\ No newline at end of file
#endif
......@@ -1636,6 +1636,11 @@ void Vehicle::setFirmwareVersion(int majorVersion, int minorVersion, int patchVe
_firmwarePatchVersion = patchVersion;
}
void Vehicle::rebootVehicle()
{
doCommandLong(id(), MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
}
const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
const char* VehicleGPSFactGroup::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
......
......@@ -360,6 +360,9 @@ public:
/// Alter the current mission item on the vehicle
Q_INVOKABLE void setCurrentMissionSequence(int seq);
/// Reboot vehicle
Q_INVOKABLE void rebootVehicle();
bool guidedModeSupported(void) const;
bool pauseVehicleSupported(void) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment