From 9a9578a2a39c0602a93e51cfd7fc0e70afa8023d Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Tue, 16 Apr 2013 20:40:25 +0200 Subject: [PATCH] OP-816 Added page for Revolution calibration referring to the configuration plug-in until we get 'our ducks in a row' regarding the Revolution calibration procedure. --- .../setupwizard/pages/cccalibrationpage.ui | 2 +- .../setupwizard/pages/revocalibrationpage.cpp | 42 ++++++++++++++++ .../setupwizard/pages/revocalibrationpage.h | 49 +++++++++++++++++++ .../setupwizard/pages/revocalibrationpage.ui | 46 +++++++++++++++++ .../src/plugins/setupwizard/setupwizard.cpp | 19 ++++++- .../src/plugins/setupwizard/setupwizard.h | 15 +++--- .../src/plugins/setupwizard/setupwizard.pro | 9 ++-- 7 files changed, 169 insertions(+), 13 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.cpp create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.h create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.ui diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/cccalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/cccalibrationpage.ui index f2f8c7403..00757027f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/cccalibrationpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/cccalibrationpage.ui @@ -21,7 +21,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot controller sensor calibration procedure</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot CopterControl sensor calibration procedure</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The wizard needs to get information from the controller to determine in which position the vehicle is normally considered to be level. To be able to successfully perform these measurements, you need to place the vehicle on a surface that is as flat and level as possible. Examples of such surfaces could be a table top or the floor. Be careful to ensure that the vehicle really is level, since this step will affect the accelerometer and gyro bias in the controller software.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.cpp new file mode 100644 index 000000000..8050a200f --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.cpp @@ -0,0 +1,42 @@ +/** + ****************************************************************************** + * + * @file revocalibrationpage.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @addtogroup + * @{ + * @addtogroup RevoCalibrationPage + * @{ + * @brief + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "revocalibrationpage.h" +#include "ui_revocalibrationpage.h" + +RevoCalibrationPage::RevoCalibrationPage(SetupWizard *wizard, QWidget *parent) : + AbstractWizardPage(wizard, parent), + ui(new Ui::RevoCalibrationPage) +{ + ui->setupUi(this); + setFinalPage(true); +} + +RevoCalibrationPage::~RevoCalibrationPage() +{ + delete ui; +} diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.h new file mode 100644 index 000000000..9939d59ea --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.h @@ -0,0 +1,49 @@ +/** + ****************************************************************************** + * + * @file revocalibrationpage.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @addtogroup + * @{ + * @addtogroup RevoCalibrationPage + * @{ + * @brief + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef REVOCALIBRATIONPAGE_H +#define REVOCALIBRATIONPAGE_H + +#include "abstractwizardpage.h" + +namespace Ui { +class RevoCalibrationPage; +} + +class RevoCalibrationPage : public AbstractWizardPage +{ + Q_OBJECT + +public: + explicit RevoCalibrationPage(SetupWizard *wizard, QWidget *parent = 0); + ~RevoCalibrationPage(); + +private: + Ui::RevoCalibrationPage *ui; +}; + +#endif // REVOCALIBRATIONPAGE_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.ui new file mode 100644 index 000000000..c68a19a84 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/revocalibrationpage.ui @@ -0,0 +1,46 @@ + + + RevoCalibrationPage + + + + 0 + 0 + 600 + 400 + + + + WizardPage + + + + + 10 + 10 + 582 + 150 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot Revolution controller sensor calibration procedure</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The calibration procedure for the OpenPilot Revolution controller is not yet implemented in this setup wizard. To calibrate your OpenPilot Revolution controller please use the calibration utility found in the configuration plugin after you have finished this wizard.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Future versions of will have an easy to use calibration procedure implemented.</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index 9ccc6d8ac..d1d747dae 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -42,6 +42,7 @@ #include "pages/notyetimplementedpage.h" #include "pages/rebootpage.h" #include "pages/outputcalibrationpage.h" +#include "pages/revocalibrationpage.h" #include "extensionsystem/pluginmanager.h" #include "vehicleconfigurationhelper.h" #include "actuatorsettings.h" @@ -51,7 +52,7 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfigurationSource(), m_controllerType(CONTROLLER_UNKNOWN), m_vehicleType(VEHICLE_UNKNOWN), m_inputType(INPUT_UNKNOWN), m_escType(ESC_UNKNOWN), - m_levellingPerformed(false), m_restartNeeded(false), m_connectionManager(0) + m_calibrationPerformed(false), m_restartNeeded(false), m_connectionManager(0) { setWindowTitle(tr("OpenPilot Setup Wizard")); setOption(QWizard::IndependentPages, false); @@ -119,10 +120,23 @@ int SetupWizard::nextId() const return PAGE_SUMMARY; case PAGE_CC_CALIBRATION: return PAGE_OUTPUT_CALIBRATION; + case PAGE_REVO_CALIBRATION: + return PAGE_OUTPUT_CALIBRATION; case PAGE_OUTPUT_CALIBRATION: return PAGE_SAVE; case PAGE_SUMMARY: - return PAGE_CC_CALIBRATION; + { + switch(getControllerType()) + { + case CONTROLLER_CC: + case CONTROLLER_CC3D: + return PAGE_CC_CALIBRATION; + case CONTROLLER_REVO: + return PAGE_REVO_CALIBRATION; + default: + return PAGE_NOTYETIMPLEMENTED; + } + } case PAGE_SAVE: return PAGE_END; case PAGE_NOTYETIMPLEMENTED: @@ -276,6 +290,7 @@ void SetupWizard::createPages() setPage(PAGE_INPUT, new InputPage(this)); setPage(PAGE_OUTPUT, new OutputPage(this)); setPage(PAGE_CC_CALIBRATION, new CCCalibrationPage(this)); + setPage(PAGE_REVO_CALIBRATION, new RevoCalibrationPage(this)); setPage(PAGE_OUTPUT_CALIBRATION, new OutputCalibrationPage(this)); setPage(PAGE_SUMMARY, new SummaryPage(this)); setPage(PAGE_SAVE, new SavePage(this)); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h index 0f04d085f..262cc844b 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h @@ -64,9 +64,9 @@ public: void setRadioSetting(SetupWizard::RADIO_SETTING setting) { m_radioSetting = setting; } SetupWizard::RADIO_SETTING getRadioSetting() const {return m_radioSetting;} - void setLevellingBias(accelGyroBias bias) { m_levellingBias = bias; m_levellingPerformed = true; } - bool isCalibrationPerformed() const { return m_levellingPerformed; } - accelGyroBias getCalibrationBias() const { return m_levellingBias; } + void setLevellingBias(accelGyroBias bias) { m_calibrationBias = bias; m_calibrationPerformed = true; } + bool isCalibrationPerformed() const { return m_calibrationPerformed; } + accelGyroBias getCalibrationBias() const { return m_calibrationBias; } void setActuatorSettings(QList actuatorSettings) { m_actuatorSettings = actuatorSettings; } bool isMotorCalibrationPerformed() const { return m_motorCalibrationPerformed; } @@ -90,8 +90,9 @@ private slots: void pageChanged(int currId); private: enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING, - PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_CC_CALIBRATION, PAGE_OUTPUT_CALIBRATION, - PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE}; + PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_CC_CALIBRATION, + PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION, PAGE_SAVE, PAGE_SUMMARY, + PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE}; void createPages(); bool saveHardwareSettings() const; bool canAutoUpdate() const; @@ -105,8 +106,8 @@ private: GPS_SETTING m_gpsSetting; RADIO_SETTING m_radioSetting; - bool m_levellingPerformed; - accelGyroBias m_levellingBias; + bool m_calibrationPerformed; + accelGyroBias m_calibrationBias; bool m_motorCalibrationPerformed; QList m_actuatorSettings; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro index 215ab0143..5e250a5d5 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro @@ -34,7 +34,8 @@ HEADERS += setupwizardplugin.h \ pages/savepage.h \ pages/autoupdatepage.h \ pages/cccalibrationpage.h \ - cccalibrationutil.h + cccalibrationutil.h \ + pages/revocalibrationpage.h SOURCES += setupwizardplugin.cpp \ setupwizard.cpp \ @@ -60,7 +61,8 @@ SOURCES += setupwizardplugin.cpp \ pages/savepage.cpp \ pages/autoupdatepage.cpp \ pages/cccalibrationpage.cpp \ - cccalibrationutil.cpp + cccalibrationutil.cpp \ + pages/revocalibrationpage.cpp OTHER_FILES += SetupWizard.pluginspec @@ -82,7 +84,8 @@ FORMS += \ pages/rebootpage.ui \ pages/savepage.ui \ pages/autoupdatepage.ui \ - pages/cccalibrationpage.ui + pages/cccalibrationpage.ui \ + pages/revocalibrationpage.ui RESOURCES += \ wizardResources.qrc