Browse Source

Px4 usability (#3302)

* PX4: Deal properly with optional components

* RC map UI: Offer better defaults and user guidance
QGC4.4
Lorenz Meier 9 years ago
parent
commit
d33df110c3
  1. 2
      src/AutoPilotPlugins/Common/RadioComponent.qml
  2. 2
      src/AutoPilotPlugins/PX4/CameraComponentSummary.qml
  3. 4
      src/AutoPilotPlugins/PX4/PowerComponent.qml
  4. 5
      src/AutoPilotPlugins/PX4/SafetyComponent.qml
  5. 13
      src/ui/QGCMapRCToParamDialog.cpp
  6. 22
      src/ui/QGCMapRCToParamDialog.ui

2
src/AutoPilotPlugins/Common/RadioComponent.qml

@ -469,7 +469,7 @@ QGCView { @@ -469,7 +469,7 @@ QGCView {
}
Repeater {
model: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? [ "RC_MAP_FLAPS", "RC_MAP_AUX1", "RC_MAP_AUX2", "RC_MAP_AUX3" ] : 0
model: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? [ "RC_MAP_FLAPS", "RC_MAP_AUX1", "RC_MAP_AUX2", "RC_MAP_PARAM1", "RC_MAP_PARAM2", "RC_MAP_PARAM3"] : 0
Row {
spacing: ScreenTools.defaultFontPixelWidth

2
src/AutoPilotPlugins/PX4/CameraComponentSummary.qml

@ -14,7 +14,7 @@ FactPanel { @@ -14,7 +14,7 @@ FactPanel {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE")
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE", 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

4
src/AutoPilotPlugins/PX4/PowerComponent.qml

@ -46,6 +46,7 @@ QGCView { @@ -46,6 +46,7 @@ QGCView {
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
property Fact uavcanEnable: controller.getParameterFact(-1, "UAVCAN_ENABLE", false)
readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
readonly property string highlightSuffix: "</font>"
@ -270,6 +271,7 @@ QGCView { @@ -270,6 +271,7 @@ QGCView {
QGCCheckBox {
id: showUAVCAN
text: qsTr("Show UAVCAN Settings")
visible: uavcanEnable !== -1
}
QGCLabel {
@ -294,7 +296,7 @@ QGCView { @@ -294,7 +296,7 @@ QGCView {
FactCheckBox {
id: uavcanEnabledCheckBox
width: ScreenTools.defaultFontPixelWidth * 20
fact: controller.getParameterFact(-1, "UAVCAN_ENABLE")
fact: _uavcanEnabled
checkedValue: 3
uncheckedValue: 0
text: qsTr("Enable UAVCAN as the default MAIN output bus (requires autopilot restart)")

5
src/AutoPilotPlugins/PX4/SafetyComponent.qml

@ -55,6 +55,7 @@ QGCView { @@ -55,6 +55,7 @@ QGCView {
property Fact _rcLossAction: controller.getParameterFact(-1, "NAV_RCL_ACT")
property Fact _dlLossAction: controller.getParameterFact(-1, "NAV_DLL_ACT")
property Fact _disarmLandDelay: controller.getParameterFact(-1, "COM_DISARM_LAND")
property Fact _landSpeedMC: controller.getParameterFact(-1, "MPC_LAND_SPEED", false)
QGCViewPanel {
id: panel
@ -483,7 +484,7 @@ QGCView { @@ -483,7 +484,7 @@ QGCView {
spacing: _margins * 0.5
anchors.verticalCenter: parent.verticalCenter
Row {
visible: !controller.fixedWing
visible: _landSpeedMC !== -1
QGCLabel {
anchors.baseline: landVelField.baseline
width: _middleRowWidth
@ -491,7 +492,7 @@ QGCView { @@ -491,7 +492,7 @@ QGCView {
}
FactTextField {
id: landVelField
fact: controller.getParameterFact(-1, "MPC_LAND_SPEED")
fact: _landSpeedMC
showUnits: true
width: _editFieldWidth
}

13
src/ui/QGCMapRCToParamDialog.cpp

@ -41,17 +41,22 @@ QGCMapRCToParamDialog::QGCMapRCToParamDialog(QString param_id, UASInterface *mav @@ -41,17 +41,22 @@ QGCMapRCToParamDialog::QGCMapRCToParamDialog(QString param_id, UASInterface *mav
, ui(new Ui::QGCMapRCToParamDialog)
{
ui->setupUi(this);
// refresh the parameter from onboard to make sure the current value is used
AutoPilotPlugin* autopilot = _multiVehicleManager->getVehicleById(mav->getUASID())->autopilotPlugin();
Q_ASSERT(autopilot);
Fact* paramFact = autopilot->getParameterFact(FactSystem::defaultComponentId, param_id);
ui->minValueDoubleSpinBox->setValue(paramFact->rawMin().toDouble());
ui->maxValueDoubleSpinBox->setValue(paramFact->rawMax().toDouble());
// only enable ok button when param was refreshed
QPushButton *okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
okButton->setEnabled(false);
ui->paramIdLabel->setText(param_id);
// refresh the parameter from onboard to make sure the current value is used
AutoPilotPlugin* autopilot = _multiVehicleManager->getVehicleById(mav->getUASID())->autopilotPlugin();
Q_ASSERT(autopilot);
connect(autopilot->getParameterFact(FactSystem::defaultComponentId, param_id), &Fact::valueChanged, this, &QGCMapRCToParamDialog::_parameterUpdated);
connect(paramFact, &Fact::valueChanged, this, &QGCMapRCToParamDialog::_parameterUpdated);
autopilot->refreshParameter(FactSystem::defaultComponentId, param_id);
}

22
src/ui/QGCMapRCToParamDialog.ui

@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
<x>9</x>
<y>9</y>
<width>381</width>
<height>271</height>
<height>296</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
<item row="1" column="0">
<widget class="QLabel" name="rcParamChannelInfoLabel">
<property name="text">
<string>RC-Parameter Channel (Knob No.)</string>
<string>Parameter Tuning ID</string>
</property>
</widget>
</item>
@ -81,13 +81,6 @@ @@ -81,13 +81,6 @@
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label2">
<property name="text">
<string>to</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="paramIdInfoLabel">
<property name="text">
@ -112,7 +105,7 @@ @@ -112,7 +105,7 @@
<item row="5" column="0">
<widget class="QLabel" name="scaleInfoLabel">
<property name="text">
<string>Scale</string>
<string>Scale (keep default)</string>
</property>
</widget>
</item>
@ -126,7 +119,7 @@ @@ -126,7 +119,7 @@
<item row="6" column="0">
<widget class="QLabel" name="value0InfoLabel">
<property name="text">
<string>Initial Value</string>
<string>Center value</string>
</property>
</widget>
</item>
@ -212,6 +205,13 @@ @@ -212,6 +205,13 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label2">
<property name="text">
<string>Tuning IDs can be mapped to channels in the RC settings</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

Loading…
Cancel
Save