mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
OP-1222 Fixed svg files. Cleaned up and grouped items to work in wizard.
Removed some translations and simplified some gradients. Added support for output calibration of Aileron and v-tail wings. Added comments in the code explaining the various arrays with indexes and ids in the output configuration page class.
This commit is contained in:
parent
f8e6e8c183
commit
a99de5d326
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 95 KiB |
@ -106,7 +106,7 @@ void FixedWingPage::updateImageAndDescription()
|
||||
elementId = "aileron";
|
||||
break;
|
||||
case SetupWizard::FIXED_WING_VTAIL:
|
||||
elementId = "vtail";
|
||||
elementId = "v-tail";
|
||||
break;
|
||||
default:
|
||||
elementId = "";
|
||||
|
@ -30,6 +30,9 @@
|
||||
#include "systemalarms.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
const QString OutputCalibrationPage::MULTI_SVG_FILE = QString(":/setupwizard/resources/multirotor-shapes.svg");
|
||||
const QString OutputCalibrationPage::FIXEDWING_SVG_FILE = QString(":/setupwizard/resources/fixedwing-shapes.svg");
|
||||
|
||||
OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent), ui(new Ui::OutputCalibrationPage), m_vehicleBoundsItem(0),
|
||||
m_currentWizardIndex(-1), m_calibrationUtil(0)
|
||||
@ -54,6 +57,13 @@ OutputCalibrationPage::~OutputCalibrationPage()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OutputCalibrationPage::loadSVGFile(QString file)
|
||||
{
|
||||
if (QFile::exists(file) && m_vehicleRenderer->load(file) && m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputCalibrationPage::setupVehicle()
|
||||
{
|
||||
m_actuatorSettings = getWizard()->getActuatorSettings();
|
||||
@ -64,95 +74,78 @@ void OutputCalibrationPage::setupVehicle()
|
||||
m_currentWizardIndex = 0;
|
||||
m_vehicleScene->clear();
|
||||
|
||||
// KF moved code from OutputCalibrationPage() here so it can be used to detect the current vehicle
|
||||
// needs to be slimmed down and not repeated.
|
||||
|
||||
switch (getWizard()->getVehicleSubType()) {
|
||||
case SetupWizard::MULTI_ROTOR_TRI_Y:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
// Loads the SVG file resourse and sets the scene
|
||||
loadSVGFile(MULTI_SVG_FILE);
|
||||
|
||||
// The m_wizardIndexes array contains the index of the QStackedWidget
|
||||
// in the page to use for each step.
|
||||
m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4;
|
||||
|
||||
// All element ids to load from the svg file and manage.
|
||||
m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1";
|
||||
|
||||
// The index of the elementId to highlight ( not dim ) for each step
|
||||
// this is the index in the m_vehicleElementIds - 1.
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 4 << 4;
|
||||
|
||||
// The channel number to configure for each step.
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 3 << 3;
|
||||
|
||||
// Default values for the actuator settings, extra important for
|
||||
// servos since a value out of range can actually destroy the
|
||||
// vehicle if unlucky.
|
||||
// Motors are not that important. REMOVE propellers always!!
|
||||
m_actuatorSettings[3].channelMin = 1500;
|
||||
m_actuatorSettings[3].channelNeutral = 1500;
|
||||
m_actuatorSettings[3].channelMax = 1500;
|
||||
getWizard()->setActuatorSettings(m_actuatorSettings);
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_X:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
loadSVGFile(MULTI_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
|
||||
m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3;
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
loadSVGFile(MULTI_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
|
||||
m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3;
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
loadSVGFile(MULTI_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
|
||||
m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
loadSVGFile(MULTI_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
|
||||
m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5";
|
||||
m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5;
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_H:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
loadSVGFile(MULTI_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
|
||||
m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
|
||||
break;
|
||||
// KF hack
|
||||
case SetupWizard::FIXED_WING_AILERON:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
qDebug() << "no clue what a wizard index is!";
|
||||
m_wizardIndexes << 0 << 1 << 3 << 3 << 3 << 3; // These come from OutputCalibrationPage::setWizardPage()
|
||||
m_vehicleElementIds << "fixed-aileron" << "aileron";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1;
|
||||
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4;
|
||||
loadSVGFile(FIXEDWING_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4;
|
||||
m_vehicleElementIds << "aileron" << "aileron-frame" << "aileron-motor" << "aileron-ail-left" << "aileron-ail-right" << "aileron-rudder" << "aileron-elevator";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4 << 5 << 5 << 5;
|
||||
m_channelIndex << 0 << 0 << 1 << 1 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4;
|
||||
|
||||
// see Servo city for an example. 1500 usec is center on MS85mg for example. - http://www.servocity.com/html/hs-85mg__mighty_micro.html
|
||||
// see Servo city for an example. 1500 usec is center on MS85mg for example.
|
||||
// - http://www.servocity.com/html/hs-85mg__mighty_micro.html
|
||||
// make sure Aileron servo one does not go to an extreme value
|
||||
m_actuatorSettings[1].channelMin = 1500;
|
||||
m_actuatorSettings[1].channelNeutral = 1500;
|
||||
@ -173,16 +166,11 @@ void OutputCalibrationPage::setupVehicle()
|
||||
getWizard()->setActuatorSettings(m_actuatorSettings);
|
||||
break;
|
||||
case SetupWizard::FIXED_WING_VTAIL:
|
||||
if (QFile::exists(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
|
||||
m_vehicleRenderer->load(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
|
||||
m_vehicleRenderer->isValid()) {
|
||||
ui->vehicleView->setScene(m_vehicleScene);
|
||||
}
|
||||
qDebug() << "no clue what a wizard index is!";
|
||||
m_wizardIndexes << 0 << 1 << 3 << 3; // These come from OutputCalibrationPage::setWizardPage()
|
||||
m_vehicleElementIds << "fixed-vtail" << "vtail";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1;
|
||||
m_channelIndex << 0 << 0 << 1 << 2;
|
||||
loadSVGFile(FIXEDWING_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4;
|
||||
m_vehicleElementIds << "v-tail" << "v-tail-frame" << "v-tail-motor" << "v-tail-elevon-left" << "v-tail-elevon-right";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3;
|
||||
m_channelIndex << 0 << 0 << 1 << 1 << 1 << 2 << 2 << 2;
|
||||
|
||||
// make sure elevon servo one does not go to an extreme value
|
||||
m_actuatorSettings[1].channelMin = 1500;
|
||||
@ -282,7 +270,7 @@ void OutputCalibrationPage::setWizardPage()
|
||||
ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax);
|
||||
}
|
||||
}
|
||||
// setupVehicleHighlightedPart(); // turn this off for now, need to fix fixedwing image elements
|
||||
setupVehicleHighlightedPart();
|
||||
}
|
||||
|
||||
void OutputCalibrationPage::initializePage()
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
return m_currentWizardIndex >= m_wizardIndexes.size() - 1;
|
||||
}
|
||||
|
||||
void loadSVGFile(QString file);
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
@ -100,6 +101,9 @@ private:
|
||||
QList<actuatorChannelSettings> m_actuatorSettings;
|
||||
|
||||
OutputCalibrationUtil *m_calibrationUtil;
|
||||
|
||||
static const QString MULTI_SVG_FILE;
|
||||
static const QString FIXEDWING_SVG_FILE;
|
||||
};
|
||||
|
||||
#endif // OUTPUTCALIBRATIONPAGE_H
|
||||
|
@ -65,6 +65,12 @@ p, li { white-space: pre-wrap; }
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>In this step we will set the neutral rate for the motor highlighted in the illustration to the right. <br/>Please pay attention to the details and in particular the motors position and its rotation direction. Ensure the motors are spinning in the correct direction as shown in the diagram. Swap any 2 motor wires to change the direction of a motor. </p><p>To find the neutral rate for this engine, press the Start button below and slide the slider to the right until the engine just starts to spin stable. <br/><br/>When done press button again to stop.</p></body></html></string>
|
||||
</property>
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 168 KiB |
Loading…
Reference in New Issue
Block a user