Commit 75851a36 authored by Michael Carpenter's avatar Michael Carpenter

Implementation of ArduRover pid configuration screen

parent 9e10b726
......@@ -260,7 +260,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/configuration/ApmPlaneLevel.ui \
src/ui/configuration/ParamWidget.ui \
src/ui/configuration/ArduPlanePidConfig.ui \
src/ui/configuration/AdvParameterList.ui
src/ui/configuration/AdvParameterList.ui \
src/ui/configuration/ArduRoverPidConfig.ui
INCLUDEPATH += src \
src/ui \
src/ui/linechart \
......@@ -445,7 +446,8 @@ HEADERS += src/MG.h \
src/ui/configuration/ApmPlaneLevel.h \
src/ui/configuration/ParamWidget.h \
src/ui/configuration/ArduPlanePidConfig.h \
src/ui/configuration/AdvParameterList.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
......@@ -648,7 +650,8 @@ SOURCES += src/main.cc \
src/ui/configuration/ApmPlaneLevel.cc \
src/ui/configuration/ParamWidget.cc \
src/ui/configuration/ArduPlanePidConfig.cc \
src/ui/configuration/AdvParameterList.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
......
......@@ -16,6 +16,8 @@ ApmSoftwareConfig::ApmSoftwareConfig(QWidget *parent) : QWidget(parent)
ui.advancedParamButton->setVisible(false);
ui.advParamListButton->setVisible(false);
ui.arduCopterPidButton->setVisible(false);
ui.arduRoverPidButton->setVisible(false);
ui.arduPlanePidButton->setVisible(false);
/*basicPidConfig = new BasicPidConfig(this);
ui.stackedWidget->addWidget(basicPidConfig);
......@@ -57,12 +59,18 @@ ApmSoftwareConfig::ApmSoftwareConfig(QWidget *parent) : QWidget(parent)
buttonToConfigWidgetMap[ui.arduCopterPidButton] = arduCopterPidConfig;
connect(ui.arduCopterPidButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
arduPlanePidConfig = new ArduPlanePidConfig(this);
ui.stackedWidget->addWidget(arduPlanePidConfig);
buttonToConfigWidgetMap[ui.arduPlanePidButton] = arduPlanePidConfig;
connect(ui.arduPlanePidButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
arduRoverPidConfig = new ArduRoverPidConfig(this);
ui.stackedWidget->addWidget(arduRoverPidConfig);
buttonToConfigWidgetMap[ui.arduRoverPidButton] = arduRoverPidConfig;
connect(ui.arduRoverPidButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
......@@ -101,11 +109,19 @@ void ApmSoftwareConfig::activeUASSet(UASInterface *uas)
{
ui.arduPlanePidButton->setVisible(true);
ui.arduCopterPidButton->setVisible(false);
ui.arduRoverPidButton->setVisible(false);
}
else if (uas->getSystemType() == MAV_TYPE_QUADROTOR)
{
ui.arduCopterPidButton->setVisible(true);
ui.arduPlanePidButton->setVisible(false);
ui.arduRoverPidButton->setVisible(false);
}
else if (uas->getSystemType() == MAV_TYPE_GROUND_ROVER)
{
ui.arduRoverPidButton->setVisible(true);
ui.arduCopterPidButton->setVisible(false);
ui.arduPlanePidButton->setVisible(false);
}
......
......@@ -11,6 +11,7 @@
#include "AdvancedParamConfig.h"
#include "ArduCopterPidConfig.h"
#include "ArduPlanePidConfig.h"
#include "ArduRoverPidConfig.h"
#include "AdvParameterList.h"
#include "UASInterface.h"
#include "UASManager.h"
......@@ -35,6 +36,7 @@ private:
AdvancedParamConfig *advancedParamConfig;
ArduCopterPidConfig *arduCopterPidConfig;
ArduPlanePidConfig *arduPlanePidConfig;
ArduRoverPidConfig *arduRoverPidConfig;
AdvParameterList *advParameterList;
QMap<QObject*,QWidget*> buttonToConfigWidgetMap;
};
......
......@@ -200,6 +200,19 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="arduRoverPidButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>ArduRover Pids</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
#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;
}
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.
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