1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

OP-1222 Renamed some files.

Fixed Wing wizard made only available on Revo
Moved motor for fixed wing to channel 3 since channel 3 got its own timer.
Fixed a crash in config plugin when selecting Fixed Wing.
Added code in outputcalibration in Fixed Wing setup to set min and max values as well as neutral for servos.
Added Controller type Nano.
This commit is contained in:
m_thread 2014-08-18 01:20:31 +02:00
parent 137a6e4308
commit 5354723928
16 changed files with 180 additions and 210 deletions

View File

@ -43,6 +43,33 @@
const QString ConfigFixedWingWidget::CHANNELBOXNAME = QString("fixedWingChannelBox");
ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_FixedWingConfigWidget()),
plane(NULL)
{
m_aircraft->setupUi(this);
plane = new QGraphicsSvgItem();
populateChannelComboBoxes();
QStringList fixedWingTypes;
fixedWingTypes << "Elevator aileron rudder" << "Elevon";
m_aircraft->fixedWingType->addItems(fixedWingTypes);
// Set default model to "Elevator aileron rudder"
m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Elevator aileron rudder"));
setupUI(m_aircraft->fixedWingType->currentText());
connect(m_aircraft->fixedWingType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupUI(QString)));
updateEnableControls();
}
ConfigFixedWingWidget::~ConfigFixedWingWidget()
{
delete m_aircraft;
}
QStringList ConfigFixedWingWidget::getChannelDescriptions()
{
// init a channel_numelem list of channel desc defaults
@ -80,31 +107,6 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
return channelDesc;
}
ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_FixedWingConfigWidget())
{
m_aircraft->setupUi(this);
populateChannelComboBoxes();
QStringList fixedWingTypes;
fixedWingTypes << "Elevator aileron rudder" << "Elevon";
m_aircraft->fixedWingType->addItems(fixedWingTypes);
// Set default model to "Elevator aileron rudder"
m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Elevator aileron rudder"));
//setupUI(m_aircraft->fixedWingType->currentText());
connect(m_aircraft->fixedWingType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupUI(QString)));
updateEnableControls();
}
ConfigFixedWingWidget::~ConfigFixedWingWidget()
{
delete m_aircraft;
}
void ConfigFixedWingWidget::setupUI(QString frameType)
{
Q_ASSERT(m_aircraft);
@ -633,15 +635,10 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType)
return error;
}
/**
WHAT DOES THIS DO???
*/
void ConfigFixedWingWidget::showEvent(QShowEvent *event)
{
Q_UNUSED(event)
// Thit fitInView method should only be called now, once the
// widget is shown, otherwise it cannot compute its values and
// the result is usually a ahrsbargraph that is way too small.
Q_ASSERT(plane);
m_aircraft->planeShape->fitInView(plane, Qt::KeepAspectRatio);
}
@ -651,6 +648,7 @@ void ConfigFixedWingWidget::showEvent(QShowEvent *event)
void ConfigFixedWingWidget::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event);
Q_ASSERT(plane);
m_aircraft->planeShape->fitInView(plane, Qt::KeepAspectRatio);
}

View File

@ -1,11 +1,11 @@
/**
******************************************************************************
*
* @file notyetimplementedpage.cpp
* @file airframestabfixedwingpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup NotYetImplementedPage
* @addtogroup AirframeStabFixedwingPage
* @{
* @brief
*****************************************************************************/
@ -25,18 +25,18 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airframestabfixedwing.h"
#include "ui_airframestabfixedwing.h"
#include "airframestabfixedwingpage.h"
#include "ui_airframestabfixedwingpage.h"
AirframeStabFixedwing::AirframeStabFixedwing(SetupWizard *wizard, QWidget *parent) :
AirframeStabFixedwingPage::AirframeStabFixedwingPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::AirframeStabFixedwing)
ui(new Ui::AirframeStabFixedwingPage)
{
ui->setupUi(this);
setFinalPage(true);
}
AirframeStabFixedwing::~AirframeStabFixedwing()
AirframeStabFixedwingPage::~AirframeStabFixedwingPage()
{
delete ui;
}

View File

@ -1,11 +1,11 @@
/**
******************************************************************************
*
* @file notyetimplementedpage.h
* @file airframestabfixedwingpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup NotYetImplementedPage
* @addtogroup AirframeStabFixedwingPage
* @{
* @brief
*****************************************************************************/
@ -25,24 +25,24 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRFRAMESTABFIXEDWING_H
#define AIRFRAMESTABFIXEDWING_H
#ifndef AIRFRAMESTABFIXEDWINGPAGE_H
#define AIRFRAMESTABFIXEDWINGPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class AirframeStabFixedwing;
class AirframeStabFixedwingPage;
}
class AirframeStabFixedwing : public AbstractWizardPage {
class AirframeStabFixedwingPage : public AbstractWizardPage {
Q_OBJECT
public:
explicit AirframeStabFixedwing(SetupWizard *wizard, QWidget *parent = 0);
~AirframeStabFixedwing();
explicit AirframeStabFixedwingPage(SetupWizard *wizard, QWidget *parent = 0);
~AirframeStabFixedwingPage();
private:
Ui::AirframeStabFixedwing *ui;
Ui::AirframeStabFixedwingPage *ui;
};
#endif // AIRFRAMESTABFIXEDWING_H
#endif // AIRFRAMESTABFIXEDWINGPAGE_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AirframeStabFixedwing</class>
<widget class="QWizardPage" name="AirframeStabFixedwing">
<class>AirframeStabFixedwingPage</class>
<widget class="QWizardPage" name="AirframeStabFixedwingPage">
<property name="geometry">
<rect>
<x>0</x>
@ -17,9 +17,9 @@
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<y>130</y>
<width>551</width>
<height>51</height>
<height>191</height>
</rect>
</property>
<property name="text">

View File

@ -64,6 +64,33 @@ void OutputCalibrationPage::loadSVGFile(QString file)
}
}
void OutputCalibrationPage::setupActuatorMinMaxAndNeutral(int motorChannelStart, int motorChannelEnd, int totalUsedChannels)
{
// 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!!
for (int servoid = 0; servoid < 12; servoid++) {
if (servoid >= motorChannelStart && servoid <= motorChannelEnd) {
// Set to motor safe values
m_actuatorSettings[servoid].channelMin = 1000;
m_actuatorSettings[servoid].channelNeutral = 1000;
m_actuatorSettings[servoid].channelMax = 2000;
} else if (servoid < totalUsedChannels) {
// Set to servo safe values
m_actuatorSettings[servoid].channelMin = 1500;
m_actuatorSettings[servoid].channelNeutral = 1500;
m_actuatorSettings[servoid].channelMax = 1500;
} else {
// "Disable" these channels
m_actuatorSettings[servoid].channelMin = 1000;
m_actuatorSettings[servoid].channelNeutral = 1000;
m_actuatorSettings[servoid].channelMax = 1000;
}
}
}
void OutputCalibrationPage::setupVehicle()
{
m_actuatorSettings = getWizard()->getActuatorSettings();
@ -93,13 +120,8 @@ void OutputCalibrationPage::setupVehicle()
// 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;
setupActuatorMinMaxAndNeutral(0, 1, 3);
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::MULTI_ROTOR_QUAD_X:
@ -108,6 +130,7 @@ void OutputCalibrationPage::setupVehicle()
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;
setupActuatorMinMaxAndNeutral(0, 3, 4);
break;
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
loadSVGFile(MULTI_SVG_FILE);
@ -115,6 +138,7 @@ void OutputCalibrationPage::setupVehicle()
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;
setupActuatorMinMaxAndNeutral(0, 3, 4);
break;
case SetupWizard::MULTI_ROTOR_HEXA:
loadSVGFile(MULTI_SVG_FILE);
@ -122,6 +146,7 @@ void OutputCalibrationPage::setupVehicle()
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;
setupActuatorMinMaxAndNeutral(0, 5, 6);
break;
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
loadSVGFile(MULTI_SVG_FILE);
@ -129,6 +154,7 @@ void OutputCalibrationPage::setupVehicle()
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;
setupActuatorMinMaxAndNeutral(0, 5, 6);
break;
case SetupWizard::MULTI_ROTOR_HEXA_H:
loadSVGFile(MULTI_SVG_FILE);
@ -136,92 +162,35 @@ void OutputCalibrationPage::setupVehicle()
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;
setupActuatorMinMaxAndNeutral(0, 5, 6);
break;
case SetupWizard::MULTI_ROTOR_HEXA_X:
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa-x" << "hexa-x-frame" << "hexa-x-m1" << "hexa-x-m2" << "hexa-x-m3" << "hexa-x-m4" << "hexa-x-m5" << "hexa-x-m6";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
setupActuatorMinMaxAndNeutral(0, 5, 6);
break;
// Fixed Wing
case SetupWizard::FIXED_WING_AILERON:
loadSVGFile(FIXEDWING_SVG_FILE);
m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2; //2 for servoCenterSlider!
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 << 3 << 4 << 5;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4 << 5 << 5 << 5;
m_channelIndex << 0 << 3 << 0 << 0 << 0 << 1 << 1 << 1 << 2 << 2 << 2 << 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
// make sure Aileron servo one does not go to an extreme value
// would also be nice to make these all default to 50hz so we don't shred servos.
m_actuatorSettings[1].channelNeutral = 1500;
// make sure Aileron servo two does not go to an extreme value
m_actuatorSettings[2].channelNeutral = 1500;
// make sure Elevator servo one does not go to an extreme value
m_actuatorSettings[3].channelNeutral = 1500;
// make sure Rudder servo one does not go to an extreme value
m_actuatorSettings[4].channelNeutral = 1500;
m_actuatorSettings[4].channelNeutral = 1500;
m_actuatorSettings[5].channelNeutral = 1500;
m_actuatorSettings[6].channelNeutral = 1500;
m_actuatorSettings[7].channelNeutral = 1500;
// Arduino library defaults to 554 http://arduino.cc/en/Reference/ServoAttach,
// 600 is for HS85mg - http://www.servocity.com/html/hs-85mg__mighty_micro.html#.U4JEWhapKBU
// Same rules as above from the Arduino *generic* library and the servo city info for the 85mg
m_actuatorSettings[1].channelMin = 554;
m_actuatorSettings[1].channelMax = 2400;
m_actuatorSettings[2].channelMin = 554;
m_actuatorSettings[2].channelMax = 2400;
m_actuatorSettings[3].channelMin = 554;
m_actuatorSettings[3].channelMax = 2400;
m_actuatorSettings[4].channelMin = 554;
m_actuatorSettings[4].channelMax = 2400;
m_actuatorSettings[5].channelMin = 554;
m_actuatorSettings[5].channelMax = 2400;
m_actuatorSettings[6].channelMin = 554;
m_actuatorSettings[6].channelMax = 2400;
m_actuatorSettings[7].channelMin = 554;
m_actuatorSettings[7].channelMax = 2400;
setupActuatorMinMaxAndNeutral(3, 3, 5);
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::FIXED_WING_ELEVON:
loadSVGFile(FIXEDWING_SVG_FILE);
m_wizardIndexes << 0 << 1 << 2 << 2; //2 for servoCenterSlider!
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4;
m_vehicleElementIds << "elevon" << "elevon-frame" << "elevon-motor" << "elevon-left" << "elevon-right";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3;
m_channelIndex << 0 << 0 << 1 << 2;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3;
m_channelIndex << 0 << 3 << 0 << 0 << 0 << 1 << 1 << 1;
// make sure elevon servo one does not go to an extreme value
m_actuatorSettings[1].channelNeutral = 1500;
// make sure elevon servo two does not go to an extreme value
m_actuatorSettings[2].channelNeutral = 1500;
m_actuatorSettings[3].channelNeutral = 1500;
m_actuatorSettings[4].channelNeutral = 1500;
m_actuatorSettings[5].channelNeutral = 1500;
m_actuatorSettings[6].channelNeutral = 1500;
m_actuatorSettings[7].channelNeutral = 1500;
// Arduino library defaults to 554 http://arduino.cc/en/Reference/ServoAttach,
// 600 is for HS85mg - http://www.servocity.com/html/hs-85mg__mighty_micro.html#.U4JEWhapKBU
// Same rules as above from the Arduino *generic* library and the servo city info for the 85mg
m_actuatorSettings[1].channelMin = 554;
m_actuatorSettings[1].channelMax = 2400;
m_actuatorSettings[2].channelMin = 554;
m_actuatorSettings[2].channelMax = 2400;
m_actuatorSettings[3].channelMin = 554;
m_actuatorSettings[3].channelMax = 2400;
m_actuatorSettings[4].channelMin = 554;
m_actuatorSettings[4].channelMax = 2400;
m_actuatorSettings[5].channelMin = 554;
m_actuatorSettings[5].channelMax = 2400;
m_actuatorSettings[6].channelMin = 554;
m_actuatorSettings[6].channelMax = 2400;
m_actuatorSettings[7].channelMin = 554;
m_actuatorSettings[7].channelMax = 2400;
setupActuatorMinMaxAndNeutral(3, 3, 3);
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
@ -298,7 +267,7 @@ void OutputCalibrationPage::setWizardPage()
ui->calibrationStack->setCurrentIndex(currentPageIndex);
int currentChannel = getCurrentChannel();
qDebug() << "Current channel: " << currentChannel+1;
qDebug() << "Current channel: " << currentChannel + 1;
if (currentChannel >= 0) {
if (currentPageIndex == 1) {
ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);
@ -381,7 +350,8 @@ void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked)
{
ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start"));
quint16 channel = getCurrentChannel();
onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, 1000, ui->motorNeutralSlider);
quint16 safeValue = m_actuatorSettings[channel].channelNeutral;
onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider);
}
void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, quint16 channel, quint16 value, quint16 safeValue, QSlider *slider)

View File

@ -53,6 +53,7 @@ public:
}
void loadSVGFile(QString file);
void setupActuatorMinMaxAndNeutral(int motorChannelStart, int motorChannelEnd, int totalUsedChannels);
protected:
void showEvent(QShowEvent *event);
void resizeEvent(QResizeEvent *event);

View File

@ -34,7 +34,7 @@
<item row="1" column="0">
<widget class="QStackedWidget" name="calibrationStack">
<property name="currentIndex">
<number>1</number>
<number>4</number>
</property>
<widget class="QWidget" name="intro">
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -72,7 +72,7 @@ p, li { white-space: pre-wrap; }
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;In this step we will set the neutral rate for the motor highlighted in the illustration to the right. &lt;br/&gt;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. &lt;/p&gt;&lt;p&gt;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. &lt;br/&gt;&lt;br/&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;In this step we will set the neutral rate for the motor highlighted in the illustration to the right. &lt;br/&gt;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. &lt;/p&gt;&lt;p&gt;To find &lt;span style=&quot; font-weight:600;&quot;&gt;the neutral rate for this engine&lt;/span&gt;, press the Start button below and slide the slider to the right until the engine just starts to spin stable. &lt;br/&gt;&lt;br/&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -91,13 +91,13 @@ p, li { white-space: pre-wrap; }
<number>1000</number>
</property>
<property name="maximum">
<number>1300</number>
<number>1500</number>
</property>
<property name="singleStep">
<number>10</number>
<number>1</number>
</property>
<property name="pageStep">
<number>20</number>
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -133,7 +133,7 @@ p, li { white-space: pre-wrap; }
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This step calibrates the center position of the servo. To set the center position for this servo, press the Start button below and slide the slider to center the servo. &lt;/p&gt;&lt;p&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This step calibrates&lt;span style=&quot; font-weight:600;&quot;&gt; the center position of the servo&lt;/span&gt;. To set the center position for this servo, press the Start button below and slide the slider to center the servo. &lt;/p&gt;&lt;p&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -149,16 +149,16 @@ p, li { white-space: pre-wrap; }
<bool>false</bool>
</property>
<property name="minimum">
<number>1000</number>
<number>600</number>
</property>
<property name="maximum">
<number>2000</number>
<number>2400</number>
</property>
<property name="singleStep">
<number>10</number>
<number>1</number>
</property>
<property name="pageStep">
<number>20</number>
<number>10</number>
</property>
<property name="value">
<number>1500</number>
@ -198,12 +198,12 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="servoMinMax">
<widget class="QWidget" name="servoMin">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To save the servo and other hardware from damage we have to set the max and min angles for the servo. &lt;/p&gt;&lt;p&gt;To set the minimum angle for the servo, press the Start button below and select the top slider and slide it to the left until min angle is reached.&lt;/p&gt;&lt;p&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To save the servo and other hardware from damage we have to set the max and min angles for the servo. &lt;/p&gt;&lt;p&gt;To set &lt;span style=&quot; font-weight:600;&quot;&gt;the minimum angle for the servo&lt;/span&gt;, press the Start button below and select the top slider and slide it to the left until min angle is reached.&lt;/p&gt;&lt;p&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -219,16 +219,16 @@ p, li { white-space: pre-wrap; }
<bool>false</bool>
</property>
<property name="minimum">
<number>1000</number>
<number>600</number>
</property>
<property name="maximum">
<number>1500</number>
<number>2400</number>
</property>
<property name="singleStep">
<number>10</number>
<number>1</number>
</property>
<property name="pageStep">
<number>20</number>
<number>10</number>
</property>
<property name="value">
<number>1500</number>
@ -268,12 +268,12 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="page">
<widget class="QWidget" name="servoMax">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To set the maximum angle for the servo, press the Start button below and select the top slider and slide it to the right until max angle is reached.&lt;/p&gt;&lt;p&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To set &lt;span style=&quot; font-weight:600;&quot;&gt;the maximum angle for the servo&lt;/span&gt;, press the Start button below and select the top slider and slide it to the right until max angle is reached.&lt;/p&gt;&lt;p&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -289,16 +289,16 @@ p, li { white-space: pre-wrap; }
<bool>false</bool>
</property>
<property name="minimum">
<number>1500</number>
<number>600</number>
</property>
<property name="maximum">
<number>2000</number>
<number>2400</number>
</property>
<property name="singleStep">
<number>10</number>
<number>1</number>
</property>
<property name="pageStep">
<number>20</number>
<number>10</number>
</property>
<property name="value">
<number>1500</number>

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file outputpage.cpp
* @file outputfixedwingpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
@ -25,24 +25,23 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "outputpagefixedwing.h"
#include "ui_outputpagefixedwing.h"
#include "outputfixedwingpage.h"
#include "ui_outputfixedwingpage.h"
#include "setupwizard.h"
OutputPageFixedwing::OutputPageFixedwing(SetupWizard *wizard, QWidget *parent) :
OutputFixedwingPage::OutputFixedwingPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::OutputPageFixedwing)
ui(new Ui::OutputFixedwingPage)
{
ui->setupUi(this);
}
OutputPageFixedwing::~OutputPageFixedwing()
OutputFixedwingPage::~OutputFixedwingPage()
{
delete ui;
}
bool OutputPageFixedwing::validatePage()
bool OutputFixedwingPage::validatePage()
{
if (ui->ServoTypeButton->isChecked()) {
getWizard()->setActuatorType(SetupWizard::SERVO_DIGITAL);

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file outputpage.h
* @file outputfixedwingpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
@ -25,25 +25,25 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OUTPUTPAGEFIXEDWING_H
#define OUTPUTPAGEFIXEDWING_H
#ifndef OUTPUTFIXEDWINGPAGE_H
#define OUTPUTFIXEDWINGPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class OutputPageFixedwing;
class OutputFixedwingPage;
}
class OutputPageFixedwing : public AbstractWizardPage {
class OutputFixedwingPage : public AbstractWizardPage {
Q_OBJECT
public:
explicit OutputPageFixedwing(SetupWizard *wizard, QWidget *parent = 0);
~OutputPageFixedwing();
explicit OutputFixedwingPage(SetupWizard *wizard, QWidget *parent = 0);
~OutputFixedwingPage();
bool validatePage();
private:
Ui::OutputPageFixedwing *ui;
Ui::OutputFixedwingPage *ui;
};
#endif // OUTPUTPAGEFIXEDWING_H
#endif // OUTPUTFIXEDWINGPAGE_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OutputPageFixedwing</class>
<widget class="QWizardPage" name="OutputPageFixedwing">
<class>OutputFixedwingPage</class>
<widget class="QWizardPage" name="OutputFixedwingPage">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -55,3 +55,9 @@ bool VehiclePage::validatePage()
}
return true;
}
void VehiclePage::initializePage()
{
ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO ||
getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO);
}

View File

@ -41,6 +41,7 @@ public:
explicit VehiclePage(SetupWizard *wizard, QWidget *parent = 0);
~VehiclePage();
bool validatePage();
void initializePage();
private:
Ui::VehiclePage *ui;

View File

@ -36,7 +36,7 @@
#include "pages/surfacepage.h"
#include "pages/inputpage.h"
#include "pages/outputpage.h"
#include "pages/outputpagefixedwing.h"
#include "pages/outputfixedwingpage.h"
#include "pages/biascalibrationpage.h"
#include "pages/summarypage.h"
#include "pages/savepage.h"
@ -44,7 +44,7 @@
#include "pages/rebootpage.h"
#include "pages/outputcalibrationpage.h"
#include "pages/revocalibrationpage.h"
#include "pages/airframestabfixedwing.h"
#include "pages/airframestabfixedwingpage.h"
#include "extensionsystem/pluginmanager.h"
#include "vehicleconfigurationhelper.h"
#include "actuatorsettings.h"
@ -345,7 +345,7 @@ void SetupWizard::createPages()
setPage(PAGE_SURFACE, new SurfacePage(this));
setPage(PAGE_INPUT, new InputPage(this));
setPage(PAGE_OUTPUT, new OutputPage(this));
setPage(PAGE_OUTPUT_FIXEDWING, new OutputPageFixedwing(this));
setPage(PAGE_OUTPUT_FIXEDWING, new OutputFixedwingPage(this));
setPage(PAGE_BIAS_CALIBRATION, new BiasCalibrationPage(this));
// setPage(PAGE_REVO_CALIBRATION, new RevoCalibrationPage(this));
setPage(PAGE_OUTPUT_CALIBRATION, new OutputCalibrationPage(this));
@ -353,7 +353,7 @@ void SetupWizard::createPages()
setPage(PAGE_SAVE, new SavePage(this));
setPage(PAGE_REBOOT, new RebootPage(this));
setPage(PAGE_NOTYETIMPLEMENTED, new NotYetImplementedPage(this));
setPage(PAGE_AIRFRAMESTAB_FIXEDWING, new AirframeStabFixedwing(this));
setPage(PAGE_AIRFRAMESTAB_FIXEDWING, new AirframeStabFixedwingPage(this));
setPage(PAGE_END, new OPEndPage(this));
setStartId(PAGE_START);

View File

@ -23,7 +23,6 @@ HEADERS += setupwizardplugin.h \
pages/surfacepage.h \
pages/abstractwizardpage.h \
pages/outputpage.h \
pages/outputpagefixedwing.h \
pages/inputpage.h \
pages/summarypage.h \
vehicleconfigurationsource.h \
@ -37,7 +36,8 @@ HEADERS += setupwizardplugin.h \
pages/revocalibrationpage.h \
biascalibrationutil.h \
pages/biascalibrationpage.h \
pages/airframestabfixedwing.h
pages/outputfixedwingpage.h \
pages/airframestabfixedwingpage.h
SOURCES += setupwizardplugin.cpp \
setupwizard.cpp \
@ -52,7 +52,6 @@ SOURCES += setupwizardplugin.cpp \
pages/surfacepage.cpp \
pages/abstractwizardpage.cpp \
pages/outputpage.cpp \
pages/outputpagefixedwing.cpp \
pages/inputpage.cpp \
pages/summarypage.cpp \
vehicleconfigurationsource.cpp \
@ -66,7 +65,8 @@ SOURCES += setupwizardplugin.cpp \
pages/revocalibrationpage.cpp \
biascalibrationutil.cpp \
pages/biascalibrationpage.cpp \
pages/airframestabfixedwing.cpp
pages/outputfixedwingpage.cpp \
pages/airframestabfixedwingpage.cpp
OTHER_FILES += SetupWizard.pluginspec
@ -81,7 +81,6 @@ FORMS += \
pages/helipage.ui \
pages/surfacepage.ui \
pages/outputpage.ui \
pages/outputpagefixedwing.ui \
pages/inputpage.ui \
pages/summarypage.ui \
connectiondiagram.ui \
@ -91,7 +90,8 @@ FORMS += \
pages/autoupdatepage.ui \
pages/revocalibrationpage.ui \
pages/biascalibrationpage.ui \
pages/airframestabfixedwing.ui
pages/outputfixedwingpage.ui \
pages/airframestabfixedwingpage.ui
RESOURCES += \
wizardResources.qrc

View File

@ -231,7 +231,7 @@ void VehicleConfigurationHelper::applyVehicleConfiguration()
setupElevon();
break;
case VehicleConfigurationSource::FIXED_WING_VTAIL:
// setupVtail();
// TODO: Implement settings for VTail fixed wings
break;
default:
break;
@ -327,7 +327,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
ActuatorSettings::DataFields data = actSettings->getData();
QList<actuatorChannelSettings> actuatorSettings = m_configSource->getActuatorSettings();
for (quint16 i = 1; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++) {
for (quint16 i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++) {
data.ChannelType[i] = ActuatorSettings::CHANNELTYPE_PWM;
data.ChannelAddr[i] = i;
data.ChannelMin[i] = actuatorSettings[i].channelMin;
@ -335,10 +335,6 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
data.ChannelMax[i] = actuatorSettings[i].channelMax;
}
for (quint16 i = 0; i < ActuatorSettings::CHANNELUPDATEFREQ_NUMELEM; i++) {
data.ChannelUpdateFreq[i] = ANALOG_SERVO_FREQUENCE;
}
qint16 updateFrequence = ANALOG_SERVO_FREQUENCE;
switch (m_configSource->getActuatorType()) {
case VehicleConfigurationSource::SERVO_ANALOG:
@ -351,6 +347,19 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
break;
}
for (quint16 i = 0; i < ActuatorSettings::CHANNELUPDATEFREQ_NUMELEM; i++) {
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) {
if (i == 1) {
data.ChannelUpdateFreq[i] = ANALOG_SERVO_FREQUENCE;
}
} else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) {
if (i == 2) {
data.ChannelUpdateFreq[i] = ANALOG_SERVO_FREQUENCE;
}
}
data.ChannelUpdateFreq[i] = updateFrequence;
}
actSettings->setData(data);
addModifiedObject(actSettings, tr("Writing actuator settings"));
@ -1549,31 +1558,17 @@ void VehicleConfigurationHelper::setupElevon()
channels[1].type = MIXER_TYPE_SERVO;
channels[1].throttle1 = 0;
channels[1].throttle2 = 0;
channels[1].roll = -127;
channels[1].pitch = 127;
channels[1].roll = -100;
channels[1].pitch = 100;
channels[1].yaw = 0;
channels[2].type = MIXER_TYPE_SERVO;
channels[2].throttle1 = 0;
channels[2].throttle2 = 0;
channels[2].roll = 127;
channels[2].pitch = -127;
channels[2].roll = 100;
channels[2].pitch = -100;
channels[2].yaw = 0;
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 0;
channels[3].yaw = 0;
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 0;
channels[3].yaw = 0;
guiSettings.fixedwing.FixedWingThrottle = 1;
guiSettings.fixedwing.FixedWingRoll1 = 2;
guiSettings.fixedwing.FixedWingRoll2 = 3;
@ -1620,12 +1615,12 @@ void VehicleConfigurationHelper::setupAileron()
channels[3].pitch = 100;
channels[3].yaw = 0;
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 0;
channels[3].yaw = 100;
channels[4].type = MIXER_TYPE_SERVO;
channels[4].throttle1 = 0;
channels[4].throttle2 = 0;
channels[4].roll = 0;
channels[4].pitch = 0;
channels[4].yaw = 100;
guiSettings.fixedwing.FixedWingThrottle = 1;
guiSettings.fixedwing.FixedWingRoll1 = 2;

View File

@ -55,7 +55,7 @@ class VehicleConfigurationSource {
public:
VehicleConfigurationSource();
enum CONTROLLER_TYPE { CONTROLLER_UNKNOWN, CONTROLLER_CC, CONTROLLER_CC3D, CONTROLLER_REVO, CONTROLLER_OPLINK };
enum CONTROLLER_TYPE { CONTROLLER_UNKNOWN, CONTROLLER_CC, CONTROLLER_CC3D, CONTROLLER_REVO, CONTROLLER_NANO, CONTROLLER_OPLINK };
enum VEHICLE_TYPE { VEHICLE_UNKNOWN, VEHICLE_MULTI, VEHICLE_FIXEDWING, VEHICLE_HELI, VEHICLE_SURFACE };
enum VEHICLE_SUB_TYPE { MULTI_ROTOR_UNKNOWN, MULTI_ROTOR_TRI_Y, MULTI_ROTOR_QUAD_X, MULTI_ROTOR_QUAD_PLUS,
MULTI_ROTOR_HEXA, MULTI_ROTOR_HEXA_H, MULTI_ROTOR_HEXA_X, MULTI_ROTOR_HEXA_COAX_Y, MULTI_ROTOR_OCTO,