Commit 4cd86dec authored by Bill Bonney's avatar Bill Bonney

Merge branch 'new_menus' of https://github.com/diydrones/apm_planner into new_menus

Conflicts:
	qgroundcontrol.pro
parents 75def93b 98dc9dfc
......@@ -255,7 +255,12 @@ FORMS += src/ui/MainWindow.ui \
src/ui/configuration/GeoFenceConfig.ui \
src/ui/configuration/FailSafeConfig.ui \
src/ui/configuration/AdvancedParamConfig.ui \
src/ui/configuration/ArduCopterPidConfig.ui
src/ui/configuration/ArduCopterPidConfig.ui \
src/ui/configuration/ApmPlaneLevel.ui \
src/ui/configuration/ParamWidget.ui \
src/ui/configuration/ArduPlanePidConfig.ui \
src/ui/configuration/AdvParameterList.ui \
src/ui/configuration/ArduRoverPidConfig.ui
INCLUDEPATH += src \
src/ui \
src/ui/linechart \
......@@ -437,7 +442,12 @@ HEADERS += src/MG.h \
src/ui/configuration/FailSafeConfig.h \
src/ui/configuration/AdvancedParamConfig.h \
src/ui/configuration/ArduCopterPidConfig.h \
src/ui/apmtoolbar.h
src/ui/apmtoolbar.h \
src/ui/configuration/ApmPlaneLevel.h \
src/ui/configuration/ParamWidget.h \
src/ui/configuration/ArduPlanePidConfig.h \
src/ui/configuration/AdvParameterList.h \
src/ui/configuration/ArduRoverPidConfig.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
......@@ -637,7 +647,12 @@ SOURCES += src/main.cc \
src/ui/configuration/FailSafeConfig.cc \
src/ui/configuration/AdvancedParamConfig.cc \
src/ui/configuration/ArduCopterPidConfig.cc \
src/ui/apmtoolbar.cpp
src/ui/apmtoolbar.cpp \
src/ui/configuration/ApmPlaneLevel.cc \
src/ui/configuration/ParamWidget.cc \
src/ui/configuration/ArduPlanePidConfig.cc \
src/ui/configuration/AdvParameterList.cc \
src/ui/configuration/ArduRoverPidConfig.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
......@@ -72,7 +72,7 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
this->setApplicationName(QGC_APPLICATION_NAME);
this->setApplicationVersion(QGC_APPLICATION_VERSION);
this->setOrganizationName(QLatin1String("diydrones"));
this->setOrganizationDomain("org.diydrones");
this->setOrganizationDomain("com.diydrones");
// Set settings format
QSettings::setDefaultFormat(QSettings::IniFormat);
......
......@@ -34,8 +34,8 @@
<rect>
<x>70</x>
<y>160</y>
<width>81</width>
<height>31</height>
<width>111</width>
<height>41</height>
</rect>
</property>
<property name="text">
......@@ -48,8 +48,8 @@ Accelerometer</string>
<rect>
<x>20</x>
<y>50</y>
<width>211</width>
<height>91</height>
<width>311</width>
<height>101</height>
</rect>
</property>
<property name="text">
......
#include "AdvParameterList.h"
AdvParameterList::AdvParameterList(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
ui.tableWidget->setColumnCount(4);
ui.tableWidget->horizontalHeader()->hide();
ui.tableWidget->verticalHeader()->hide();
//ui.tableWidget->setHorizontalHeader(0);
//ui.tableWidget->setVerticalHeader(0);
ui.tableWidget->setColumnWidth(0,200);
ui.tableWidget->setColumnWidth(1,100);
ui.tableWidget->setColumnWidth(2,200);
ui.tableWidget->setColumnWidth(3,800);
}
AdvParameterList::~AdvParameterList()
{
}
void AdvParameterList::setParameterMetaData(QString name,QString humanname,QString description)
{
paramToNameMap[name] = humanname;
paramToDescriptionMap[name] = description;
}
void AdvParameterList::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (!paramValueMap.contains(parameterName))
{
ui.tableWidget->setRowCount(ui.tableWidget->rowCount()+1);
if (paramToNameMap.contains(parameterName))
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,0,new QTableWidgetItem(paramToNameMap[parameterName]));
}
else
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,0,new QTableWidgetItem("Unknown"));
}
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,1,new QTableWidgetItem(QString::number(value.toFloat(),'f',2)));
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,2,new QTableWidgetItem(parameterName));
if (paramToDescriptionMap.contains(parameterName))
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,3,new QTableWidgetItem(paramToDescriptionMap[parameterName]));
}
else
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,3,new QTableWidgetItem("Unknown"));
}
paramValueMap[parameterName] = ui.tableWidget->item(ui.tableWidget->rowCount()-1,1);
}
paramValueMap[parameterName]->setText(QString::number(value.toFloat(),'f',2));
}
#ifndef ADVPARAMETERLIST_H
#define ADVPARAMETERLIST_H
#include <QWidget>
#include "ui_AdvParameterList.h"
#include "AP2ConfigWidget.h"
class AdvParameterList : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AdvParameterList(QWidget *parent = 0);
void setParameterMetaData(QString name,QString humanname,QString description);
~AdvParameterList();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<QString,QTableWidgetItem*> paramValueMap;
QMap<QString,QString> paramToNameMap;
QMap<QString,QString> paramToDescriptionMap;
Ui::AdvParameterList ui;
};
#endif // ADVPARAMETERLIST_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AdvParameterList</class>
<widget class="QWidget" name="AdvParameterList">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;h2&gt;Advanced Parameter List&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "AdvancedParamConfig.h"
AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : QWidget(parent)
AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
}
......@@ -9,3 +9,27 @@ AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : QWidget(parent)
AdvancedParamConfig::~AdvancedParamConfig()
{
}
void AdvancedParamConfig::addRange(QString title,QString description,QString param,double min,double max)
{
ParamWidget *widget = new ParamWidget(ui.scrollAreaWidgetContents);
paramToWidgetMap[param] = widget;
widget->setupDouble(title + "(" + param + ")",description,0,min,max);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void AdvancedParamConfig::addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist)
{
ParamWidget *widget = new ParamWidget(ui.scrollAreaWidgetContents);
paramToWidgetMap[param] = widget;
widget->setupCombo(title + "(" + param + ")",description,valuelist);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void AdvancedParamConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (paramToWidgetMap.contains(parameterName))
{
paramToWidgetMap[parameterName]->setValue(value.toDouble());
}
}
......@@ -3,16 +3,21 @@
#include <QWidget>
#include "ui_AdvancedParamConfig.h"
class AdvancedParamConfig : public QWidget
#include "AP2ConfigWidget.h"
#include "ParamWidget.h"
class AdvancedParamConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AdvancedParamConfig(QWidget *parent = 0);
~AdvancedParamConfig();
void addRange(QString title,QString description,QString param,double min,double max);
void addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist);
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<QString,ParamWidget*> paramToWidgetMap;
Ui::AdvancedParamConfig ui;
};
......
......@@ -6,26 +6,44 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>725</width>
<height>632</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>181</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Advanced Params&lt;/h2&gt;</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;h2&gt;Advanced Params&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>705</width>
<height>585</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
......
......@@ -30,35 +30,28 @@ This file is part of the QGROUNDCONTROL project
*/
#include "ApmHardwareConfig.h"
ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
//ui.firmwareButton->setVisible(valse);
ui.manditoryHardware->setVisible(false);
ui.frameTypeButton->setVisible(false);
ui.compassButton->setVisible(false);
ui.accelCalibrateButton->setVisible(false);
ui.arduPlaneLevelButton->setVisible(false);
ui.radioCalibrateButton->setVisible(false);
ui.optionalHardwareButton->setVisible(false);
//ui.radio3DRButton->setVisible(false);
ui.batteryMonitorButton->setVisible(false);
ui.sonarButton->setVisible(false);
ui.airspeedButton->setVisible(false);
ui.opticalFlowButton->setVisible(false);
ui.osdButton->setVisible(false);
ui.cameraGimbalButton->setVisible(false);
//ui.antennaTrackerButton->setVisible(false);
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.frameTypeButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.accelCalibrateButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.radio3DRButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.batteryMonitorButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.sonarButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.airspeedButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.opticalFlowButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.osdButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.cameraGimbalButton,SLOT(setShown(bool)));
......@@ -87,6 +80,11 @@ ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
buttonToConfigWidgetMap[ui.accelCalibrateButton] = accelConfig;
connect(ui.accelCalibrateButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
planeLevel = new ApmPlaneLevel(this);
ui.stackedWidget->addWidget(planeLevel);
buttonToConfigWidgetMap[ui.arduPlaneLevelButton] = planeLevel;
connect(ui.arduPlaneLevelButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
radioConfig = new RadioCalibrationConfig(this);
ui.stackedWidget->addWidget(radioConfig);
buttonToConfigWidgetMap[ui.radioCalibrateButton] = radioConfig;
......@@ -133,8 +131,6 @@ ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
buttonToConfigWidgetMap[ui.antennaTrackerButton] = antennaTrackerConfig;
connect(ui.antennaTrackerButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
if (UASManager::instance()->getActiveUAS())
{
......@@ -159,11 +155,33 @@ void ApmHardwareConfig::activeUASSet(UASInterface *uas)
{
return;
}
if (uas->getSystemType() == MAV_TYPE_FIXED_WING)
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.arduPlaneLevelButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.airspeedButton,SLOT(setShown(bool)));
}
else if (uas->getSystemType() == MAV_TYPE_QUADROTOR)
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.frameTypeButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.accelCalibrateButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool)));
}
else if (uas->getSystemType() == MAV_TYPE_GROUND_ROVER)
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool)));
}
else
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool)));
}
ui.firmwareButton->setVisible(true);
ui.manditoryHardware->setVisible(true);
ui.manditoryHardware->setChecked(false);
ui.manditoryHardware->setChecked(true);
ui.optionalHardwareButton->setVisible(true);
ui.optionalHardwareButton->setChecked(false);
ui.radio3DRButton->setVisible(false);
ui.antennaTrackerButton->setVisible(false);
ui.optionalHardwareButton->setChecked(true);
}
......@@ -48,6 +48,7 @@ This file is part of the QGROUNDCONTROL project
#include "OsdConfig.h"
#include "CameraGimbalConfig.h"
#include "AntennaTrackerConfig.h"
#include "ApmPlaneLevel.h"
class ApmHardwareConfig : public QWidget
{
......@@ -70,6 +71,7 @@ private:
OsdConfig *osdConfig;
CameraGimbalConfig *cameraGimbalConfig;
AntennaTrackerConfig *antennaTrackerConfig;
ApmPlaneLevel *planeLevel;
private slots:
void activeUASSet(UASInterface *uas);
void activateStackedWidget();
......
......@@ -43,7 +43,7 @@
<x>0</x>
<y>0</y>
<width>156</width>
<height>635</height>
<height>676</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
......@@ -129,6 +129,25 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="arduPlaneLevelButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string> ArduPlane Level</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="radioCalibrateButton">
<property name="minimumSize">
......
#include "ApmPlaneLevel.h"
#include <QMessageBox>
ApmPlaneLevel::ApmPlaneLevel(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
connect(ui.levelPushButton,SIGNAL(clicked()),this,SLOT(levelClicked()));
connect(ui.manualLevelCheckBox,SIGNAL(toggled(bool)),this,SLOT(manualCheckBoxToggled(bool)));
}
ApmPlaneLevel::~ApmPlaneLevel()
{
}
void ApmPlaneLevel::levelClicked()
{
QMessageBox::information(0,"Warning","Be sure the plane is completly level, then click ok");
MAV_CMD command = MAV_CMD_PREFLIGHT_CALIBRATION;
int confirm = 0;
float param1 = 1;
float param2 = 0;
float param3 = 1;
float param4 = 0;
float param5 = 0;
float param6 = 0;
float param7 = 0;
int component = 1;
m_uas->executeCommand(command, confirm, param1, param2, param3, param4, param5, param6, param7, component);
QMessageBox::information(0,"Warning","Leveling completed");
}
void ApmPlaneLevel::manualCheckBoxToggled(bool checked)
{
if (!m_uas)
{
return;
}
if (checked)
{
m_uas->getParamManager()->setParameter(1,"MANUAL_LEVEL",1);
}
else
{
m_uas->getParamManager()->setParameter(1,"MANUAL_LEVEL",0);
}
}
void ApmPlaneLevel::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (parameterName == "MANUAL_LEVEL")
{
if (value.toInt() == 1)
{
ui.manualLevelCheckBox->setChecked(true);
}
else
{
ui.manualLevelCheckBox->setChecked(false);
}
}
}
#ifndef APMPLANELEVEL_H
#define APMPLANELEVEL_H
#include <QWidget>
#include "ui_ApmPlaneLevel.h"
#include "AP2ConfigWidget.h"
class ApmPlaneLevel : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit ApmPlaneLevel(QWidget *parent = 0);
~ApmPlaneLevel();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void levelClicked();
void manualCheckBoxToggled(bool checked);
private:
Ui::ApmPlaneLevel ui;
};
#endif // APMPLANELEVEL_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ApmPlaneLevel</class>
<widget class="QWidget" name="ApmPlaneLevel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;ArduPlane Level&lt;/h2&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>70</y>
<width>271</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>By Default your plane will autolevel on every boot.
To disable this action you need to turn on manual
level and perform a level to calibrate the accel offsets.</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>50</x>
<y>150</y>
<width>291</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Level your plane and click Level to set default accel offsets</string>
</property>
</widget>
<widget class="QPushButton" name="levelPushButton">
<property name="geometry">
<rect>
<x>160</x>
<y>180</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Level</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>120</x>
<y>230</y>
<width>151</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>For advanced users ONLY</string>
</property>
<widget class="QCheckBox" name="manualLevelCheckBox">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Manual Level</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
......@@ -10,7 +10,9 @@
#include "FailSafeConfig.h"
#include "AdvancedParamConfig.h"
#include "ArduCopterPidConfig.h"
#include "ArduPlanePidConfig.h"
#include "ArduRoverPidConfig.h"
#include "AdvParameterList.h"
#include "UASInterface.h"
#include "UASManager.h"
......@@ -32,7 +34,10 @@ private:
GeoFenceConfig *geoFenceConfig;
FailSafeConfig *failSafeConfig;
AdvancedParamConfig *advancedParamConfig;
ArduCopterPidConfig *arduCoperPidConfig;
ArduCopterPidConfig *arduCopterPidConfig;
ArduPlanePidConfig *arduPlanePidConfig;
ArduRoverPidConfig *arduRoverPidConfig;
AdvParameterList *advParameterList;
QMap<QObject*,QWidget*> buttonToConfigWidgetMap;
};
......
This diff is collapsed.
#include "ArduCopterPidConfig.h"
#include "ui_ArduCopterPidConfig.h"
ArduCopterPidConfig::ArduCopterPidConfig(QWidget *parent) :
QWidget(parent),
ui(new Ui::ArduCopterPidConfig)
ArduCopterPidConfig::ArduCopterPidConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui->setupUi(this);
ui.setupUi(this);
nameToBoxMap["STB_RLL_P"] = ui.stabilPitchPSpinBox;
nameToBoxMap["STB_PIT_P"] = ui.stabilRollPSpinBox;
nameToBoxMap["STB_YAW_P"] = ui.stabilYawPSpinBox;
nameToBoxMap["HLD_LAT_P"] = ui.loiterPidPSpinBox;
nameToBoxMap["RATE_RLL_P"] = ui.rateRollPSpinBox;
nameToBoxMap["RATE_RLL_I"] = ui.rateRollISpinBox;
nameToBoxMap["RATE_RLL_D"] = ui.rateRollDSpinBox;
nameToBoxMap["RATE_RLL_IMAX"] = ui.rateRollIMAXSpinBox;
nameToBoxMap["RATE_PIT_P"] = ui.ratePitchPSpinBox;
nameToBoxMap["RATE_PIT_I"] = ui.ratePitchISpinBox;
nameToBoxMap["RATE_PIT_D"] = ui.ratePitchDSpinBox;
nameToBoxMap["RATE_PIT_IMAX"] = ui.ratePitchIMAXSpinBox;
nameToBoxMap["RATE_YAW_P"] = ui.rateYawPSpinBox;
nameToBoxMap["RATE_YAW_I"] = ui.rateYawISpinBox;
nameToBoxMap["RATE_YAW_D"] = ui.rateYawDSpinBox;
nameToBoxMap["RATE_YAW_IMAX"] = ui.rateYawIMAXSpinBox;
nameToBoxMap["LOITER_LAT_P"] = ui.rateLoiterPSpinBox;
nameToBoxMap["LOITER_LAT_I"] = ui.rateLoiterISpinBox;
nameToBoxMap["LOITER_LAT_D"] = ui.rateLoiterDSpinBox;
nameToBoxMap["LOITER_LAT_IMAX"] = ui.rateLoiterIMAXSpinBox;
nameToBoxMap["THR_ACCEL_P"] = ui.throttleAccelPSpinBox;
nameToBoxMap["THR_ACCEL_I"] = ui.throttleAccelISpinBox;
nameToBoxMap["THR_ACCEL_D"] = ui.throttleAccelDSpinBox;
nameToBoxMap["THR_ACCEL_IMAX"] = ui.throttleAccelIMAXSpinBox;
nameToBoxMap["THR_RATE_P"] = ui.throttleRatePSpinBox;
nameToBoxMap["THR_RATE_D"] = ui.throttleDateDSpinBox;
nameToBoxMap["THR_ALT_P"] = ui.altitudeHoldPSpinBox;
nameToBoxMap["WPNAV_SPEED"] = ui.wpNavLoiterSpeedSpinBox;
nameToBoxMap["WPNAV_RADIUS"] = ui.wpNavRadiusSpinBox;
nameToBoxMap["WPNAV_SPEED_DN"] = ui.wpNavSpeedDownSpinBox;
nameToBoxMap["WPNAV_LOIT_SPEED"] = ui.wpNavSpeedSpinBox;
nameToBoxMap["WPNAV_SPEED_UP"] = ui.wpNavSpeedUpSpinBox;
nameToBoxMap["TUNE_HIGH"] = ui.ch6MaxSpinBox;
nameToBoxMap["TUNE_LOW"] = ui.ch6MinSpinBox;
connect(ui.writePushButton,SIGNAL(clicked()),this,SLOT(writeButtonClicked()));
connect(ui.refreshPushButton,SIGNAL(clicked()),this,SLOT(refreshButtonClicked()));
ch6ValueToTextList.append(QPair<int,QString>(0,"CH6_NONE"));
ch6ValueToTextList.append(QPair<int,QString>(1,"CH6_STABILIZE_KP"));
ch6ValueToTextList.append(QPair<int,QString>(2,"CH6_STABILIZE_KI"));
ch6ValueToTextList.append(QPair<int,QString>(3,"CH6_YAW_KP"));
ch6ValueToTextList.append(QPair<int,QString>(24,"CH6_YAW_KI"));
ch6ValueToTextList.append(QPair<int,QString>(4,"CH6_RATE_KP"));
ch6ValueToTextList.append(QPair<int,QString>(5,"CH6_RATE_KI"));
ch6ValueToTextList.append(QPair<int,QString>(6,"CH6_YAW_RATE_KP"));
ch6ValueToTextList.append(QPair<int,QString>(26,"CH6_YAW_RATE_KD"));
ch6ValueToTextList.append(QPair<int,QString>(7,"CH6_THROTTLE_KP"));
ch6ValueToTextList.append(QPair<int,QString>(9,"CH6_RELAY"));
ch6ValueToTextList.append(QPair<int,QString>(10,"CH6_WP_SPEED"));
ch6ValueToTextList.append(QPair<int,QString>(12,"CH6_LOITER_KP"));
ch6ValueToTextList.append(QPair<int,QString>(13,"CH6_HELI_EXTERNAL_GYRO"));
ch6ValueToTextList.append(QPair<int,QString>(14,"CH6_THR_HOLD_KP"));
ch6ValueToTextList.append(QPair<int,QString>(17,"CH6_OPTFLOW_KP"));
ch6ValueToTextList.append(QPair<int,QString>(18,"CH6_OPTFLOW_KI"));
ch6ValueToTextList.append(QPair<int,QString>(19,"CH6_OPTFLOW_KD"));
ch6ValueToTextList.append(QPair<int,QString>(21,"CH6_RATE_KD"));
ch6ValueToTextList.append(QPair<int,QString>(22,"CH6_LOITER_RATE_KP"));
ch6ValueToTextList.append(QPair<int,QString>(23,"CH6_LOITER_RATE_KD"));
ch6ValueToTextList.append(QPair<int,QString>(25,"CH6_ACRO_KP"));
ch6ValueToTextList.append(QPair<int,QString>(27,"CH6_LOITER_KI"));
ch6ValueToTextList.append(QPair<int,QString>(28,"CH6_LOITER_RATE_KI"));
ch6ValueToTextList.append(QPair<int,QString>(29,"CH6_STABILIZE_KD"));
ch6ValueToTextList.append(QPair<int,QString>(30,"CH6_AHRS_YAW_KP"));
ch6ValueToTextList.append(QPair<int,QString>(31,"CH6_AHRS_KP"));
ch6ValueToTextList.append(QPair<int,QString>(32,"CH6_INAV_TC"));
ch6ValueToTextList.append(QPair<int,QString>(33,"CH6_THROTTLE_KI"));
ch6ValueToTextList.append(QPair<int,QString>(34,"CH6_THR_ACCEL_KP"));
ch6ValueToTextList.append(QPair<int,QString>(35,"CH6_THR_ACCEL_KI"));
ch6ValueToTextList.append(QPair<int,QString>(36,"CH6_THR_ACCEL_KD"));
ch6ValueToTextList.append(QPair<int,QString>(38,"CH6_DECLINATION"));
ch6ValueToTextList.append(QPair<int,QString>(39,"CH6_CIRCLE_RATE"));
for (int i=0;i<ch6ValueToTextList.size();i++)
{
ui.ch6OptComboBox->addItem(ch6ValueToTextList[i].second);
}
ch7ValueToTextList.append(QPair<int,QString>(0,"Do nothing"));
ch7ValueToTextList.append(QPair<int,QString>(2,"Flip"));
ch7ValueToTextList.append(QPair<int,QString>(3,"Simple mode"));
ch7ValueToTextList.append(QPair<int,QString>(4,"RTL"));
ch7ValueToTextList.append(QPair<int,QString>(5,"Save Trim"));
ch7ValueToTextList.append(QPair<int,QString>(7,"Save WP"));
ch7ValueToTextList.append(QPair<int,QString>(8,"Multi Mode"));
ch7ValueToTextList.append(QPair<int,QString>(9,"Camera Trigger"));
ch7ValueToTextList.append(QPair<int,QString>(10,"Sonar"));
ch7ValueToTextList.append(QPair<int,QString>(11,"Fence"));
ch7ValueToTextList.append(QPair<int,QString>(12,"ResetToArmedYaw"));
for (int i=0;i<ch7ValueToTextList.size();i++)
{
ui.ch7OptComboBox->addItem(ch7ValueToTextList[i].second);
}
ch8ValueToTextList.append(QPair<int,QString>(0,"Do nothing"));
ch8ValueToTextList.append(QPair<int,QString>(2,"Flip"));
ch8ValueToTextList.append(QPair<int,QString>(3,"Simple mode"));
ch8ValueToTextList.append(QPair<int,QString>(4,"RTL"));
ch8ValueToTextList.append(QPair<int,QString>(5,"Save Trim"));
ch8ValueToTextList.append(QPair<int,QString>(7,"Save WP"));
ch8ValueToTextList.append(QPair<int,QString>(8,"Multi Mode"));
ch8ValueToTextList.append(QPair<int,QString>(9,"Camera Trigger"));
ch8ValueToTextList.append(QPair<int,QString>(10,"Sonar"));
ch8ValueToTextList.append(QPair<int,QString>(11,"Fence"));
ch8ValueToTextList.append(QPair<int,QString>(12,"ResetToArmedYaw"));
for (int i=0;i<ch8ValueToTextList.size();i++)
{
ui.ch8OptComboBox->addItem(ch8ValueToTextList[i].second);
}
}
ArduCopterPidConfig::~ArduCopterPidConfig()
{
delete ui;
}
void ArduCopterPidConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (nameToBoxMap.contains(parameterName))
{
nameToBoxMap[parameterName]->setValue(value.toDouble());
}
else if (parameterName == "TUNE")
{
for (int i=0;i<ch6ValueToTextList.size();i++)
{
if (ch6ValueToTextList[i].first == value.toInt())
{
ui.ch6OptComboBox->setCurrentIndex(i);
}
}
}
else if (parameterName == "CH7_OPT")
{
for (int i=0;i<ch7ValueToTextList.size();i++)
{
if (ch7ValueToTextList[i].first == value.toInt())
{
ui.ch7OptComboBox->setCurrentIndex(i);
}
}
}
else if (parameterName == "CH8_OPT")
{
for (int i=0;i<ch8ValueToTextList.size();i++)
{
if (ch8ValueToTextList[i].first == value.toInt())
{
ui.ch8OptComboBox->setCurrentIndex(i);
}
}
}
}
void ArduCopterPidConfig::writeButtonClicked()
{
if (!m_uas)
{
return;
}
for (QMap<QString,QDoubleSpinBox*>::const_iterator i=nameToBoxMap.constBegin();i!=nameToBoxMap.constEnd();i++)
{
m_uas->getParamManager()->setParameter(1,i.key(),i.value()->value());
}
m_uas->getParamManager()->setParameter(1,"TUNE",ch8ValueToTextList[ui.ch6OptComboBox->currentIndex()].first);
m_uas->getParamManager()->setParameter(1,"CH7_OPT",ch7ValueToTextList[ui.ch7OptComboBox->currentIndex()].first);
m_uas->getParamManager()->setParameter(1,"CH8_OPT",ch8ValueToTextList[ui.ch8OptComboBox->currentIndex()].first);
}
void ArduCopterPidConfig::refreshButtonClicked()
{
if (!m_uas)
{
return;
}
for (QMap<QString,QDoubleSpinBox*>::const_iterator i=nameToBoxMap.constBegin();i!=nameToBoxMap.constEnd();i++)
{
m_uas->getParamManager()->requestParameterUpdate(1,i.key());
}
m_uas->getParamManager()->requestParameterUpdate(1,"TUNE");
m_uas->getParamManager()->requestParameterUpdate(1,"CH7_OPT");
m_uas->getParamManager()->requestParameterUpdate(1,"CH8_OPT");
}
......@@ -2,21 +2,27 @@
#define ARDUCOPTERPIDCONFIG_H
#include <QWidget>
#include "ui_ArduCopterPidConfig.h"
namespace Ui {
class ArduCopterPidConfig;
}
#include "AP2ConfigWidget.h"
class ArduCopterPidConfig : public QWidget
class ArduCopterPidConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit ArduCopterPidConfig(QWidget *parent = 0);
~ArduCopterPidConfig();
private slots:
void writeButtonClicked();
void refreshButtonClicked();
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
Ui::ArduCopterPidConfig *ui;
QList<QPair<int,QString> > ch6ValueToTextList;
QList<QPair<int,QString> > ch7ValueToTextList;
QList<QPair<int,QString> > ch8ValueToTextList;
QMap<QString,QDoubleSpinBox*> nameToBoxMap;
Ui::ArduCopterPidConfig ui;
};
#endif // ARDUCOPTERPIDCONFIG_H
This diff is collapsed.
#include "ArduPlanePidConfig.h"
ArduPlanePidConfig::ArduPlanePidConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
nameToBoxMap["RLL2SRV_P"] = ui.servoRollPSpinBox;
nameToBoxMap["RLL2SRV_I"] = ui.servoRollISpinBox;
nameToBoxMap["RLL2SRV_D"] = ui.servoRollDSpinBox;
nameToBoxMap["RLL2SRV_IMAX"] = ui.servoRollIMAXSpinBox;
nameToBoxMap["PTCH2SRV_P"] = ui.servoPitchPSpinBox;
nameToBoxMap["PTCH2SRV_I"] = ui.servoPitchISpinBox;
nameToBoxMap["PTCH2SRV_D"] = ui.servoPitchDSpinBox;
nameToBoxMap["PTCH2SRV_IMAX"] = ui.servoPitchIMAXSpinBox;
nameToBoxMap["YW2SRV_P"] = ui.servoYawPSpinBox;
nameToBoxMap["YW2SRV_I"] = ui.servoYawISpinBox;
nameToBoxMap["YW2SRV_D"] = ui.servoYawDSpinBox;
nameToBoxMap["YW2SRV_IMAX"] = ui.servoYawIMAXSpinBox;
nameToBoxMap["ALT2PTCH_P"] = ui.navAltPSpinBox;
nameToBoxMap["ALT2PTCH_I"] = ui.navAltISpinBox;
nameToBoxMap["ALT2PTCH_D"] = ui.navAltDSpinBox;
nameToBoxMap["ALT2PTCH_IMAX"] = ui.navAltIMAXSpinBox;
nameToBoxMap["ARSP2PTCH_P"] = ui.navASPSpinBox;
nameToBoxMap["ARSP2PTCH_I"] = ui.navASISpinBox;
nameToBoxMap["ARSP2PTCH_D"] = ui.navASDSpinBox;
nameToBoxMap["ARSP2PTCH_IMAX"] = ui.navASIMAXSpinBox;
nameToBoxMap["ENRGY2THR_P"] = ui.energyPSpinBox;
nameToBoxMap["ENRGY2THR_I"] = ui.energyISpinBox;
nameToBoxMap["ENRGY2THR_D"] = ui.energyDSpinBox;
nameToBoxMap["ENRGY2THR_IMAX"] = ui.energyIMAXSpinBox;
nameToBoxMap["KFF_PTCH2THR"] = ui.otherPitchCompSpinBox;
nameToBoxMap["KFF_PTCHCOMP"] = ui.otherPtTSpinBox;
nameToBoxMap["KFF_RDDRMIX"] = ui.otherRudderMixSpinBox;
nameToBoxMap["TRIM_THROTTLE"] = ui.throttleCruiseSpinBox;
nameToBoxMap["THR_FS_VALUE"] = ui.throttleFSSpinBox;
nameToBoxMap["THR_MAX"] = ui.throttleMaxSpinBox;
nameToBoxMap["THR_MIN"] = ui.throttleMinSpinBox;
nameToBoxMap["TRIM_ARSPD_CM"] = ui.airspeedCruiseSpinBox;
nameToBoxMap["ARSPD_FBW_MAX"] = ui.airspeedFBWMaxSpinBox;
nameToBoxMap["ARSPD_FBW_MIN"] = ui.airspeedFBWMinSpinBox;
nameToBoxMap["ARSPD_RATIO"] = ui.airspeedRatioSpinBox;
nameToBoxMap["NAVL1_DAMPING"] = ui.l1DampingSpinBox;
nameToBoxMap["NAVL1_PERIOD"] = ui.l1PeriodSpinBox;
nameToBoxMap["LIM_ROLL_CD"] = ui.navBankMaxSpinBox;
nameToBoxMap["LIM_PITCH_MAX"] = ui.navPitchMaxSpinBox;
nameToBoxMap["LIM_PITCH_MIN"] = ui.navPitchMinSpinBox;
connect(ui.writePushButton,SIGNAL(clicked()),this,SLOT(writeButtonClicked()));
connect(ui.refreshPushButton,SIGNAL(clicked()),this,SLOT(refreshButtonClicked()));
}
ArduPlanePidConfig::~ArduPlanePidConfig()
{
}
void ArduPlanePidConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (nameToBoxMap.contains(parameterName))
{
nameToBoxMap[parameterName]->setValue(value.toDouble());
}
}
void ArduPlanePidConfig::writeButtonClicked()
{
if (!m_uas)
{
return;
}
for (QMap<QString,QDoubleSpinBox*>::const_iterator i=nameToBoxMap.constBegin();i!=nameToBoxMap.constEnd();i++)
{
m_uas->getParamManager()->setParameter(1,i.key(),i.value()->value());
}
}
void ArduPlanePidConfig::refreshButtonClicked()
{
if (!m_uas)
{
return;
}
for (QMap<QString,QDoubleSpinBox*>::const_iterator i=nameToBoxMap.constBegin();i!=nameToBoxMap.constEnd();i++)
{
m_uas->getParamManager()->requestParameterUpdate(1,i.key());
}
}
#ifndef ARDUPLANEPIDCONFIG_H
#define ARDUPLANEPIDCONFIG_H
#include <QWidget>
#include "ui_ArduPlanePidConfig.h"
#include "AP2ConfigWidget.h"
class ArduPlanePidConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit ArduPlanePidConfig(QWidget *parent = 0);
~ArduPlanePidConfig();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void writeButtonClicked();
void refreshButtonClicked();
private:
QMap<QString,QDoubleSpinBox*> nameToBoxMap;
Ui::ArduPlanePidConfig ui;
};
#endif // ARDUPLANEPIDCONFIG_H
This diff is collapsed.
#include "ArduRoverPidConfig.h"
ArduRoverPidConfig::ArduRoverPidConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
nameToBoxMap["STEER2SRV_P"] = ui.steer2ServoPSpinBox;
nameToBoxMap["STEER2SRV_I"] = ui.steer2ServoISpinBox;
nameToBoxMap["STEER2SRV_D"] = ui.steer2ServoDSpinBox;
nameToBoxMap["STEER2SRV_IMAX"] = ui.steer2ServoIMAXSpinBox;
nameToBoxMap["XTRK_ANGLE_CD"] = ui.xtrackEntryAngleSpinBox;
nameToBoxMap["XTRK_GAIN_SC"] = ui.xtrackGainSpinBox;
nameToBoxMap["CRUISE_THROTTLE"] = ui.throttleCruiseSpinBox;
nameToBoxMap["THR_MIN"] = ui.throttleMinSpinBox;
nameToBoxMap["THR_MAX"] = ui.throttleMaxSpinBox;
nameToBoxMap["FS_THR_VALUE"] = ui.throttleFSSpinBox;
nameToBoxMap["HDNG2STEER_P"] = ui.heading2SteerPSpinBox;
nameToBoxMap["HDNG2STEER_I"] = ui.heading2SteerISpinBox;
nameToBoxMap["HDNG2STEER_D"] = ui.heading2SteerDSpinBox;
nameToBoxMap["HDNG2STEER_IMAX"] = ui.heading2SteerIMAXSpinBox;
nameToBoxMap["SPEED2THR_P"] = ui.speed2ThrottlePSpinBox;
nameToBoxMap["SPEED2THR_I"] = ui.speed2ThrottleISpinBox;
nameToBoxMap["SPEED2THR_D"] = ui.speed2ThrottleDSpinBox;
nameToBoxMap["SPEED2THR_IMAX"] = ui.speed2ThrottleIMAXSpinBox;
nameToBoxMap["CRUISE_SPEED"] = ui.roverCruiseSpinBox;
nameToBoxMap["SPEED_TURN_GAIN"] = ui.roverTurnSpeedSpinBox;
nameToBoxMap["SPEED_TURN_DIST"] = ui.roverTurnDistSpinBox;
nameToBoxMap["WP_RADIUS"] = ui.roverWPRadiusSpinBox;
nameToBoxMap["SONAR_TRIGGER_CM"] = ui.sonarTriggerSpinBox;
nameToBoxMap["SONAR_TURN_ANGLE"] = ui.sonarTurnAngleSpinBox;
nameToBoxMap["SONAR_TURN_TIME"] = ui.sonarTurnTimeSpinBox;
nameToBoxMap["SONAR_DEBOUNCE"] = ui.sonaeDebounceSpinBox;
connect(ui.writePushButton,SIGNAL(clicked()),this,SLOT(writeButtonClicked()));
connect(ui.refreshPushButton,SIGNAL(clicked()),this,SLOT(refreshButtonClicked()));
}
ArduRoverPidConfig::~ArduRoverPidConfig()
{
}
void ArduRoverPidConfig::writeButtonClicked()
{
if (!m_uas)
{
return;
}
for (QMap<QString,QDoubleSpinBox*>::const_iterator i=nameToBoxMap.constBegin();i!=nameToBoxMap.constEnd();i++)
{
m_uas->getParamManager()->setParameter(1,i.key(),i.value()->value());
}
}
void ArduRoverPidConfig::refreshButtonClicked()
{
if (!m_uas)
{
return;
}
for (QMap<QString,QDoubleSpinBox*>::const_iterator i=nameToBoxMap.constBegin();i!=nameToBoxMap.constEnd();i++)
{
m_uas->getParamManager()->requestParameterUpdate(1,i.key());
}
}
void ArduRoverPidConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (nameToBoxMap.contains(parameterName))
{
nameToBoxMap[parameterName]->setValue(value.toFloat());
}
}
#ifndef ARDUROVERPIDCONFIG_H
#define ARDUROVERPIDCONFIG_H
#include <QWidget>
#include "ui_ArduRoverPidConfig.h"
#include "AP2ConfigWidget.h"
class ArduRoverPidConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit ArduRoverPidConfig(QWidget *parent = 0);
~ArduRoverPidConfig();
private slots:
void writeButtonClicked();
void refreshButtonClicked();
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<QString,QDoubleSpinBox*> nameToBoxMap;
Ui::ArduRoverPidConfig ui;
};
#endif // ARDUROVERPIDCONFIG_H
This diff is collapsed.
......@@ -32,6 +32,16 @@ BatteryMonitorConfig::BatteryMonitorConfig(QWidget *parent) : AP2ConfigWidget(pa
}
void BatteryMonitorConfig::activeUASSet(UASInterface *uas)
{
if (!uas)
{
return;
}
connect(uas,SIGNAL(batteryChanged(UASInterface*,double,double,double,int)),this,SLOT(batteryChanged(UASInterface*,double,double,double,int)));
AP2ConfigWidget::activeUASSet(uas);
}
void BatteryMonitorConfig::calcDividerSet()
{
if (!m_uas)
......@@ -222,6 +232,14 @@ void BatteryMonitorConfig::apmVerCurrentIndexChanged(int index)
BatteryMonitorConfig::~BatteryMonitorConfig()
{
}
void BatteryMonitorConfig::batteryChanged(UASInterface* uas, double voltage, double current, double percent, int seconds)
{
ui.calcVoltsLineEdit->setText(QString::number(voltage,'f',2));
if (ui.measuredVoltsLineEdit->text() == "")
{
ui.measuredVoltsLineEdit->setText(ui.calcVoltsLineEdit->text());
}
}
void BatteryMonitorConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
......
......@@ -20,6 +20,8 @@ private slots:
void calcDividerSet();
void ampsPerVoltSet();
void batteryCapacitySet();
void activeUASSet(UASInterface *uas);
void batteryChanged(UASInterface* uas, double voltage, double current, double percent, int seconds);
private:
Ui::BatteryMonitorConfig ui;
};
......
......@@ -16,6 +16,33 @@ CompassConfig::CompassConfig(QWidget *parent) : QWidget(parent)
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
activeUASSet(UASManager::instance()->getActiveUAS());
ui.orientationComboBox->addItem("ROTATION_NONE");
ui.orientationComboBox->addItem("ROTATION_YAW_45");
ui.orientationComboBox->addItem("ROTATION_YAW_90");
ui.orientationComboBox->addItem("ROTATION_YAW_135");
ui.orientationComboBox->addItem("ROTATION_YAW_180");
ui.orientationComboBox->addItem("ROTATION_YAW_225");
ui.orientationComboBox->addItem("ROTATION_YAW_270");
ui.orientationComboBox->addItem("ROTATION_YAW_315");
ui.orientationComboBox->addItem("ROTATION_ROLL_180");
ui.orientationComboBox->addItem("ROTATION_ROLL_180_YAW_45");
ui.orientationComboBox->addItem("ROTATION_ROLL_180_YAW_90");
ui.orientationComboBox->addItem("ROTATION_ROLL_180_YAW_135");
ui.orientationComboBox->addItem("ROTATION_PITCH_180");
ui.orientationComboBox->addItem("ROTATION_ROLL_180_YAW_225");
ui.orientationComboBox->addItem("ROTATION_ROLL_180_YAW_270");
ui.orientationComboBox->addItem("ROTATION_ROLL_180_YAW_315");
ui.orientationComboBox->addItem("ROTATION_ROLL_90");
ui.orientationComboBox->addItem("ROTATION_ROLL_90_YAW_45");
ui.orientationComboBox->addItem("ROTATION_ROLL_90_YAW_90");
ui.orientationComboBox->addItem("ROTATION_ROLL_90_YAW_135");
ui.orientationComboBox->addItem("ROTATION_ROLL_270");
ui.orientationComboBox->addItem("ROTATION_ROLL_270_YAW_45");
ui.orientationComboBox->addItem("ROTATION_ROLL_270_YAW_90");
ui.orientationComboBox->addItem("ROTATION_ROLL_270_YAW_135");
ui.orientationComboBox->addItem("ROTATION_PITCH_90");
ui.orientationComboBox->addItem("ROTATION_PITCH_270");
ui.orientationComboBox->addItem("ROTATION_MAX");
}
CompassConfig::~CompassConfig()
{
......@@ -39,12 +66,14 @@ void CompassConfig::parameterChanged(int uas, int component, QString parameterNa
ui.enableCheckBox->setChecked(false);
ui.autoDecCheckBox->setEnabled(false);
ui.declinationLineEdit->setEnabled(false);
ui.orientationComboBox->setEnabled(false);
}
else
{
ui.enableCheckBox->setChecked(true);
ui.autoDecCheckBox->setEnabled(true);
ui.declinationLineEdit->setEnabled(true);
ui.orientationComboBox->setEnabled(true);
}
ui.enableCheckBox->setEnabled(true);
}
......@@ -63,6 +92,12 @@ void CompassConfig::parameterChanged(int uas, int component, QString parameterNa
{
ui.declinationLineEdit->setText(QString::number(value.toDouble()));
}
else if (parameterName == "COMPASS_ORIENT")
{
disconnect(ui.orientationComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(orientationComboChanged(int)));
ui.orientationComboBox->setCurrentIndex(value.toInt());
connect(ui.orientationComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(orientationComboChanged(int)));
}
}
void CompassConfig::enableClicked(bool enabled)
......@@ -104,5 +139,11 @@ void CompassConfig::autoDecClicked(bool enabled)
void CompassConfig::orientationComboChanged(int index)
{
//COMPASS_ORIENT
if (!m_uas)
{
return;
}
m_uas->getParamManager()->setParameter(1,"COMPASS_ORIENT",index);
}
......@@ -55,9 +55,9 @@
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>300</x>
<x>290</x>
<y>180</y>
<width>91</width>
<width>101</width>
<height>23</height>
</rect>
</property>
......@@ -70,7 +70,7 @@
<rect>
<x>390</x>
<y>180</y>
<width>91</width>
<width>101</width>
<height>23</height>
</rect>
</property>
......@@ -118,7 +118,7 @@
<rect>
<x>10</x>
<y>70</y>
<width>201</width>
<width>211</width>
<height>111</height>
</rect>
</property>
......
This diff is collapsed.
......@@ -3,15 +3,28 @@
#include <QWidget>
#include "ui_FailSafeConfig.h"
class FailSafeConfig : public QWidget
#include "AP2ConfigWidget.h"
class FailSafeConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit FailSafeConfig(QWidget *parent = 0);
~FailSafeConfig();
private slots:
void activeUASSet(UASInterface *uas);
void remoteControlChannelRawChanges(int chan,float value);
void hilActuatorsChanged(uint64_t time, float act1, float act2, float act3, float act4, float act5, float act6, float act7, float act8);
void armingChanged(bool armed);
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void batteryFailChecked(bool checked);
void fsLongClicked(bool checked);
void fsShortClicked(bool checked);
void gcsChecked(bool checked);
void throttleActionChecked(bool checked);
void throttleChecked(bool checked);
void throttlePwmChanged();
void throttleFailSafeChanged(int index);
private:
Ui::FailSafeConfig ui;
};
......
This diff is collapsed.
#include "ParamWidget.h"
ParamWidget::ParamWidget(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
ParamWidget::~ParamWidget()
{
}
void ParamWidget::setupInt(QString title,QString description,int value,int min,int max)
{
type = INT;
ui.titleLabel->setText("<h3>" + title + "</h3>");
ui.descriptionLabel->setText(description);
ui.valueComboBox->hide();
ui.valueSlider->show();
ui.intSpinBox->show();
ui.doubleSpinBox->hide();
m_min = min;
m_max = max;
}
void ParamWidget::setupDouble(QString title,QString description,double value,double min,double max)
{
type = DOUBLE;
ui.titleLabel->setText("<h3>" + title + "</h3>");
ui.descriptionLabel->setText(description);
ui.valueComboBox->hide();
ui.valueSlider->show();
ui.intSpinBox->hide();
ui.doubleSpinBox->show();
m_min = min;
m_max = max;
}
void ParamWidget::setupCombo(QString title,QString description,QList<QPair<int,QString> > list)
{
type = COMBO;
ui.titleLabel->setText("<h3>" + title + "</h3>");
ui.descriptionLabel->setText(description);
ui.valueComboBox->show();
ui.valueSlider->hide();
ui.intSpinBox->hide();
ui.doubleSpinBox->hide();
m_valueList = list;
ui.valueComboBox->clear();
for (int i=0;i<m_valueList.size();i++)
{
ui.valueComboBox->addItem(m_valueList[i].second);
}
}
void ParamWidget::setValue(double value)
{
if (type == INT)
{
ui.intSpinBox->setValue(value);
ui.valueSlider->setValue(((value + m_min) / (m_max + m_min)) * 100.0);
}
else if (type == DOUBLE)
{
ui.doubleSpinBox->setValue(value);
ui.valueSlider->setValue(((value + m_min) / (m_max + m_min)) * 100.0);
}
else if (type == COMBO)
{
for (int i=0;i<m_valueList.size();i++)
{
if ((int)value == m_valueList[i].first)
{
ui.valueComboBox->setCurrentIndex(i);
return;
}
}
}
}
#ifndef PARAMWIDGET_H
#define PARAMWIDGET_H
#include <QWidget>
#include "ui_ParamWidget.h"
class ParamWidget : public QWidget
{
Q_OBJECT
public:
explicit ParamWidget(QWidget *parent = 0);
~ParamWidget();
void setupInt(QString title,QString description,int value,int min,int max);
void setupDouble(QString title,QString description,double value,double min,double max);
void setupCombo(QString title,QString description,QList<QPair<int,QString> > list);
void setValue(double value);
private:
enum VIEWTYPE
{
INT,
DOUBLE,
COMBO
};
double m_min;
double m_max;
double m_dvalue;
int m_ivalue;
VIEWTYPE type;
QList<QPair<int,QString> > m_valueList;
Ui::ParamWidget ui;
};
#endif // PARAMWIDGET_H
This diff is collapsed.
......@@ -58,7 +58,7 @@
</rect>
</property>
<property name="text">
<string>CheckBox</string>
<string>Enable</string>
</property>
</widget>
<widget class="QComboBox" name="sonarTypeComboBox">
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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