Browse Source

Merge remote-tracking branch 'origin/master' into hil_flightgear

QGC4.4
Thomas Gubler 13 years ago
parent
commit
937d393dcb
  1. 7
      files/px4/parameter_tooltips/tooltips.txt
  2. 50
      files/px4/quadrotor/widgets/px4_calibration.qgw
  3. 2
      files/px4/widgets/px4_calibration.qgw
  4. 8
      files/px4/widgets/px4_fw_attitude_pid_params.qgw
  5. 8
      files/px4/widgets/px4_fw_position_pid_params.qgw
  6. 72
      files/px4/widgets/px4_mc_attitude_pid_params.qgw
  7. 1
      src/uas/QGCUASParamManager.h
  8. 3
      src/uas/UAS.h
  9. 16
      src/ui/MainWindow.cc
  10. 32
      src/ui/QGCParamWidget.cc
  11. 1
      src/ui/QGCParamWidget.h
  12. 24
      src/ui/QGCRemoteControlView.cc
  13. 298
      src/ui/QGCVehicleConfig.cc
  14. 14
      src/ui/QGCVehicleConfig.h
  15. 986
      src/ui/QGCVehicleConfig.ui
  16. 2
      src/ui/RadioCalibration/RadioCalibrationWindow.h
  17. 39
      src/ui/designer/QGCParamSlider.cc
  18. 2
      src/ui/designer/QGCParamSlider.h
  19. 244
      src/ui/designer/QGCParamSlider.ui

7
files/px4/parameter_tooltips/tooltips.txt

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
^ Name ^ Min ^ Max ^ Default ^ Multiplier ^ Enabled ^ Comment ^
| BAT_V_EMPTY | 0.9 | 100.0 | 3.2 | 1 | 1 | Voltage of an empty battery cell |
| BAT_V_FULL | 1.0 | 200.0 | 4.05 | 1 | 1 | Voltage of a full battery cell |
| BAT_N_CELLS | 1 | 100 | 3 | 1 | 1 | Number of SERIAL battery cells. Typically this ranges from 2S to 6S in small-scale UAVs |
| BAT_V_SCALING | 0.001 | 1.0 | 0.00838 | 1 | 1 | Conversion from ADC ticks to battery voltage. Depends on the connected board, calibrate with a multimeter. |
| MC_ATTRATE_P | 0.0 | 20.0 | 0.20 | 1 | 1 | Multirotor attitude rate control P gain. This gain controls how much of the motor thrust should be used to control angular velocity. A larger number will increase the control response, but will make the system also more twitchy. |
| FW_ROLLRATE_P | 0.0 | 20.0 | 0.30 | 1 | 1 | Fixed wing roll rate control P gain. This gain controls how strong the ailerons or rudder should be actuated in order to achieve a certain roll rate. A larger number will increase the control response, but will make the system also more twitchy. |

50
files/px4/quadrotor/widgets/px4_calibration.qgw

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
[PX4%20Calibration%20Tool]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_DESCRIPTION=Reboot (only in standby)
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_BUTTONTEXT=REBOOT
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_COMMANDID=246
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM1=1
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\2\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_BUTTONTEXT=MAG
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM1=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM2=1
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\3\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_DESCRIPTION=Accelerometer calibration
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_BUTTONTEXT=ACCEL
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM1=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM5=1
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\4\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_BUTTONTEXT=GYRO
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM1=1
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\size=4

2
files/px4/hexarotor/widgets/px4_calibration.qgw → files/px4/widgets/px4_calibration.qgw

@ -12,7 +12,7 @@ QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM5=0 @@ -12,7 +12,7 @@ QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\2\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_DESCRIPTION=Magnetometer calibration
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_BUTTONTEXT=MAG
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false

8
files/px4/widgets/px4_fw_attitude_pid_params.qgw

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
[PX4%20Fixed%20Wing%20Attitude%20Control]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_DESCRIPTION=Roll Rate P Gain
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_PARAMID=FW_ROLLRATE_P
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MAX=2
QGC_TOOL_WIDGET_ITEMS\size=1

8
files/px4/widgets/px4_fw_position_pid_params.qgw

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
[PX4%20Fixed%20Wing%20Position%20Control]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_DESCRIPTION=Heading P Gain
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_PARAMID=FW_HEADING_P
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MAX=2
QGC_TOOL_WIDGET_ITEMS\size=1

72
files/px4/widgets/px4_mc_attitude_pid_params.qgw

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
[PX4%20Multirotor%20Attitude%20Control]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_DESCRIPTION=Attitude P Gain
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_PARAMID=MC_ATT_P
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MAX=1.5
QGC_TOOL_WIDGET_ITEMS\2\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_DESCRIPTION=Attitude I Gain
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_PARAMID=MC_ATT_I
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\3\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_DESCRIPTION=Attitude D Gain
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_PARAMID=MC_ATT_D
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\4\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_DESCRIPTION=Attitude Anti-Windup
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_PARAMID=MC_ATT_AWU
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\5\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_DESCRIPTION=Attitude Output Limit
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_PARAMID=MC_ATT_LIM
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_MAX=3
QGC_TOOL_WIDGET_ITEMS\6\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_DESCRIPTION=Heading / Yaw P Gain
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_PARAMID=MC_YAWPOS_P
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_MAX=1.2
QGC_TOOL_WIDGET_ITEMS\7\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_DESCRIPTION=Heading / Yaw D Gain
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_PARAMID=MC_YAWPOS_D
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\8\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_DESCRIPTION=Roll / Pitch Rate P Gain
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_PARAMID=MC_ATTRATE_P
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_MAX=1.5
QGC_TOOL_WIDGET_ITEMS\9\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\9\QGC_PARAM_SLIDER_DESCRIPTION=Roll / Pitch Rate D Gain
QGC_TOOL_WIDGET_ITEMS\9\QGC_PARAM_SLIDER_PARAMID=MC_ATTRATE_D
QGC_TOOL_WIDGET_ITEMS\9\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\9\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\9\QGC_PARAM_SLIDER_MAX=0.3
QGC_TOOL_WIDGET_ITEMS\10\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\10\QGC_PARAM_SLIDER_DESCRIPTION=Yaw Rate P Gain
QGC_TOOL_WIDGET_ITEMS\10\QGC_PARAM_SLIDER_PARAMID=MC_YAWRATE_P
QGC_TOOL_WIDGET_ITEMS\10\QGC_PARAM_SLIDER_COMPONENTID=50
QGC_TOOL_WIDGET_ITEMS\10\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\10\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_DISPLAY_INFO=false
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\9\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\10\QGC_PARAM_SLIDER_DISPLAY_INFO=true
QGC_TOOL_WIDGET_ITEMS\size=10

1
src/uas/QGCUASParamManager.h

@ -42,6 +42,7 @@ public: @@ -42,6 +42,7 @@ public:
virtual double getParamMin(const QString& param) = 0;
virtual double getParamMax(const QString& param) = 0;
virtual double getParamDefault(const QString& param) = 0;
virtual QString getParamInfo(const QString& param) = 0;
/** @brief Request an update for the parameter list */
void requestParameterListUpdate(int component = 0);

3
src/uas/UAS.h

@ -478,6 +478,9 @@ public: @@ -478,6 +478,9 @@ public:
case MAV_AUTOPILOT_FP:
return "FP";
break;
case MAV_AUTOPILOT_PX4:
return "PX4";
break;
default:
return "";
break;

16
src/ui/MainWindow.cc

@ -565,11 +565,11 @@ void MainWindow::buildCommonWidgets() @@ -565,11 +565,11 @@ void MainWindow::buildCommonWidgets()
addCentralWidget(hudWidget, tr("Head Up Display"));
}
// if (!configWidget)
// {
// configWidget = new QGCVehicleConfig(this);
// addCentralWidget(configWidget, tr("Vehicle Configuration"));
// }
if (!configWidget)
{
configWidget = new QGCVehicleConfig(this);
addCentralWidget(configWidget, tr("Vehicle Configuration"));
}
if (!dataplotWidget)
{
@ -745,10 +745,14 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance) @@ -745,10 +745,14 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
void MainWindow::loadCustomWidgetsFromDefaults(const QString& systemType, const QString& autopilotType)
{
QString defaultsDir = qApp->applicationDirPath() + "/files/" + autopilotType.toLower() + "/" + systemType.toLower() + "/widgets/";
QString defaultsDir = qApp->applicationDirPath() + "/files/" + autopilotType.toLower() + "/widgets/";
QString platformDir = qApp->applicationDirPath() + "/files/" + autopilotType.toLower() + "/" + systemType.toLower() + "/widgets/";
QDir widgets(defaultsDir);
QStringList files = widgets.entryList();
QDir platformWidgets(platformDir);
files.append(platformWidgets.entryList());
if (files.count() == 0)
{
qDebug() << "No default custom widgets for system " << systemType << "autopilot" << autopilotType << " found";

32
src/ui/QGCParamWidget.cc

@ -165,11 +165,29 @@ void QGCParamWidget::loadSettings() @@ -165,11 +165,29 @@ void QGCParamWidget::loadSettings()
void QGCParamWidget::loadParameterInfoCSV(const QString& autopilot, const QString& airframe)
{
Q_UNUSED(airframe);
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
qDebug() << "ATTEMPTING TO LOAD CSV";
QDir appDir = QApplication::applicationDirPath();
appDir.cd("files");
QString fileName = QString("%1/%2/%3/parameter_tooltips/tooltips.txt").arg(appDir.canonicalPath()).arg(autopilot.toLower()).arg(airframe.toLower());
QString fileName = QString("%1/%2/parameter_tooltips/tooltips.txt").arg(appDir.canonicalPath()).arg(autopilot.toLower());
QFile paramMetaFile(fileName);
qDebug() << "AUTOPILOT:" << autopilot;
qDebug() << "FILENAME: " << fileName;
// Load CSV data
if (!paramMetaFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
@ -189,7 +207,8 @@ void QGCParamWidget::loadParameterInfoCSV(const QString& autopilot, const QStrin @@ -189,7 +207,8 @@ void QGCParamWidget::loadParameterInfoCSV(const QString& autopilot, const QStrin
QString header = in.readLine();
// Ignore top-level comment lines
while (header.startsWith('#') || header.startsWith('/') || header.startsWith('='))
while (header.startsWith('#') || header.startsWith('/')
|| header.startsWith('=') || header.startsWith('^'))
{
header = in.readLine();
}
@ -266,23 +285,24 @@ void QGCParamWidget::loadParameterInfoCSV(const QString& autopilot, const QStrin @@ -266,23 +285,24 @@ void QGCParamWidget::loadParameterInfoCSV(const QString& autopilot, const QStrin
if (parts.count() > 1)
{
// min
paramMin.insert(parts.at(0), parts.at(1).toDouble());
paramMin.insert(parts.at(0).trimmed(), parts.at(1).toDouble());
}
if (parts.count() > 2)
{
// max
paramMax.insert(parts.at(0), parts.at(2).toDouble());
paramMax.insert(parts.at(0).trimmed(), parts.at(2).toDouble());
}
if (parts.count() > 3)
{
// default
paramDefault.insert(parts.at(0), parts.at(3).toDouble());
paramDefault.insert(parts.at(0).trimmed(), parts.at(3).toDouble());
}
// IGNORING 4 and 5 for now
if (parts.count() > 6)
{
// tooltip
paramToolTips.insert(parts.at(0), parts.at(6).trimmed());
paramToolTips.insert(parts.at(0).trimmed(), parts.at(6).trimmed());
qDebug() << "PARAM META:" << parts.at(0).trimmed();
}
}
}

1
src/ui/QGCParamWidget.h

@ -57,6 +57,7 @@ public: @@ -57,6 +57,7 @@ public:
double getParamMin(const QString& param) { return paramMin.value(param, 0.0f); }
double getParamMax(const QString& param) { return paramMax.value(param, 0.0f); }
double getParamDefault(const QString& param) { return paramDefault.value(param, 0.0f); }
QString getParamInfo(const QString& param) { return paramToolTips.value(param, ""); }
signals:
/** @brief A parameter was changed in the widget, NOT onboard */

24
src/ui/QGCRemoteControlView.cc

@ -55,13 +55,13 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) : @@ -55,13 +55,13 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
this->setVisible(false);
//setVisible(false);
calibrate = new QPushButton(tr("Calibrate"), this);
QHBoxLayout *calibrateButtonLayout = new QHBoxLayout();
calibrateButtonLayout->addWidget(calibrate, 0, Qt::AlignHCenter);
layout->addItem(calibrateButtonLayout, 3, 0, 1, 2);
// calibrate = new QPushButton(tr("Calibrate"), this);
// QHBoxLayout *calibrateButtonLayout = new QHBoxLayout();
// calibrateButtonLayout->addWidget(calibrate, 0, Qt::AlignHCenter);
// layout->addItem(calibrateButtonLayout, 3, 0, 1, 2);
calibrationWindow = new RadioCalibrationWindow(this);
connect(calibrate, SIGNAL(clicked()), calibrationWindow, SLOT(show()));
// calibrationWindow = new RadioCalibrationWindow(this);
// connect(calibrate, SIGNAL(clicked()), calibrationWindow, SLOT(show()));
connect(UASManager::instance(), SIGNAL(activeUASSet(int)), this, SLOT(setUASId(int)));
@ -91,8 +91,8 @@ void QGCRemoteControlView::setUASId(int id) @@ -91,8 +91,8 @@ void QGCRemoteControlView::setUASId(int id)
// The UAS exists, disconnect any existing connections
disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float,float)), this, SLOT(setChannel(int,float,float)));
disconnect(uas, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float)));
disconnect(uas, SIGNAL(radioCalibrationRawReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
//disconnect(uas, SIGNAL(radioCalibrationRawReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
//disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
disconnect(uas, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float)));
}
}
@ -124,15 +124,15 @@ void QGCRemoteControlView::setUASId(int id) @@ -124,15 +124,15 @@ void QGCRemoteControlView::setUASId(int id)
{
// New UAS exists, connect
nameLabel->setText(QString("RC Input of %1").arg(newUAS->getUASName()));
calibrationWindow->setUASId(id);
connect(newUAS, SIGNAL(radioCalibrationReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
//calibrationWindow->setUASId(id);
//connect(newUAS, SIGNAL(radioCalibrationReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
connect(newUAS, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float)));
connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), this, SLOT(setChannelRaw(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float)));
// only connect raw channels to calibration window widget
connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
//connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
}
}
@ -178,7 +178,7 @@ void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized) @@ -178,7 +178,7 @@ void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized)
void QGCRemoteControlView::appendChannelWidget(int channelId)
{
// Create new layout
QHBoxLayout* layout = new QHBoxLayout(this);
QHBoxLayout* layout = new QHBoxLayout();
// Add content
layout->addWidget(new QLabel(QString("Channel %1").arg(channelId + 1), this));
QLabel* raw = new QLabel(this);

298
src/ui/QGCVehicleConfig.cc

@ -5,12 +5,22 @@ @@ -5,12 +5,22 @@
#include "QGCVehicleConfig.h"
#include "UASManager.h"
#include "QGC.h"
#include "QGCToolWidget.h"
#include "ui_QGCVehicleConfig.h"
QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
QWidget(parent),
mav(NULL),
changed(true),
rc_mode(RC_MODE_2),
rcRoll(0.0f),
rcPitch(0.0f),
rcYaw(0.0f),
rcThrottle(0.0f),
rcMode(0.0f),
rcAux1(0.0f),
rcAux2(0.0f),
rcAux3(0.0f),
ui(new Ui::QGCVehicleConfig)
{
setObjectName("QGC_VEHICLECONFIG");
@ -19,8 +29,11 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : @@ -19,8 +29,11 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
requestCalibrationRC();
if (mav) mav->requestParameter(0, "RC_TYPE");
ui->rcModeComboBox->setCurrentIndex((int)rc_mode - 1);
connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool)));
connect(ui->storeButton, SIGNAL(clicked()), this, SLOT(writeParameters()));
connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int)));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
@ -41,6 +54,14 @@ QGCVehicleConfig::~QGCVehicleConfig() @@ -41,6 +54,14 @@ QGCVehicleConfig::~QGCVehicleConfig()
delete ui;
}
void QGCVehicleConfig::setRCModeIndex(int newRcMode)
{
if (newRcMode > 0 && newRcMode < 5)
{
rc_mode = (enum RC_MODE) (newRcMode+1);
changed = true;
}
}
void QGCVehicleConfig::toggleCalibrationRC(bool enabled)
{
@ -57,12 +78,14 @@ void QGCVehicleConfig::toggleCalibrationRC(bool enabled) @@ -57,12 +78,14 @@ void QGCVehicleConfig::toggleCalibrationRC(bool enabled)
void QGCVehicleConfig::startCalibrationRC()
{
ui->rcTypeComboBox->setEnabled(false);
ui->rcCalibrationButton->setText(tr("Stop RC Calibration"));
resetCalibrationRC();
}
void QGCVehicleConfig::stopCalibrationRC()
{
ui->rcTypeComboBox->setEnabled(true);
ui->rcCalibrationButton->setText(tr("Start RC Calibration"));
}
void QGCVehicleConfig::setActiveUAS(UASInterface* active)
@ -77,15 +100,69 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) @@ -77,15 +100,69 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
SLOT(remoteControlChannelRawChanged(int,float)));
disconnect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this,
SLOT(parameterChanged(int,int,QString,QVariant)));
resetCalibrationRC();
foreach (QGCToolWidget* tool, toolWidgets)
{
delete tool;
}
}
// Reset current state
resetCalibrationRC();
// Connect new system
mav = active;
connect(active, SIGNAL(remoteControlChannelRawChanged(int,float)), this,
SLOT(remoteControlChannelRawChanged(int,float)));
connect(active, SIGNAL(parameterChanged(int,int,QString,QVariant)), this,
SLOT(parameterChanged(int,int,QString,QVariant)));
mav->requestParameters();
QString defaultsDir = qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower() + "/widgets/";
QGCToolWidget* tool;
// Load calibration
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_calibration.qgw", false))
{
toolWidgets.append(tool);
ui->sensorLayout->addWidget(tool);
}
// Load multirotor attitude pid
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_mc_attitude_pid_params.qgw", false))
{
toolWidgets.append(tool);
ui->multiRotorAttitudeLayout->addWidget(tool);
}
// Load multirotor position pid
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_mc_position_pid_params.qgw", false))
{
toolWidgets.append(tool);
ui->multiRotorPositionLayout->addWidget(tool);
}
// Load fixed wing attitude pid
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_fw_attitude_pid_params.qgw", false))
{
toolWidgets.append(tool);
ui->fixedWingAttitudeLayout->addWidget(tool);
}
// Load fixed wing position pid
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_fw_position_pid_params.qgw", false))
{
toolWidgets.append(tool);
ui->fixedWingPositionLayout->addWidget(tool);
}
updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
}
void QGCVehicleConfig::resetCalibrationRC()
@ -177,6 +254,16 @@ void QGCVehicleConfig::remoteControlChannelRawChanged(int chan, float val) @@ -177,6 +254,16 @@ void QGCVehicleConfig::remoteControlChannelRawChanged(int chan, float val)
if (chan < 0 || static_cast<unsigned int>(chan) >= chanMax)
return;
if (val < rcMin[chan])
{
rcMin[chan] = val;
}
if (val > rcMax[chan])
{
rcMax[chan] = val;
}
if (chan == rcMapping[0])
{
// ROLL
@ -252,16 +339,19 @@ void QGCVehicleConfig::remoteControlChannelRawChanged(int chan, float val) @@ -252,16 +339,19 @@ void QGCVehicleConfig::remoteControlChannelRawChanged(int chan, float val)
{
// AUX1
rcAux1 = val;
rcValue[5] = val;
}
else if (chan == rcMapping[6])
{
// AUX2
rcAux2 = val;
rcValue[6] = val;
}
else if (chan == rcMapping[7])
{
// AUX3
rcAux3 = val;
rcValue[7] = val;
}
changed = true;
@ -273,6 +363,91 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete @@ -273,6 +363,91 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
{
Q_UNUSED(uas);
Q_UNUSED(component);
// Channel calibration values
QRegExp minTpl("RC?_MIN");
minTpl.setPatternSyntax(QRegExp::Wildcard);
QRegExp maxTpl("RC?_MAX");
maxTpl.setPatternSyntax(QRegExp::Wildcard);
QRegExp trimTpl("RC?_TRIM");
trimTpl.setPatternSyntax(QRegExp::Wildcard);
QRegExp revTpl("RC?_REV");
revTpl.setPatternSyntax(QRegExp::Wildcard);
// Do not write the RC type, as these values depend on this
// active onboard parameter
if (minTpl.exactMatch(parameterName)) {
bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok);
if (ok && (index > 0) && (index < chanMax))
{
rcMin[index] = value.toInt();
}
}
if (maxTpl.exactMatch(parameterName)) {
bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok);
if (ok && (index > 0) && (index < chanMax))
{
rcMax[index] = value.toInt();
}
}
if (trimTpl.exactMatch(parameterName)) {
bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok);
if (ok && (index > 0) && (index < chanMax))
{
rcTrim[index] = value.toInt();
}
}
if (revTpl.exactMatch(parameterName)) {
bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok);
if (ok && (index > 0) && (index < chanMax))
{
rcRev[index] = (value.toInt() == -1) ? true : false;
unsigned int mapindex = rcMapping[index];
switch (mapindex)
{
case 0:
ui->invertCheckBox->setChecked(rcRev[index]);
break;
case 1:
ui->invertCheckBox_2->setChecked(rcRev[index]);
break;
case 2:
ui->invertCheckBox_3->setChecked(rcRev[index]);
break;
case 3:
ui->invertCheckBox_4->setChecked(rcRev[index]);
break;
case 4:
ui->invertCheckBox_5->setChecked(rcRev[index]);
break;
case 5:
ui->invertCheckBox_6->setChecked(rcRev[index]);
break;
case 6:
ui->invertCheckBox_7->setChecked(rcRev[index]);
break;
case 7:
ui->invertCheckBox_8->setChecked(rcRev[index]);
break;
}
}
}
// mav->setParameter(0, trimTpl.arg(i), rcTrim[i]);
// mav->setParameter(0, maxTpl.arg(i), rcMax[i]);
// mav->setParameter(0, revTpl.arg(i), (rcRev[i]) ? -1 : 1);
// }
if (rcTypeUpdateRequested > 0 && parameterName == QString("RC_TYPE"))
{
rcTypeUpdateRequested = 0;
@ -281,6 +456,82 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete @@ -281,6 +456,82 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
// Request all other parameters as well
requestCalibrationRC();
}
// Order is: roll, pitch, yaw, throttle, mode sw, aux 1-3
if (parameterName.contains("RC_MAP_ROLL")) {
rcMapping[0] = value.toInt();
ui->rollSpinBox->setValue(rcMapping[0]);
}
if (parameterName.contains("RC_MAP_PITCH")) {
rcMapping[1] = value.toInt();
ui->pitchSpinBox->setValue(rcMapping[1]);
}
if (parameterName.contains("RC_MAP_YAW")) {
rcMapping[2] = value.toInt();
ui->yawSpinBox->setValue(rcMapping[2]);
}
if (parameterName.contains("RC_MAP_THROTTLE")) {
rcMapping[3] = value.toInt();
ui->throttleSpinBox->setValue(rcMapping[3]);
}
if (parameterName.contains("RC_MAP_MODE_SW")) {
rcMapping[4] = value.toInt();
ui->modeSpinBox->setValue(rcMapping[4]);
}
if (parameterName.contains("RC_MAP_AUX1")) {
rcMapping[5] = value.toInt();
ui->aux1SpinBox->setValue(rcMapping[5]);
}
if (parameterName.contains("RC_MAP_AUX2")) {
rcMapping[6] = value.toInt();
ui->aux1SpinBox->setValue(rcMapping[6]);
}
if (parameterName.contains("RC_MAP_AUX3")) {
rcMapping[7] = value.toInt();
ui->aux1SpinBox->setValue(rcMapping[7]);
}
// Scaling
if (parameterName.contains("RC_SCALE_ROLL")) {
rcScaling[0] = value.toInt();
}
if (parameterName.contains("RC_SCALE_PITCH")) {
rcScaling[1] = value.toInt();
}
if (parameterName.contains("RC_SCALE_YAW")) {
rcScaling[2] = value.toInt();
}
if (parameterName.contains("RC_SCALE_THROTTLE")) {
rcScaling[3] = value.toInt();
}
if (parameterName.contains("RC_SCALE_MODE_SW")) {
rcScaling[4] = value.toInt();
}
if (parameterName.contains("RC_SCALE_AUX1")) {
rcScaling[5] = value.toInt();
}
if (parameterName.contains("RC_SCALE_AUX2")) {
rcScaling[6] = value.toInt();
}
if (parameterName.contains("RC_SCALE_AUX3")) {
rcScaling[7] = value.toInt();
}
}
void QGCVehicleConfig::updateStatus(const QString& str)
@ -321,10 +572,47 @@ void QGCVehicleConfig::updateView() @@ -321,10 +572,47 @@ void QGCVehicleConfig::updateView()
{
if (changed)
{
ui->rollSlider->setValue(rcValue[0]);
ui->pitchSlider->setValue(rcValue[1]);
ui->yawSlider->setValue(rcValue[2]);
ui->throttleSlider->setValue(rcValue[3]);
if (rc_mode == RC_MODE_1)
{
ui->rollSlider->setValue(rcRoll);
ui->pitchSlider->setValue(rcThrottle);
ui->yawSlider->setValue(rcYaw);
ui->throttleSlider->setValue(rcPitch);
}
else if (rc_mode == RC_MODE_2)
{
ui->rollSlider->setValue(rcRoll);
ui->pitchSlider->setValue(rcPitch);
ui->yawSlider->setValue(rcYaw);
ui->throttleSlider->setValue(rcThrottle);
}
else if (rc_mode == RC_MODE_3)
{
ui->rollSlider->setValue(rcYaw);
ui->pitchSlider->setValue(rcThrottle);
ui->yawSlider->setValue(rcRoll);
ui->throttleSlider->setValue(rcPitch);
}
else if (rc_mode == RC_MODE_4)
{
ui->rollSlider->setValue(rcYaw);
ui->pitchSlider->setValue(rcPitch);
ui->yawSlider->setValue(rcRoll);
ui->throttleSlider->setValue(rcThrottle);
}
ui->chanLabel->setText(QString("%1/%2").arg(rcValue[0]).arg(rcRoll));
ui->chanLabel_2->setText(QString("%1/%2").arg(rcValue[1]).arg(rcPitch));
ui->chanLabel_3->setText(QString("%1/%2").arg(rcValue[2]).arg(rcYaw));
ui->chanLabel_4->setText(QString("%1/%2").arg(rcValue[3]).arg(rcThrottle));
ui->modeSwitchSlider->setValue(rcMode);
ui->chanLabel_5->setText(QString("%1/%2").arg(rcValue[4]).arg(rcMode));
ui->aux1Slider->setValue(rcAux1);
ui->chanLabel_6->setText(QString("%1/%2").arg(rcValue[5]).arg(rcAux1));
ui->aux2Slider->setValue(rcAux2);
ui->chanLabel_7->setText(QString("%1/%2").arg(rcValue[6]).arg(rcAux2));
ui->aux3Slider->setValue(rcAux3);
ui->chanLabel_8->setText(QString("%1/%2").arg(rcValue[7]).arg(rcAux3));
changed = false;
}
}

14
src/ui/QGCVehicleConfig.h

@ -3,7 +3,9 @@ @@ -3,7 +3,9 @@
#include <QWidget>
#include <QTimer>
#include <QList>
#include "QGCToolWidget.h"
#include "UASInterface.h"
namespace Ui {
@ -18,6 +20,13 @@ public: @@ -18,6 +20,13 @@ public:
explicit QGCVehicleConfig(QWidget *parent = 0);
~QGCVehicleConfig();
enum RC_MODE {
RC_MODE_1 = 1,
RC_MODE_2 = 2,
RC_MODE_3 = 3,
RC_MODE_4 = 4
};
public slots:
/** Set the MAV currently being calibrated */
void setActiveUAS(UASInterface* active);
@ -28,6 +37,8 @@ public slots: @@ -28,6 +37,8 @@ public slots:
void stopCalibrationRC();
/** Start/stop the RC calibration routine */
void toggleCalibrationRC(bool enabled);
/** Change the mode setting of the control inputs */
void setRCModeIndex(int newRcMode);
/** Render the data updated */
void updateView();
@ -60,6 +71,7 @@ protected: @@ -60,6 +71,7 @@ protected:
int rcMax[chanMax]; ///< Maximum values
int rcTrim[chanMax]; ///< Zero-position (center for roll/pitch/yaw, 0 throttle for throttle)
int rcMapping[chanMax]; ///< PWM to function mappings
float rcScaling[chanMax]; ///< Scaling of channel input to control commands
bool rcRev[chanMax]; ///< Channel reverse
int rcValue[chanMax]; ///< Last values
float rcRoll; ///< PPM input channel used as roll control input
@ -73,6 +85,8 @@ protected: @@ -73,6 +85,8 @@ protected:
bool rcCalChanged; ///< Set if the calibration changes (and needs to be written)
bool changed; ///< Set if any of the input data changed
QTimer updateTimer; ///< Controls update intervals
enum RC_MODE rc_mode; ///< Mode of the remote control, according to usual convention
QList<QGCToolWidget*> toolWidgets; ///< Configurable widgets
private:
Ui::QGCVehicleConfig *ui;

986
src/ui/QGCVehicleConfig.ui

File diff suppressed because it is too large Load Diff

2
src/ui/RadioCalibration/RadioCalibrationWindow.h

@ -50,8 +50,6 @@ This file is part of the QGROUNDCONTROL project @@ -50,8 +50,6 @@ This file is part of the QGROUNDCONTROL project
#include "SwitchCalibrator.h"
#include "CurveCalibrator.h"
#include "../../../mavlink/include/mavlink/v1.0/common/mavlink.h"
#include "../../../mavlink/include/mavlink/v1.0/mavlink_types.h"
#include "UAS.h"
#include "UASManager.h"
#include "RadioCalibrationData.h"

39
src/ui/designer/QGCParamSlider.cc

@ -25,6 +25,7 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) : @@ -25,6 +25,7 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) :
scaledInt = ui->valueSlider->maximum() - ui->valueSlider->minimum();
ui->editInfoCheckBox->hide();
ui->editDoneButton->hide();
ui->editNameLabel->hide();
ui->editRefreshParamsButton->hide();
@ -51,13 +52,10 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) : @@ -51,13 +52,10 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) :
connect(ui->editNameLabel, SIGNAL(textChanged(QString)), ui->nameLabel, SLOT(setText(QString)));
connect(ui->readButton, SIGNAL(clicked()), this, SLOT(requestParameter()));
connect(ui->editRefreshParamsButton, SIGNAL(clicked()), this, SLOT(refreshParamList()));
connect(ui->editInfoCheckBox, SIGNAL(clicked(bool)), this, SLOT(showInfo(bool)));
// Set the current UAS if present
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
setActiveUAS(UASManager::instance()->getActiveUAS());
// Get param value after settings have been loaded
QTimer::singleShot(300, this, SLOT(requestParameter()));
}
QGCParamSlider::~QGCParamSlider()
@ -88,13 +86,14 @@ void QGCParamSlider::setActiveUAS(UASInterface* activeUas) @@ -88,13 +86,14 @@ void QGCParamSlider::setActiveUAS(UASInterface* activeUas)
connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection);
uas = activeUas;
// Update current param value
if (parameterName == "")
requestParameter();
// Set param info
QString text = uas->getParamManager()->getParamInfo(parameterName);
ui->infoLabel->setText(text);
// Force-uncheck and hide label if no description is available
if (ui->editInfoCheckBox->isChecked())
{
refreshParamList();
}
else
{
requestParameter();
showInfo((text.length() > 0));
}
}
}
@ -107,6 +106,12 @@ void QGCParamSlider::requestParameter() @@ -107,6 +106,12 @@ void QGCParamSlider::requestParameter()
}
}
void QGCParamSlider::showInfo(bool enable)
{
ui->editInfoCheckBox->setChecked(enable);
ui->infoLabel->setVisible(enable);
}
void QGCParamSlider::setParamValue(double value)
{
parameterValue = (float)value;
@ -150,6 +155,11 @@ void QGCParamSlider::selectParameter(int paramIndex) @@ -150,6 +155,11 @@ void QGCParamSlider::selectParameter(int paramIndex)
parameterMax = uas->getParamManager()->getParamMax(parameterName);
ui->editMaxSpinBox->setValue(parameterMax);
}
// Description
QString text = uas->getParamManager()->getParamInfo(parameterName);
ui->infoLabel->setText(text);
showInfo(!(text.length() > 0));
}
}
}
@ -163,6 +173,7 @@ void QGCParamSlider::startEditMode() @@ -163,6 +173,7 @@ void QGCParamSlider::startEditMode()
ui->writeButton->hide();
ui->readButton->hide();
ui->editInfoCheckBox->show();
ui->editDoneButton->show();
ui->editNameLabel->show();
ui->editRefreshParamsButton->show();
@ -190,6 +201,7 @@ void QGCParamSlider::endEditMode() @@ -190,6 +201,7 @@ void QGCParamSlider::endEditMode()
parameterMin = ui->editMinSpinBox->value();
parameterMax = ui->editMaxSpinBox->value();
ui->editInfoCheckBox->hide();
ui->editDoneButton->hide();
ui->editNameLabel->hide();
ui->editRefreshParamsButton->hide();
@ -370,6 +382,7 @@ void QGCParamSlider::writeSettings(QSettings& settings) @@ -370,6 +382,7 @@ void QGCParamSlider::writeSettings(QSettings& settings)
settings.setValue("QGC_PARAM_SLIDER_COMPONENTID", component);
settings.setValue("QGC_PARAM_SLIDER_MIN", ui->editMinSpinBox->value());
settings.setValue("QGC_PARAM_SLIDER_MAX", ui->editMaxSpinBox->value());
settings.setValue("QGC_PARAM_SLIDER_DISPLAY_INFO", ui->editInfoCheckBox->isChecked());
settings.sync();
}
@ -385,6 +398,12 @@ void QGCParamSlider::readSettings(const QSettings& settings) @@ -385,6 +398,12 @@ void QGCParamSlider::readSettings(const QSettings& settings)
ui->editSelectComponentComboBox->addItem(tr("Component #%1").arg(settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt()), settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt());
ui->editMinSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MIN").toFloat());
ui->editMaxSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MAX").toFloat());
showInfo(settings.value("QGC_PARAM_SLIDER_DISPLAY_INFO", true).toBool());
ui->editSelectParamComboBox->setEnabled(true);
ui->editSelectComponentComboBox->setEnabled(true);
setActiveUAS(UASManager::instance()->getActiveUAS());
// Get param value after settings have been loaded
requestParameter();
}

2
src/ui/designer/QGCParamSlider.h

@ -39,6 +39,8 @@ public slots: @@ -39,6 +39,8 @@ public slots:
void setParamValue(double value);
/** @brief Set an integer parameter value */
void setParamValue(int value);
/** @brief Show descriptive text next to slider */
void showInfo(bool enable);
protected slots:
/** @brief Request the parameter of this widget from the MAV */

244
src/ui/designer/QGCParamSlider.ui

@ -7,13 +7,13 @@ @@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>789</width>
<height>158</height>
<height>244</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="100,0,0,0,0,0,0,0,0">
<layout class="QGridLayout" name="gridLayout" columnstretch="10,0,0,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>6</number>
</property>
@ -32,72 +32,17 @@ @@ -32,72 +32,17 @@
<property name="verticalSpacing">
<number>12</number>
</property>
<item row="1" column="1" colspan="5">
<widget class="QLineEdit" name="editNameLabel">
<property name="text">
<string>&lt;Parameter Name / Label&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="nameLabel">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="5" colspan="2">
<widget class="QSlider" name="valueSlider">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
<item row="2" column="5">
<widget class="QSpinBox" name="intValueSpinBox">
<property name="minimum">
<number>-999999999</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="1" colspan="6">
<widget class="QLabel" name="editStatusLabel">
<property name="text">
<string>Please click first on refresh to update selection menus..</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="editSelectComponentComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select component</string>
</property>
<property name="statusTip">
<string>Select component</string>
<number>999999999</number>
</property>
</widget>
</item>
<item row="3" column="4" colspan="3">
<item row="3" column="5" colspan="3">
<widget class="QComboBox" name="editSelectParamComboBox">
<property name="enabled">
<bool>false</bool>
@ -110,44 +55,27 @@ @@ -110,44 +55,27 @@
</property>
</widget>
</item>
<item row="2" column="8">
<widget class="QPushButton" name="readButton">
<item row="2" column="2">
<widget class="QLabel" name="nameLabel">
<property name="minimumSize">
<size>
<width>0</width>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Read the current parameter value on the system</string>
</property>
<property name="statusTip">
<string>Read the current parameter value on the system</string>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
</item>
<item row="3" column="8">
<widget class="QPushButton" name="editRefreshParamsButton">
<property name="enabled">
<bool>true</bool>
<string>Name</string>
</property>
<property name="text">
<string>Refresh</string>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="8">
<widget class="QPushButton" name="editDoneButton">
<property name="text">
<string>Done</string>
<item row="1" column="7">
<widget class="QDoubleSpinBox" name="editMinSpinBox">
<property name="prefix">
<string>MIN: </string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="doubleValueSpinBox">
<property name="minimum">
<double>-999999999.000000000000000</double>
</property>
@ -156,6 +84,13 @@ @@ -156,6 +84,13 @@
</property>
</widget>
</item>
<item row="1" column="2" colspan="5">
<widget class="QLineEdit" name="editNameLabel">
<property name="text">
<string>&lt;Parameter Name / Label&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
@ -169,7 +104,7 @@ @@ -169,7 +104,7 @@
</property>
</spacer>
</item>
<item row="2" column="7">
<item row="2" column="8">
<widget class="QPushButton" name="writeButton">
<property name="minimumSize">
<size>
@ -194,8 +129,8 @@ @@ -194,8 +129,8 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="9">
<widget class="Line" name="editLine1">
<item row="7" column="0" colspan="10">
<widget class="Line" name="editLine2">
<property name="minimumSize">
<size>
<width>0</width>
@ -207,33 +142,78 @@ @@ -207,33 +142,78 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="9">
<widget class="Line" name="editLine2">
<item row="2" column="6" colspan="2">
<widget class="QSlider" name="valueSlider">
<property name="minimumSize">
<size>
<width>0</width>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QDoubleSpinBox" name="editMinSpinBox">
<property name="prefix">
<string>MIN: </string>
<item row="3" column="8">
<widget class="QCheckBox" name="editInfoCheckBox">
<property name="text">
<string>Show Info</string>
</property>
<property name="minimum">
<double>-999999999.000000000000000</double>
<property name="checked">
<bool>true</bool>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QComboBox" name="editSelectComponentComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select component</string>
</property>
<property name="statusTip">
<string>Select component</string>
</property>
</widget>
</item>
<item row="1" column="7" colspan="2">
<item row="2" column="9">
<widget class="QPushButton" name="readButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Read the current parameter value on the system</string>
</property>
<property name="statusTip">
<string>Read the current parameter value on the system</string>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
</item>
<item row="5" column="2" colspan="6">
<widget class="QLabel" name="editStatusLabel">
<property name="text">
<string>Please click first on refresh to update selection menus..</string>
</property>
</widget>
</item>
<item row="1" column="8" colspan="2">
<widget class="QDoubleSpinBox" name="editMaxSpinBox">
<property name="prefix">
<string>MAX: </string>
@ -246,16 +226,62 @@ @@ -246,16 +226,62 @@
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QSpinBox" name="intValueSpinBox">
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="doubleValueSpinBox">
<property name="minimum">
<number>-999999999</number>
<double>-999999999.000000000000000</double>
</property>
<property name="maximum">
<number>999999999</number>
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="6">
<widget class="QTextBrowser" name="infoLabel"/>
</item>
<item row="0" column="0" colspan="10">
<widget class="Line" name="editLine1">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="9">
<widget class="QPushButton" name="editRefreshParamsButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item row="5" column="9">
<widget class="QPushButton" name="editDoneButton">
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
<item row="6" column="2" colspan="8">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>

Loading…
Cancel
Save