diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp index 91faef46d..9ca7f5db4 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp @@ -31,31 +31,142 @@ #include "ui_connectiondiagram.h" ConnectionDiagram::ConnectionDiagram(QWidget *parent, VehicleConfigurationSource* configSource) : - QDialog(parent), m_configSource(configSource), - ui(new Ui::ConnectionDiagram) + QDialog(parent), ui(new Ui::ConnectionDiagram), m_configSource(configSource), m_background(0) { - setWindowTitle(tr("Connection Diagram")); ui->setupUi(this); - - QGraphicsScene *scene = new QGraphicsScene(this); - ui->connectionDiagram->setScene(scene); - ui->connectionDiagram->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); - m_renderer = new QSvgRenderer(); - if (m_renderer->load(QString(":/setupwizard/resources/connection-diagrams.svg")) && m_renderer->isValid()) - { - scene->clear(); - QGraphicsSvgItem* ccPic = new QGraphicsSvgItem(); - ccPic->setSharedRenderer(m_renderer); - ccPic->setElementId("cc"); - scene->addItem(ccPic); - qDebug() << "Scene complete"; - - //ui->connectionDiagram->setSceneRect(ccPic->boundingRect()); - //ui->connectionDiagram->fitInView(ccPic, Qt::KeepAspectRatio); - } + setWindowTitle(tr("Connection Diagram")); + setupGraphicsScene(); } ConnectionDiagram::~ConnectionDiagram() { delete ui; } + +void ConnectionDiagram::resizeEvent(QResizeEvent *event) +{ + QWidget::resizeEvent(event); + ui->connectionDiagram->fitInView(m_background, Qt::KeepAspectRatio); +} + +void ConnectionDiagram::showEvent(QShowEvent * event) +{ + QWidget::showEvent(event); + ui->connectionDiagram->fitInView(m_background, Qt::KeepAspectRatio); +} + +void ConnectionDiagram::setupGraphicsScene() +{ + QGraphicsScene *scene = new QGraphicsScene(this); + ui->connectionDiagram->setScene(scene); + ui->connectionDiagram->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + m_renderer = new QSvgRenderer(); + if (QFile::exists(QString(":/setupwizard/resources/connection-diagrams.svg")) && + m_renderer->load(QString(":/setupwizard/resources/connection-diagrams.svg")) && + m_renderer->isValid()) + { + scene->clear(); + m_background = new QGraphicsSvgItem(); + m_background->setSharedRenderer(m_renderer); + m_background->setElementId("background"); + m_background->setVisible(true); + m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape | QGraphicsItem::ItemClipsToShape); + scene->addItem(m_background); + + QList elementsToShow; + + switch(m_configSource->getControllerType()) + { + case VehicleConfigurationSource::CONTROLLER_CC: + case VehicleConfigurationSource::CONTROLLER_CC3D: + case VehicleConfigurationSource::CONTROLLER_REVO: + case VehicleConfigurationSource::CONTROLLER_PIPX: + default: + elementsToShow << "controller"; + break; + } + + switch (m_configSource->getVehicleType()) + { + case VehicleConfigurationSource::VEHICLE_MULTI: + switch (m_configSource->getVehicleSubType()) + { + case VehicleConfigurationSource::MULTI_ROTOR_TRI_Y: + elementsToShow << "tri"; + break; + case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X: + elementsToShow << "quad-x"; + break; + case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS: + elementsToShow << "quad-p"; + break; + case VehicleConfigurationSource::MULTI_ROTOR_HEXA: + elementsToShow << "hexa"; + break; + case VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y: + elementsToShow << "hexa-y"; + break; + case VehicleConfigurationSource::MULTI_ROTOR_HEXA_H: + elementsToShow << "hexa-h"; + break; + default: + break; + } + break; + case VehicleConfigurationSource::VEHICLE_FIXEDWING: + case VehicleConfigurationSource::VEHICLE_HELI: + case VehicleConfigurationSource::VEHICLE_SURFACE: + default: + break; + } + + switch (m_configSource->getInputType()) + { + case VehicleConfigurationSource::INPUT_PWM: + elementsToShow << "pwm" << "receiver" ; + break; + case VehicleConfigurationSource::INPUT_PPM: + elementsToShow << "receiver" << "ppm"; + break; + case VehicleConfigurationSource::INPUT_SBUS: + elementsToShow << "sbus"; + break; + case VehicleConfigurationSource::INPUT_DSM: + elementsToShow << "satellite"; + break; + default: + break; + } + + setupGraphicsSceneItems(scene, elementsToShow); + + ui->connectionDiagram->setSceneRect(m_background->boundingRect()); + ui->connectionDiagram->fitInView(m_background, Qt::KeepAspectRatio); + + qDebug() << "Scene complete"; + } +} + +void ConnectionDiagram::setupGraphicsSceneItems(QGraphicsScene *scene, QList elementsToShow) +{ + foreach(QString elementId, elementsToShow) { + if(m_renderer->elementExists(elementId)) { + QGraphicsSvgItem* element = new QGraphicsSvgItem(); + element->setSharedRenderer(m_renderer); + element->setElementId(elementId); + element->setVisible(true); + scene->addItem(element); + + QMatrix matrix = m_renderer->matrixForElement(elementId); + QRectF orig = matrix.mapRect(m_renderer->boundsOnElement(elementId)); + element->setPos(orig.x(),orig.y()); + qDebug() << "Adding " << elementId << " to scene at " << element->pos(); + } + else + { + qDebug() << "Element " << elementId << " not found in renderer!"; + } + } +} + + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.h b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.h index 546bd4f39..2063403a5 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.h @@ -53,8 +53,14 @@ private: VehicleConfigurationSource *m_configSource; QSvgRenderer *m_renderer; - QHash m_vehicleImageMap; - QHash m_receiverImageMap; + QGraphicsSvgItem* m_background; + + void setupGraphicsScene(); + void setupGraphicsSceneItems(QGraphicsScene *scene, QList elementsToShow); +protected: + void resizeEvent(QResizeEvent *event); + void showEvent(QShowEvent *event); + }; #endif // CONNECTIONDIAGRAM_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.ui b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.ui index 8c4e74b45..27221c4c7 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.ui @@ -31,6 +31,15 @@ Qt::ScrollBarAlwaysOff + + + + 255 + 255 + 255 + + + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.ui index 89f3d5e40..131d02540 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.ui @@ -52,6 +52,9 @@ p, li { white-space: pre-wrap; } 70 + + Write configuration to controller + QToolButton { border: none } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.ui index 8681fd49a..7446dbbc3 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.ui @@ -55,7 +55,7 @@ p, li { white-space: pre-wrap; } - Airplane, Sloper, Jet + Spectrum Satellite QToolButton { border: none } @@ -102,7 +102,7 @@ p, li { white-space: pre-wrap; } - Tricopter, Quadcopter, Hexacopter, Octocopter + PWM - One cable per channel QToolButton { border: none } @@ -152,7 +152,7 @@ p, li { white-space: pre-wrap; } - Airplane, Sloper, Jet + PPM - One cable for all channels QToolButton { border: none } @@ -199,7 +199,7 @@ p, li { white-space: pre-wrap; } - Airplane, Sloper, Jet + Futaba S-BUS QToolButton { border: none } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp index 10afada80..34ef253f5 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp @@ -69,6 +69,10 @@ void LevellingPage::performLevelling() return; } + getWizard()->button(QWizard::CancelButton)->setEnabled(false); + getWizard()->button(QWizard::BackButton)->setEnabled(false); + ui->levelButton->setEnabled(false); + if(!m_levellingUtil) { // Measure every 100ms * 100times = 10s @@ -79,9 +83,6 @@ void LevellingPage::performLevelling() connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long))); connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias))); connect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString))); - getWizard()->button(QWizard::CancelButton)->setEnabled(false); - getWizard()->button(QWizard::BackButton)->setEnabled(false); - ui->levelButton->setEnabled(false); m_levellingUtil->start(); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.ui index 17687d2c1..493dbea91 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.ui @@ -49,6 +49,9 @@ p, li { white-space: pre-wrap; } 70 + + Calculate gyro and accelerometer bias + QToolButton { border: none } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp index 37419eabb..6d10509b7 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp @@ -65,6 +65,7 @@ bool MultiPage::validatePage() { SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE) ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt(); getWizard()->setVehicleSubType(type); + return true; } void MultiPage::setupMultiTypesCombo() @@ -94,6 +95,8 @@ void MultiPage::setupMultiTypesCombo() ui->typeCombo->addItem(tr("Hexacopter H"), SetupWizard::MULTI_ROTOR_HEXA_H); m_descriptions << tr("Hexacopter H"); + // Fredrik Arvidsson(m_thread) 2012-08-26 Disable Octos until further notice + /* ui->typeCombo->addItem(tr("Octocopter"), SetupWizard::MULTI_ROTOR_OCTO); m_descriptions << tr("Octocopter"); @@ -105,15 +108,18 @@ void MultiPage::setupMultiTypesCombo() ui->typeCombo->addItem(tr("Octocopter V"), SetupWizard::MULTI_ROTOR_OCTO_V); m_descriptions << tr("Octocopter V"); + */ } void MultiPage::updateAvailableTypes() { + /* QVariant enable = (getWizard()->getInputType() == SetupWizard::INPUT_PWM) ? QVariant(0) : QVariant(1 | 32); ui->typeCombo->model()->setData(ui->typeCombo->model()->index(6, 0), enable, Qt::UserRole - 1); ui->typeCombo->model()->setData(ui->typeCombo->model()->index(7, 0), enable, Qt::UserRole - 1); ui->typeCombo->model()->setData(ui->typeCombo->model()->index(8, 0), enable, Qt::UserRole - 1); ui->typeCombo->model()->setData(ui->typeCombo->model()->index(9, 0), enable, Qt::UserRole - 1); + */ } void MultiPage::updateImageAndDescription() diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui index 8f15a2973..a369f1019 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui @@ -26,13 +26,12 @@ <!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:8.25pt; font-weight:400; font-style:normal;"> +</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 multirotor configuration</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;"></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;">This part of the wizard will set up the OpenPilot controller for use with a flying platform with multiple rotors. The wizard supports the most common types of multirotors. Other variants of multirotors can be configured by using custom configuration options in the configuration plugin in GCS.</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;"></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;">Please select the type of multirotor you want to create a configuration for below:</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:10pt;">(Depending on input configuration all types may not be available to select from the list.)</span></p></body></html> +<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;">Please select the type of multirotor you want to create a configuration for below:</span></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputpage.ui index 2773cbca9..45090f1e6 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputpage.ui @@ -55,7 +55,7 @@ p, li { white-space: pre-wrap; } - Airplane, Sloper, Jet + Turbo PWM ESC 400Hz QToolButton { border: none } @@ -65,8 +65,8 @@ p, li { white-space: pre-wrap; } - :/setupwizard/resources/bttn-turbo-down.png - :/setupwizard/resources/bttn-turbo-up.png:/setupwizard/resources/bttn-turbo-down.png + :/setupwizard/resources/bttn-turbo-up.png + :/setupwizard/resources/bttn-turbo-down.png:/setupwizard/resources/bttn-turbo-up.png @@ -105,7 +105,7 @@ p, li { white-space: pre-wrap; } - Tricopter, Quadcopter, Hexacopter, Octocopter + Standard ESC 50Hz QToolButton { border: none } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui index e6a293d90..75ab147d7 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui @@ -24,7 +24,7 @@ 20 20 - 550 + 581 350 @@ -32,15 +32,21 @@ <!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:8.25pt; font-weight:400; font-style:normal;"> +</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;">Welcome to the OpenPilot Setup 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:8pt;"></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;"><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;">This wizard will guide you through the basic steps of setting up your OpenPilot controller board. The following pages contains simple questions about your vehicle and its characteristics. </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:10pt;">From the information gathered the wizard will create a baseline configuration that should be good enough for you to get a quick start using your OpenPilot product.</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:10pt;">The baseline configuration can, if desired, be uploaded to the OpenPilot Controller board at the end of 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;"></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;">This wizard does not contain the full range of settings available in the GCS Config plugin. All configuration parameters can be changed at later by using the GCS Config plugin.</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;"></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="-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 align="center" 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; color:#ff0000;">REMOVE ALL PROPELLERS FROM THE VEHICHLE </span></p> +<p align="center" 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; color:#ff0000;">BEFORE PROCEEDING!</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;">Ignoring the above request will put you in a</span><span style=" font-size:10pt; font-weight:600; color:#ff0000;"> risk of serious injury</span><span style=" font-size:10pt;">!</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;">Ok, lets start the configuration by clicking on the 'Next'/'Continue' button below.</span></p></body></html> diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui index 11f646232..85b332d21 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui @@ -51,7 +51,7 @@ p, li { white-space: pre-wrap; } - Tricopter, Quadcopter, Hexacopter, Octocopter + Show connection diagram for configuration Hardware diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg index 5639b4c41..853902d13 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg @@ -13,8 +13,8 @@ id="svg4183" version="1.1" inkscape:version="0.48.2 r9819" - width="4065.2493" - height="1760.019" + width="1100" + height="550" xml:space="preserve" sodipodi:docname="connection-diagrams.svg">1234 - - -