diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 6b317dc3b9ec2923dc8796babc486d2fe0149cfc..f96b3370fb87393301ae44ce5f98460f9789093f 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -244,12 +244,14 @@ qml/QGroundControl/FactControls/SetupButton.qml qml/QGroundControl/FactControls/FactLabel.qml qml/QGroundControl/FactControls/FactTextField.qml + qml/QGroundControl/FactControls/FactCheckBox.qml files/images/px4/airframes/octo_x.png files/images/px4/boards/px4fmu_2.x.png src/VehicleSetup/SetupViewConnected.qml src/VehicleSetup/SetupViewDisconnected.qml + src/VehicleSetup/SetupPane.qml src/AutoPilotPlugins/PX4/SafetyComponent.qml diff --git a/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml b/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml index 9e7b01f67c9bad9bf35b34ea110c625217b59ba0..bde8da849f57ed7ade9be84fc6dd7d161e76737b 100644 --- a/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml +++ b/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml @@ -159,6 +159,7 @@ 2 0 1000 + timeouts Skip comms hold wp @@ -2041,7 +2042,7 @@ 0.5 0 35 - second + seconds diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.cc b/src/AutoPilotPlugins/PX4/SafetyComponent.cc index 78588646d49e46367071514d4206883d04af2707..3ddaf3dc6f197718ed545a84bd7e16e4ab9143f8 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.cc +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.cc @@ -102,55 +102,35 @@ QWidget* SafetyComponent::setupWidget(void) const const QVariantList& SafetyComponent::summaryItems(void) { - // FIXME: No summary items yet -#if 0 if (!_summaryItems.count()) { QString name; QString state; - // FIXME: Need to pull receiver type from RSSI value - name = "Receiver type:"; - state = "n/a"; + name = "RTL min alt:"; VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this); _summaryItems.append(QVariant::fromValue(item)); - static const char* stickParams[] = { "RC_MAP_ROLL", "RC_MAP_PITCH", "RC_MAP_YAW", "RC_MAP_THROTTLE" }; + name = "RTL home alt:"; - QString summary("Chan "); + item = new VehicleComponentSummaryItem(name, state, this); + _summaryItems.append(QVariant::fromValue(item)); + + name = "RTL home loiter:"; + + item = new VehicleComponentSummaryItem(name, state, this); + _summaryItems.append(QVariant::fromValue(item)); - bool allSticksMapped = true; - for (size_t i=0; igetParameterValue(_paramMgr->getDefaultComponentId(), stickParams[i], value)) { - if (value.toInt() == 0) { - allSticksMapped = false; - break; - } else { - if (i != 0) { - summary += ","; - } - summary += value.toString(); - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - summary += "?"; - } - } + name = "Telemetry loss RTL:"; - if (!allSticksMapped) { - summary = "Not mapped"; - } - - name = "Ail, Ele, Rud, Throt:"; - state = summary; + item = new VehicleComponentSummaryItem(name, state, this); + _summaryItems.append(QVariant::fromValue(item)); + + name = "RC loss RTL:"; item = new VehicleComponentSummaryItem(name, state, this); _summaryItems.append(QVariant::fromValue(item)); } -#endif return _summaryItems; } diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index 9e958ebdc90cd4f4378e7d0704eab6ef5ff51094..d0d14a77e7edd9537920676c900474eff4754598 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -7,14 +7,92 @@ import QGroundControl.FactControls 1.0 Rectangle { QGCPalette { id: palette; colorGroup: QGCPalette.Active } - width: 400 + width: 600 height: 400 color: palette.window Column { - Label { text: "Work in Progress"; color: palette.windowText } - Label { text: "Return to Land Altitude"; color: palette.windowText } - FactLabel { fact: autopilot.parameters["RTL_RETURN_ALT"] } - FactTextField { fact: autopilot.parameters["RTL_RETURN_ALT"] } + anchors.fill: parent + spacing: 20 + + Column { + spacing: 10 + + Label { text: "Return to Land setup"; color: palette.windowText; font.pointSize: 20 } + Row { + Label { text: "Climb to minimum altitude of "; color: palette.windowText; anchors.baseline: climbField.baseline } + FactTextField { id: climbField; fact: autopilot.parameters["RTL_RETURN_ALT"]; showUnits: true } + } + Row { + Label { text: "When Home is reached, descend to altitude of "; color: palette.windowText; anchors.baseline: descendField.baseline } + FactTextField { id: descendField; fact: autopilot.parameters["RTL_DESCEND_ALT"]; showUnits: true } + } + Row { + CheckBox { + id: homeLoiterCheckbox + property Fact fact: autopilot.parameters["RTL_LAND_DELAY"] + + checked: fact.value < 0 + text: "Loiter at Home altitude for " + + onClicked: { + fact.value = checked ? 60 : -1 + } + + style: CheckBoxStyle { + label: Text { + color: palette.windowText + text: control.text + } + } + } + FactTextField { + fact: autopilot.parameters["RTL_LAND_DELAY"]; + showUnits: true + anchors.baseline: homeLoiterCheckbox.baseline + } + } + } + + Column { + spacing: 10 + + Label { text: "Return to Land Triggers"; color: palette.windowText; font.pointSize: 20 } + Row { + FactCheckBox { + id: telemetryLossCheckbox + fact: autopilot.parameters["COM_DL_LOSS_EN"] + checkedValue: 1 + uncheckedValue: 0 + text: "Telemetry signal timeout - Return to Land" + anchors.baseline: telemetryLossField.baseline + } + Label { text: " after "; color: palette.windowText; anchors.baseline: telemetryLossField.baseline } + FactTextField { + id: telemetryLossField + fact: autopilot.parameters["NAV_DLL_N"]; + showUnits: true + } + } + Row { + Label { text: "RC Transmitter signal loss - Return to Land after "; color: palette.windowText; anchors.baseline: rcLossField.baseline } + FactTextField { id: rcLossField; fact: autopilot.parameters["COM_RC_LOSS_T"]; showUnits: true } + } + } + + Text { + width: parent.width + text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply."; + visible: autopilot.parameters["NAV_RCL_OBC"].value == 1 + color: palette.windowText + wrapMode: Text.Wrap + } + Text { + width: parent.width + text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply."; + visible: autopilot.parameters["NAV_DLL_OBC"].value == 1 + color: palette.windowText + wrapMode: Text.Wrap + } } }