Unverified Commit c296b056 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8996 from DonLakeFlyer/AnalyzeVibration

Move Vibration to Analyze
parents 4dec1b4c 93d5ee9f
......@@ -189,6 +189,7 @@
<file alias="VehicleTailDownRotate.png">src/AutoPilotPlugins/PX4/Images/VehicleTailDownRotate.png</file>
<file alias="VehicleUpsideDown.png">src/AutoPilotPlugins/PX4/Images/VehicleUpsideDown.png</file>
<file alias="VehicleUpsideDownRotate.png">src/AutoPilotPlugins/PX4/Images/VehicleUpsideDownRotate.png</file>
<file alias="VibrationPageIcon">src/AnalyzeView/VibrationPageIcon.png</file>
<file alias="wifi.svg">src/AutoPilotPlugins/Common/Images/wifi.svg</file>
<file alias="Yield.svg">src/ui/toolbar/Images/Yield.svg</file>
<file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file>
......
......@@ -273,7 +273,7 @@
<file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file>
<file alias="ValuePageWidget.qml">src/FlightMap/Widgets/ValuePageWidget.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="VibrationPageWidget.qml">src/FlightMap/Widgets/VibrationPageWidget.qml</file>
<file alias="VibrationPage.qml">src/AnalyzeView/VibrationPage.qml</file>
<file alias="VideoPageWidget.qml">src/FlightMap/Widgets/VideoPageWidget.qml</file>
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="VTOLLandingPatternEditor.qml">src/PlanView/VTOLLandingPatternEditor.qml</file>
......
/****************************************************************************
*
* (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 2.11
import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.11
import QGroundControl 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
AnalyzePage {
id: geoTagPage
pageComponent: pageComponent
pageName: qsTr("Vibration")
pageDescription: qsTr("Analyze vibration associated with your vehicle.")
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property bool _available: !isNaN(_activeVehicle.vibration.xAxis.rawValue)
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _barWidth: ScreenTools.defaultFontPixelWidth * 3
property real _barHeight: ScreenTools.defaultFontPixelHeight * 10
property real _xValue: _activeVehicle.vibration.xAxis.rawValue
property real _yValue: _activeVehicle.vibration.yAxis.rawValue
property real _zValue: _activeVehicle.vibration.zAxis.rawValue
readonly property real _barMinimum: 0.0
readonly property real _barMaximum: 90.0
readonly property real _barBadValue: 60.0
QGCPalette { id:qgcPal; colorGroupEnabled: true }
Component {
id: pageComponent
Item {
width: childrenRect.width
height: childrenRect.height
RowLayout {
id: barRow
spacing: ScreenTools.defaultFontPixelWidth * 4
ColumnLayout {
Rectangle {
id: xBar
height: _barHeight
width: _barWidth
Layout.alignment: Qt.AlignHCenter
border.width: 1
border.color: qgcPal.text
Rectangle {
anchors.bottom: parent.bottom
width: parent.width
height: parent.height * (Math.min(_barMaximum, _xValue) / (_barMaximum - _barMinimum))
color: qgcPal.text
}
}
QGCLabel {
Layout.alignment: Qt.AlignHCenter
text: qsTr("X")
}
}
Column {
Rectangle {
height: _barHeight
width: _barWidth
Layout.alignment: Qt.AlignHCenter
border.width: 1
border.color: qgcPal.text
Rectangle {
anchors.bottom: parent.bottom
width: parent.width
height: parent.height * (Math.min(_barMaximum, _yValue) / (_barMaximum - _barMinimum))
color: qgcPal.text
}
}
QGCLabel {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Y")
}
}
Column {
Rectangle {
height: _barHeight
width: _barWidth
Layout.alignment: Qt.AlignHCenter
border.width: 1
border.color: qgcPal.text
Rectangle {
anchors.bottom: parent.bottom
width: parent.width
height: parent.height * (Math.min(_barMaximum, _zValue) / (_barMaximum - _barMinimum))
color: qgcPal.text
}
}
QGCLabel {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Z")
}
}
}
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: xBar.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: barRow.top
anchors.left: barRow.left
anchors.right: barRow.right
width: barRow.width
height: 1
color: "red"
}
Column {
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: barRow.right
QGCLabel {
text: qsTr("Clip count")
}
QGCLabel {
text: qsTr("Accel 1: ") + (_activeVehicle.vibration.clipCount1.rawValueString)
}
QGCLabel {
text: qsTr("Accel 2: ") + (_activeVehicle.vibration.clipCount2.rawValueString)
}
QGCLabel {
text: qsTr("Accel 3: ") + (_activeVehicle.vibration.clipCount3.rawValueString)
}
}
Rectangle {
anchors.fill: parent
color: qgcPal.window
opacity: 0.75
visible: !_available
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Not Available")
}
}
}
}
}
/****************************************************************************
*
* (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 2.3
import QtQuick.Controls 1.2
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
import QGroundControl 1.0
Rectangle {
height: barRow.y + barRow.height
width: pageWidth
color: qgcPal.window
property bool showSettingsIcon: false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property bool _available: _activeVehicle ? !isNaN(_activeVehicle.vibration.xAxis.value) : false
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _barWidth: Math.round(ScreenTools.defaultFontPixelWidth * 3)
readonly property real _barMinimum: 0.0
readonly property real _barMaximum: 90.0
readonly property real _barBadValue: 60.0
QGCPalette { id:qgcPal; colorGroupEnabled: true }
QGCLabel {
id: title
text: qsTr("Vibe")
anchors.horizontalCenter: barRow.horizontalCenter
}
Row {
id: barRow
anchors.margins: _margins
anchors.top: title.bottom
anchors.left: parent.left
spacing: _margins
Column {
ProgressBar {
id: xBar
height: 50
orientation: Qt.Vertical
minimumValue: _barMinimum
maximumValue: _barMaximum
value: _activeVehicle ? _activeVehicle.vibration.xAxis.value : 0
}
QGCLabel {
id: xBarLabel
text: "X"
anchors.horizontalCenter: xBar.horizontalCenter
}
}
Column {
ProgressBar {
id: yBar
height: 50
orientation: Qt.Vertical
minimumValue: _barMinimum
maximumValue: _barMaximum
value: _activeVehicle ? _activeVehicle.vibration.yAxis.value : 0
}
QGCLabel {
anchors.horizontalCenter: yBar.horizontalCenter
text: "Y"
}
}
Column {
ProgressBar {
id: zBar
height: 50
orientation: Qt.Vertical
minimumValue: _barMinimum
maximumValue: _barMaximum
value: _activeVehicle ? _activeVehicle.vibration.zAxis.value : 0
}
QGCLabel {
anchors.horizontalCenter: zBar.horizontalCenter
text: "Z"
}
}
} // Row
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: xBar.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: barRow.top
anchors.left: barRow.left
anchors.right: barRow.right
width: barRow.width
height: 1
color: "red"
}
QGCLabel {
id: clipLabel
anchors.margins: _margins
anchors.left: barRow.right
anchors.right: parent.right
text: qsTr("Clip count")
horizontalAlignment: Text.AlignHCenter
}
Column {
id: clipColumn
anchors.top: barRow.top
anchors.horizontalCenter: clipLabel.horizontalCenter
QGCLabel {
text: qsTr("Accel 1: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount1.valueString : "")
}
QGCLabel {
text: qsTr("Accel 2: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount2.valueString : "")
}
QGCLabel {
text: qsTr("Accel 3: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount3.valueString : "")
}
}
// Not available overlay
Rectangle {
anchors.fill: parent
color: qgcPal.window
opacity: 0.75
visible: !_available
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Not Available")
}
}
} // Item
......@@ -1266,9 +1266,9 @@ void Vehicle::_handleGpsRawInt(mavlink_message_t& message)
_gpsFactGroup.lon()->setRawValue(gpsRawInt.lon * 1e-7);
_gpsFactGroup.mgrs()->setRawValue(convertGeoToMGRS(QGeoCoordinate(gpsRawInt.lat * 1e-7, gpsRawInt.lon * 1e-7)));
_gpsFactGroup.count()->setRawValue(gpsRawInt.satellites_visible == 255 ? 0 : gpsRawInt.satellites_visible);
_gpsFactGroup.hdop()->setRawValue(gpsRawInt.eph == UINT16_MAX ? std::numeric_limits<double>::quiet_NaN() : gpsRawInt.eph / 100.0);
_gpsFactGroup.vdop()->setRawValue(gpsRawInt.epv == UINT16_MAX ? std::numeric_limits<double>::quiet_NaN() : gpsRawInt.epv / 100.0);
_gpsFactGroup.courseOverGround()->setRawValue(gpsRawInt.cog == UINT16_MAX ? std::numeric_limits<double>::quiet_NaN() : gpsRawInt.cog / 100.0);
_gpsFactGroup.hdop()->setRawValue(gpsRawInt.eph == UINT16_MAX ? qQNaN() : gpsRawInt.eph / 100.0);
_gpsFactGroup.vdop()->setRawValue(gpsRawInt.epv == UINT16_MAX ? qQNaN() : gpsRawInt.epv / 100.0);
_gpsFactGroup.courseOverGround()->setRawValue(gpsRawInt.cog == UINT16_MAX ? qQNaN() : gpsRawInt.cog / 100.0);
_gpsFactGroup.lock()->setRawValue(gpsRawInt.fix_type);
}
......@@ -1338,7 +1338,7 @@ void Vehicle::_handleHighLatency(mavlink_message_t& message)
_groundSpeedFact.setRawValue((double)highLatency.groundspeed / 5.0);
_climbRateFact.setRawValue((double)highLatency.climb_rate / 10.0);
_headingFact.setRawValue((double)highLatency.heading * 2.0);
_altitudeRelativeFact.setRawValue(std::numeric_limits<double>::quiet_NaN());
_altitudeRelativeFact.setRawValue(qQNaN());
_altitudeAMSLFact.setRawValue(coordinate.altitude);
_windFactGroup.speed()->setRawValue((double)highLatency.airspeed / 5.0);
......@@ -1385,7 +1385,7 @@ void Vehicle::_handleHighLatency2(mavlink_message_t& message)
_groundSpeedFact.setRawValue((double)highLatency2.groundspeed / 5.0);
_climbRateFact.setRawValue((double)highLatency2.climb_rate / 10.0);
_headingFact.setRawValue((double)highLatency2.heading * 2.0);
_altitudeRelativeFact.setRawValue(std::numeric_limits<double>::quiet_NaN());
_altitudeRelativeFact.setRawValue(qQNaN());
_altitudeAMSLFact.setRawValue(highLatency2.altitude);
_windFactGroup.direction()->setRawValue((double)highLatency2.wind_heading * 2.0);
......@@ -1399,8 +1399,8 @@ void Vehicle::_handleHighLatency2(mavlink_message_t& message)
_gpsFactGroup.lon()->setRawValue(highLatency2.longitude * 1e-7);
_gpsFactGroup.mgrs()->setRawValue(convertGeoToMGRS(QGeoCoordinate(highLatency2.latitude * 1e-7, highLatency2.longitude * 1e-7)));
_gpsFactGroup.count()->setRawValue(0);
_gpsFactGroup.hdop()->setRawValue(highLatency2.eph == UINT8_MAX ? std::numeric_limits<double>::quiet_NaN() : highLatency2.eph / 10.0);
_gpsFactGroup.vdop()->setRawValue(highLatency2.epv == UINT8_MAX ? std::numeric_limits<double>::quiet_NaN() : highLatency2.epv / 10.0);
_gpsFactGroup.hdop()->setRawValue(highLatency2.eph == UINT8_MAX ? qQNaN() : highLatency2.eph / 10.0);
_gpsFactGroup.vdop()->setRawValue(highLatency2.epv == UINT8_MAX ? qQNaN() : highLatency2.epv / 10.0);
struct failure2Sensor_s {
HL_FAILURE_FLAG failureBit;
......@@ -4375,9 +4375,9 @@ VehicleWindFactGroup::VehicleWindFactGroup(QObject* parent)
_addFact(&_verticalSpeedFact, _verticalSpeedFactName);
// Start out as not available "--.--"
_directionFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_speedFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_verticalSpeedFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_directionFact.setRawValue (qQNaN());
_speedFact.setRawValue (qQNaN());
_verticalSpeedFact.setRawValue (qQNaN());
}
const char* VehicleVibrationFactGroup::_xAxisFactName = "xAxis";
......@@ -4404,9 +4404,9 @@ VehicleVibrationFactGroup::VehicleVibrationFactGroup(QObject* parent)
_addFact(&_clipCount3Fact, _clipCount3FactName);
// Start out as not available "--.--"
_xAxisFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_yAxisFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_zAxisFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_xAxisFact.setRawValue(qQNaN());
_yAxisFact.setRawValue(qQNaN());
_zAxisFact.setRawValue(qQNaN());
}
const char* VehicleTemperatureFactGroup::_temperature1FactName = "temperature1";
......@@ -4424,9 +4424,9 @@ VehicleTemperatureFactGroup::VehicleTemperatureFactGroup(QObject* parent)
_addFact(&_temperature3Fact, _temperature3FactName);
// Start out as not available "--.--"
_temperature1Fact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_temperature2Fact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_temperature3Fact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_temperature1Fact.setRawValue (qQNaN());
_temperature2Fact.setRawValue (qQNaN());
_temperature3Fact.setRawValue (qQNaN());
}
const char* VehicleClockFactGroup::_currentTimeFactName = "currentTime";
......@@ -4477,12 +4477,12 @@ VehicleSetpointFactGroup::VehicleSetpointFactGroup(QObject* parent)
_addFact(&_yawRateFact, _yawRateFactName);
// Start out as not available "--.--"
_rollFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_pitchFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_yawFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rollRateFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_pitchRateFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_yawRateFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rollFact.setRawValue(qQNaN());
_pitchFact.setRawValue(qQNaN());
_yawFact.setRawValue(qQNaN());
_rollRateFact.setRawValue(qQNaN());
_pitchRateFact.setRawValue(qQNaN());
_yawRateFact.setRawValue(qQNaN());
}
const char* VehicleDistanceSensorFactGroup::_rotationNoneFactName = "rotationNone";
......@@ -4521,15 +4521,15 @@ VehicleDistanceSensorFactGroup::VehicleDistanceSensorFactGroup(QObject* parent)
_addFact(&_rotationPitch270Fact, _rotationPitch270FactName);
// Start out as not available "--.--"
_rotationNoneFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationYaw45Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationYaw135Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationYaw90Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationYaw180Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationYaw225Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationYaw270Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationPitch90Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationPitch270Fact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_rotationNoneFact.setRawValue(qQNaN());
_rotationYaw45Fact.setRawValue(qQNaN());
_rotationYaw135Fact.setRawValue(qQNaN());
_rotationYaw90Fact.setRawValue(qQNaN());
_rotationYaw180Fact.setRawValue(qQNaN());
_rotationYaw225Fact.setRawValue(qQNaN());
_rotationYaw270Fact.setRawValue(qQNaN());
_rotationPitch90Fact.setRawValue(qQNaN());
_rotationPitch270Fact.setRawValue(qQNaN());
}
const char* VehicleEstimatorStatusFactGroup::_goodAttitudeEstimateFactName = "goodAttitudeEsimate";
......
......@@ -276,7 +276,6 @@ QVariantList& QGCCorePlugin::instrumentPages()
_p->videoPageWidgetInfo = new QmlComponentInfo(tr("Video Stream"), QUrl::fromUserInput("qrc:/qml/VideoPageWidget.qml"));
}
#endif
_p->vibrationPageWidgetInfo = new QmlComponentInfo(tr("Vibration"), QUrl::fromUserInput("qrc:/qml/VibrationPageWidget.qml"));
_p->instrumentPageWidgetList.append(QVariant::fromValue(_p->cameraPageWidgetInfo));
#if defined(QGC_GST_STREAMING)
......@@ -298,6 +297,7 @@ QVariantList& QGCCorePlugin::analyzePages()
#if defined(QGC_ENABLE_MAVLINK_INSPECTOR)
_p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("MAVLink Inspector"),QUrl::fromUserInput("qrc:/qml/MAVLinkInspectorPage.qml"), QUrl::fromUserInput("qrc:/qmlimages/MAVLinkInspector"))));
#endif
_p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("Vibration"), QUrl::fromUserInput("qrc:/qml/VibrationPage.qml"), QUrl::fromUserInput("qrc:/qmlimages/VibrationPageIcon"))));
}
return _p->analyzeList;
}
......
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