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

Merge remote-tracking branch 'origin/rel-14.10' into next

This commit is contained in:
Fredrik Larsson 2014-11-12 23:29:30 +11:00
commit d70d94aef4
23 changed files with 10438 additions and 165 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,19 +16,19 @@ Item {
property variant flightmodeColors : ["gray", "green", "green", "green", "green", "green", "green", "red",
"cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan"]
// Manual,Rate,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,RelayRate,RelayAttitude,
// Manual,Rate,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,
// AltitudeHold,AltitudeVario,CruiseControl + Auto mode (VTOL/Wing pathfollower)
// grey : 'disabled' modes
property variant thrustmodeColors : ["green", "grey", "grey", "grey", "grey", "grey", "grey", "grey", "grey", "grey",
property variant thrustmodeColors : ["green", "grey", "grey", "grey", "grey", "grey", "grey", "grey",
"green", "green", "green", "cyan"]
// SystemSettings.AirframeType 3 - 18 : VtolPathFollower, check ThrustControl
property var thrust_mode: FlightStatus.FlightMode < 7 ? StabilizationDesired.StabilizationMode_Thrust :
FlightStatus.FlightMode > 7 && SystemSettings.AirframeType > 2 && SystemSettings.AirframeType < 19
&& VtolPathFollowerSettings.ThrustControl == 1 ? 13 :
FlightStatus.FlightMode > 7 && SystemSettings.AirframeType < 3 ? 13: 0
&& VtolPathFollowerSettings.ThrustControl == 1 ? 11 :
FlightStatus.FlightMode > 7 && SystemSettings.AirframeType < 3 ? 11: 0
property real flight_time: Math.round(SystemStats.FlightTime / 1000)
@ -224,12 +224,12 @@ Item {
anchors.fill: parent
color: FlightStatus.FlightMode < 1 ? "grey" : warnings.thrustmodeColors[thrust_mode.toString()]
// Manual,Rate,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,RelayRate,RelayAttitude,
// Manual,Rate,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,
// AltitudeHold,AltitudeVario,CruiseControl
// grey : 'disabled' modes
Text {
anchors.centerIn: parent
text: ["MANUAL"," "," ", " ", " ", " ", " ", " ", " ", " ",
text: ["MANUAL"," "," ", " ", " ", " ", " ", " ",
"ALT HOLD", "ALT VARIO", "CRUISECTRL", "AUTO"][thrust_mode.toString()]
font {
family: "Arial"

View File

@ -2344,7 +2344,7 @@ p, li { white-space: pre-wrap; }
<message>
<location/>
<source>Go</source>
<translation type="unfinished">Y aller</translation>
<translation>Y aller</translation>
</message>
<message>
<location filename="../../../src/plugins/opmap/opmap_widget.ui"/>
@ -6180,9 +6180,8 @@ p, li { white-space: pre-wrap; }
<translation>Options de Configuration et Calibration</translation>
</message>
<message>
<location/>
<source>Start Configuration Wizard</source>
<translation>Démarrer l&apos;Assistant de Configuration</translation>
<translation type="vanished">Démarrer l&apos;Assistant de Configuration</translation>
</message>
<message>
<location/>
@ -6489,6 +6488,11 @@ Applique et Enregistre tous les paramètres sur la SD</translation>
<source>Settings Bank</source>
<translation>Banque Paramètres</translation>
</message>
<message>
<location/>
<source>Start Transmitter Setup Wizard</source>
<translation>Démarrer l&apos;Assistant Configuration Émetteur</translation>
</message>
</context>
<context>
<name>MixerCurve</name>
@ -6731,15 +6735,24 @@ Applique et Enregistre tous les paramètres sur la SD</translation>
<translation>Test en Temps Réel</translation>
</message>
<message>
<location/>
<source>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
</source>
<translation>Configurer ici &quot;TurboPWM&quot; : 500Hz est une valeur classique pour les multirotors.</translation>
<translation type="vanished">Configurer ici &quot;TurboPWM&quot; : 500Hz est une valeur classique pour les multirotors.</translation>
</message>
<message>
<source>500</source>
<translation type="vanished">500</translation>
</message>
<message>
<location/>
<source>500</source>
<translation>500</translation>
<source>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</source>
<translation>Configurer ici &quot;RapidESC&quot; : 490Hz est une valeur classique pour les multirotors.</translation>
</message>
<message>
<location/>
<source>490</source>
<translation></translation>
</message>
</context>
<context>
@ -11159,13 +11172,21 @@ Double clic sur la légende ou le tracé pour afficher/cacher la légende.</tran
</message>
<message>
<location line="+3"/>
<source>Standard ESC (50 Hz)</source>
<translation>Contrôleur Standard (50 Hz)</translation>
<source>Standard ESC (%1 Hz)</source>
<translation>Contrôleur Standard (%1 Hz)</translation>
</message>
<message>
<location line="+3"/>
<source>Rapid ESC (%1 Hz)</source>
<translation>Contrôleur Rapide (%1 Hz)</translation>
</message>
<message>
<source>Standard ESC (50 Hz)</source>
<translation type="vanished">Contrôleur Standard (50 Hz)</translation>
</message>
<message>
<source>Rapid ESC (500 Hz)</source>
<translation>Contrôleur Rapide (500Hz)</translation>
<translation type="vanished">Contrôleur Rapide (500Hz)</translation>
</message>
<message>
<location line="+9"/>
@ -15265,8 +15286,8 @@ A noter : Pour le GPS OpenPilot v8, veuillez choisir l&apos;option GPS U-Blox.</
<location filename="../../../src/plugins/setupwizard/pages/esccalibrationpage.cpp" line="+49"/>
<location line="+49"/>
<location line="+32"/>
<location line="+7"/>
<location line="+9"/>
<location line="+11"/>
<source>%1 µs</source>
<translation></translation>
</message>

View File

@ -112,6 +112,13 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
planeimg = new QGraphicsSvgItem();
planeimg->setSharedRenderer(renderer);
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
Q_ASSERT(system);
QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
if (frameType == "FixedWing" || frameType == "Aileron") {
planeimg->setElementId("aileron");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Aileron"));
@ -129,6 +136,9 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->elevonSlider1->setEnabled(false);
m_aircraft->elevonSlider2->setEnabled(false);
m_aircraft->elevonSlider1->setValue(100);
m_aircraft->elevonSlider2->setValue(100);
} else if (frameType == "FixedWingElevon" || frameType == "Elevon") {
planeimg->setElementId("elevon");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon"));
@ -147,6 +157,15 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->elevonSlider1->setEnabled(true);
m_aircraft->elevonSlider2->setEnabled(true);
// Get values saved if frameType = current frameType set on board
if (field->getValue().toString() == "FixedWingElevon") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueRoll"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
} else {
m_aircraft->elevonSlider1->setValue(100);
m_aircraft->elevonSlider2->setValue(100);
}
} else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
planeimg->setElementId("vtail");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Vtail"));
@ -168,7 +187,17 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->elevonSlider1->setEnabled(true);
m_aircraft->elevonSlider2->setEnabled(true);
// Get values saved if frameType = current frameType set on board
if (field->getValue().toString() == "FixedWingVtail") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueYaw"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
} else {
m_aircraft->elevonSlider1->setValue(100);
m_aircraft->elevonSlider2->setValue(100);
}
}
QGraphicsScene *scene = new QGraphicsScene();
scene->addItem(planeimg);
scene->setSceneRect(planeimg->boundingRect());
@ -240,26 +269,13 @@ void ConfigFixedWingWidget::refreshWidgetsValues(QString frameType)
setComboCurrentIndex(m_aircraft->fwRudder1ChannelBox, fixed.FixedWingYaw1);
setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2);
if (frameType == "FixedWingElevon") {
// If the airframe is elevon, restore the slider setting
// Find the channel number for Elevon1 (FixedWingRoll1)
int channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// If for some reason the actuators were incoherent, we might fail here, hence the check.
m_aircraft->elevonSlider1->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL) * 100);
m_aircraft->elevonSlider2->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH) * 100);
}
} else if (frameType == "FixedWingVtail") {
int channel = m_aircraft->fwElevator1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// If for some reason the actuators were incoherent, we might fail here, hence the check.
m_aircraft->elevonSlider1->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW) * 100);
m_aircraft->elevonSlider2->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH) * 100);
}
// Get mixing values for GUI sliders (values stored onboard)
if (frameType == "FixedWingElevon" || frameType == "Elevon") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueRoll"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
} else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueYaw"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
}
}
@ -404,37 +420,48 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
// 1. Assign the servo/motor/none for each channel
double value;
double pitch;
double roll;
double yaw;
// motor
int channel = m_aircraft->fwEngineChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
// rudders
// Yaw mixer value, currently no slider (should be added for Rudder response ?)
yaw = 127;
setMixerValue(mixer, "MixerValueYaw", 100);
channel = m_aircraft->fwRudder1ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw);
channel = m_aircraft->fwRudder2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yaw);
// ailerons
channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) {
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
value = (double)(m_aircraft->elevonSlider2->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, value);
value = (double)(m_aircraft->elevonSlider1->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, value);
// Compute mixer absolute values
pitch = (double)(m_aircraft->elevonSlider2->value() * 1.27);
roll = (double)(m_aircraft->elevonSlider1->value() * 1.27);
// Store sliders values onboard
setMixerValue(mixer, "MixerValuePitch", m_aircraft->elevonSlider2->value());
setMixerValue(mixer, "MixerValueRoll", m_aircraft->elevonSlider1->value());
// First servo (left aileron)
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, -pitch);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll);
// Second servo (right aileron)
channel = m_aircraft->fwAileron2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
value = (double)(m_aircraft->elevonSlider2->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, value);
value = (double)(m_aircraft->elevonSlider1->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -value);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll);
}
m_aircraft->fwStatusLabel->setText("Mixer generated");
@ -474,46 +501,54 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
// 1. Assign the servo/motor/none for each channel
double pitch;
double roll;
double yaw;
// motor
int channel = m_aircraft->fwEngineChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
// rudders
channel = m_aircraft->fwRudder1ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
channel = m_aircraft->fwRudder2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127);
// ailerons
channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) {
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127);
// Roll mixer value, currently no slider (should be added for Ailerons response ?)
roll = 127;
// Store Roll fixed value onboard
setMixerValue(mixer, "MixerValueRoll", 100);
// First Aileron (left)
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll);
// Second Aileron (right)
channel = m_aircraft->fwAileron2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll);
}
// vtail
// vtail (pitch / yaw mixing)
channel = m_aircraft->fwElevator1ChannelBox->currentIndex() - 1;
if (channel > -1) {
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
double value = (double)(m_aircraft->elevonSlider2->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, value);
value = (double)(m_aircraft->elevonSlider1->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, value);
// Compute mixer absolute values
pitch = (double)(m_aircraft->elevonSlider2->value() * 1.27);
yaw = (double)(m_aircraft->elevonSlider1->value() * 1.27);
// Store sliders values onboard
setMixerValue(mixer, "MixerValuePitch", m_aircraft->elevonSlider2->value());
setMixerValue(mixer, "MixerValueYaw", m_aircraft->elevonSlider1->value());
// First Vtail servo
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, -pitch);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw);
// Second Vtail servo
channel = m_aircraft->fwElevator2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
value = (double)(m_aircraft->elevonSlider2->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, value);
value = (double)(m_aircraft->elevonSlider1->value() * 1.27);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -value);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw);
}
m_aircraft->fwStatusLabel->setText("Mixer generated");

View File

@ -807,18 +807,13 @@ void ConfigMultiRotorWidget::setupQuadMotor(int channel, double pitch, double ro
Q_ASSERT(mixer);
// Normalize mixer values, allow a well balanced mixer saved
pitch = (pitch < 0) ? qFloor(pitch * 127) : qCeil(pitch * 127);
roll = (roll < 0) ? qFloor(roll * 127) : qCeil(roll * 127);
yaw = (yaw < 0) ? qFloor(yaw * 127) : qCeil(yaw * 127);
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 0);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll * 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch * 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw * 127);
}
/**

View File

@ -29,6 +29,7 @@
#include "uavobjectmanager.h"
#include "uavobject.h"
#include "systemsettings.h"
#include <QtCore/qmath.h>
#include <QDebug>
@ -254,6 +255,9 @@ void VehicleConfig::setMixerVectorValue(UAVDataObject *mixer, int channel, Mixer
UAVObjectField *field = mixer->getField(mixerVectors.at(channel));
Q_ASSERT(field);
// Normalize mixer values
value = (value < 0) ? qFloor(value) : qCeil(value);
if (field) {
field->setDouble(value, elementName);
}

View File

@ -58,13 +58,24 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
skipflag(false),
nextDelayedTimer(),
nextDelayedTick(0),
nextDelayedLatestActivityTick(0)
nextDelayedLatestActivityTick(0),
accessoryDesiredObj0(NULL),
accessoryDesiredObj1(NULL),
accessoryDesiredObj2(NULL)
{
manualCommandObj = ManualControlCommand::GetInstance(getObjectManager());
manualSettingsObj = ManualControlSettings::GetInstance(getObjectManager());
flightModeSettingsObj = FlightModeSettings::GetInstance(getObjectManager());
flightStatusObj = FlightStatus::GetInstance(getObjectManager());
receiverActivityObj = ReceiverActivity::GetInstance(getObjectManager());
accessoryDesiredObj0 = AccessoryDesired::GetInstance(getObjectManager(), 0);
accessoryDesiredObj1 = AccessoryDesired::GetInstance(getObjectManager(), 1);
accessoryDesiredObj2 = AccessoryDesired::GetInstance(getObjectManager(), 2);
// Only instance 0 is present if the board is not connected.
// The other instances are populated lazily.
Q_ASSERT(accessoryDesiredObj0);
ui = new Ui_InputWidget();
ui->setupUi(this);
@ -398,10 +409,6 @@ void ConfigInputWidget::goToWizard()
flightModeSettingsData.Arming = FlightModeSettings::ARMING_ALWAYSDISARMED;
flightModeSettingsObj->setData(flightModeSettingsData);
accessoryDesiredObj0 = AccessoryDesired::GetInstance(getObjectManager(), 0);
accessoryDesiredObj1 = AccessoryDesired::GetInstance(getObjectManager(), 1);
accessoryDesiredObj2 = AccessoryDesired::GetInstance(getObjectManager(), 2);
// Use faster input update rate.
fastMdata();
@ -1293,15 +1300,54 @@ void ConfigInputWidget::moveTxControls()
}
}
AccessoryDesired *ConfigInputWidget::getAccessoryDesiredInstance(int instance)
{
switch (instance) {
case 0:
if (accessoryDesiredObj0 == NULL) {
accessoryDesiredObj0 = AccessoryDesired::GetInstance(getObjectManager(), 0);
}
return accessoryDesiredObj0;
case 1:
if (accessoryDesiredObj1 == NULL) {
accessoryDesiredObj1 = AccessoryDesired::GetInstance(getObjectManager(), 1);
}
return accessoryDesiredObj1;
case 2:
if (accessoryDesiredObj2 == NULL) {
accessoryDesiredObj2 = AccessoryDesired::GetInstance(getObjectManager(), 2);
}
return accessoryDesiredObj2;
default:
Q_ASSERT(false);
}
return NULL;
}
float ConfigInputWidget::getAccessoryDesiredValue(int instance)
{
AccessoryDesired *accessoryDesiredObj = getAccessoryDesiredInstance(instance);
if (accessoryDesiredObj == NULL) {
Q_ASSERT(false);
return 0.0f;
}
AccessoryDesired::DataFields data = accessoryDesiredObj->getData();
return data.AccessoryVal;
}
void ConfigInputWidget::moveSticks()
{
QTransform trans;
manualCommandData = manualCommandObj->getData();
flightStatusData = flightStatusObj->getData();
accessoryDesiredData0 = accessoryDesiredObj0->getData();
accessoryDesiredData1 = accessoryDesiredObj1->getData();
accessoryDesiredData2 = accessoryDesiredObj2->getData();
switch (transmitterMode) {
case mode1:
@ -1342,9 +1388,10 @@ void ConfigInputWidget::moveSticks()
m_txFlightMode->setElementId("flightModeRight");
m_txFlightMode->setTransform(m_txFlightModeROrig, false);
}
m_txAccess0->setTransform(QTransform(m_txAccess0Orig).translate(accessoryDesiredData0.AccessoryVal * ACCESS_MAX_MOVE * 10, 0), false);
m_txAccess1->setTransform(QTransform(m_txAccess1Orig).translate(accessoryDesiredData1.AccessoryVal * ACCESS_MAX_MOVE * 10, 0), false);
m_txAccess2->setTransform(QTransform(m_txAccess2Orig).translate(accessoryDesiredData2.AccessoryVal * ACCESS_MAX_MOVE * 10, 0), false);
m_txAccess0->setTransform(QTransform(m_txAccess0Orig).translate(getAccessoryDesiredValue(0) * ACCESS_MAX_MOVE * 10, 0), false);
m_txAccess1->setTransform(QTransform(m_txAccess1Orig).translate(getAccessoryDesiredValue(1) * ACCESS_MAX_MOVE * 10, 0), false);
m_txAccess2->setTransform(QTransform(m_txAccess2Orig).translate(getAccessoryDesiredValue(2) * ACCESS_MAX_MOVE * 10, 0), false);
}
void ConfigInputWidget::dimOtherControls(bool value)
@ -1534,7 +1581,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
manualSettingsData.ChannelMax[i] = manualCommandData.Channel[i];
}
fastMdata();
fastMdataSingle(manualCommandObj, &manualControlMdata);
connect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration()));
} else {
@ -1543,7 +1590,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
manualCommandData = manualCommandObj->getData();
manualSettingsData = manualSettingsObj->getData();
restoreMdata();
restoreMdataSingle(manualCommandObj, &manualControlMdata);
for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) {
manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i];

View File

@ -116,9 +116,6 @@ private:
AccessoryDesired *accessoryDesiredObj0;
AccessoryDesired *accessoryDesiredObj1;
AccessoryDesired *accessoryDesiredObj2;
AccessoryDesired::DataFields accessoryDesiredData0;
AccessoryDesired::DataFields accessoryDesiredData1;
AccessoryDesired::DataFields accessoryDesiredData2;
ManualControlSettings *manualSettingsObj;
ManualControlSettings::DataFields manualSettingsData;
@ -171,6 +168,9 @@ private:
void wzNextDelayedStart();
void wzNextDelayedCancel();
AccessoryDesired *getAccessoryDesiredInstance(int instance);
float getAccessoryDesiredValue(int instance);
private slots:
void wzNext();
void wzNextDelayed();

View File

@ -116,8 +116,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>774</width>
<height>505</height>
<width>772</width>
<height>514</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -366,7 +366,7 @@
</size>
</property>
<property name="text">
<string>Start Configuration Wizard</string>
<string>Start Transmitter Setup Wizard</string>
</property>
<property name="checkable">
<bool>false</bool>
@ -542,8 +542,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>542</height>
<width>724</width>
<height>497</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7" rowstretch="1,0,0,0">
@ -2044,8 +2044,8 @@ Setup the flight mode channel on the RC Input tab if you have not done so alread
<rect>
<x>0</x>
<y>0</y>
<width>565</width>
<height>159</height>
<width>407</width>
<height>138</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">

View File

@ -282,7 +282,7 @@
</size>
</property>
<property name="toolTip">
<string>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
<string>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</string>
</property>
<item>
@ -322,7 +322,7 @@
</item>
<item>
<property name="text">
<string>500</string>
<string>490</string>
</property>
</item>
</widget>
@ -345,7 +345,7 @@
</size>
</property>
<property name="toolTip">
<string>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
<string>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</string>
</property>
<item>
@ -385,7 +385,7 @@
</item>
<item>
<property name="text">
<string>500</string>
<string>490</string>
</property>
</item>
</widget>
@ -430,7 +430,7 @@
</size>
</property>
<property name="toolTip">
<string>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
<string>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</string>
</property>
<item>
@ -470,7 +470,7 @@
</item>
<item>
<property name="text">
<string>500</string>
<string>490</string>
</property>
</item>
</widget>
@ -493,7 +493,7 @@
</size>
</property>
<property name="toolTip">
<string>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
<string>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</string>
</property>
<item>
@ -533,7 +533,7 @@
</item>
<item>
<property name="text">
<string>500</string>
<string>490</string>
</property>
</item>
</widget>
@ -566,7 +566,7 @@
</size>
</property>
<property name="toolTip">
<string>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
<string>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</string>
</property>
<item>
@ -606,7 +606,7 @@
</item>
<item>
<property name="text">
<string>500</string>
<string>490</string>
</property>
</item>
</widget>
@ -629,7 +629,7 @@
</size>
</property>
<property name="toolTip">
<string>Setup &quot;RapidESC&quot; here: usual value is 500 Hz for multirotor airframes.
<string>Setup &quot;RapidESC&quot; here: usual value is 490 Hz for multirotor airframes.
</string>
</property>
<item>
@ -669,7 +669,7 @@
</item>
<item>
<property name="text">
<string>500</string>
<string>490</string>
</property>
</item>
</widget>

View File

@ -36,7 +36,7 @@ bool OutputCalibrationUtil::c_prepared = false;
ActuatorCommand::Metadata OutputCalibrationUtil::c_savedActuatorCommandMetaData;
OutputCalibrationUtil::OutputCalibrationUtil(QObject *parent) :
QObject(parent), m_outputChannel(-1), m_safeValue(1000)
QObject(parent), m_safeValue(1000)
{}
OutputCalibrationUtil::~OutputCalibrationUtil()
@ -93,15 +93,17 @@ void OutputCalibrationUtil::stopOutputCalibration()
}
}
void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValue)
void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValue) {
QList<quint16> channels;
channels.append(channel);
startChannelOutput(channels, safeValue);
}
void OutputCalibrationUtil::startChannelOutput(QList<quint16> channels, quint16 safeValue)
{
if (c_prepared) {
if (m_outputChannel < 0 && channel < ActuatorCommand::CHANNEL_NUMELEM) {
// Start output...
m_outputChannel = channel;
m_outputChannels = channels;
m_safeValue = safeValue;
qDebug() << "Output for channel " << m_outputChannel + 1 << " started.";
}
} else {
qDebug() << "OutputCalibrationUtil not started.";
}
@ -110,15 +112,9 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu
void OutputCalibrationUtil::stopChannelOutput()
{
if (c_prepared) {
if (m_outputChannel >= 0) {
qDebug() << "Stopping output for channel " << m_outputChannel + 1 << "...";
// Stop output...
setChannelOutputValue(m_safeValue);
qDebug() << "Settings output for channel " << m_outputChannel + 1 << " to " << m_safeValue;
qDebug() << "Output for channel " << m_outputChannel + 1 << " stopped.";
m_outputChannel = -1;
}
m_outputChannels.clear();
qDebug() << "OutputCalibrationUtil output stopped.";
} else {
qDebug() << "OutputCalibrationUtil not started.";
}
@ -127,15 +123,20 @@ void OutputCalibrationUtil::stopChannelOutput()
void OutputCalibrationUtil::setChannelOutputValue(quint16 value)
{
if (c_prepared) {
if (m_outputChannel >= 0) {
// Set output value
qDebug() << "Setting output value for channel " << m_outputChannel << " to " << value << ".";
ActuatorCommand *actuatorCommand = getActuatorCommandObject();
ActuatorCommand::DataFields data = actuatorCommand->getData();
data.Channel[m_outputChannel] = value;
foreach (quint32 channel, m_outputChannels) {
// Set output value
if (channel <= ActuatorCommand::CHANNEL_NUMELEM){
qDebug() << "OutputCalibrationUtil setting output value for channel " << channel << " to " << value << ".";
data.Channel[channel] = value;
} else {
qDebug() << "OutputCalibrationUtil could not set output value for channel " << channel
<< " to " << value << "." << "Channel out of bounds" << channel << ".";
}
}
actuatorCommand->setData(data);
} else {
qDebug() << "OutputCalibrationUtil not started.";
}
}
}

View File

@ -44,13 +44,14 @@ public:
public slots:
void startChannelOutput(quint16 channel, quint16 safeValue);
void startChannelOutput(QList<quint16> channels, quint16 safeValue);
void stopChannelOutput();
void setChannelOutputValue(quint16 value);
private:
static bool c_prepared;
static ActuatorCommand::Metadata c_savedActuatorCommandMetaData;
qint16 m_outputChannel;
QList<quint16> m_outputChannels;
quint16 m_safeValue;
};

View File

@ -102,17 +102,19 @@ void EscCalibrationPage::startButtonClicked()
MixerSettings *mSettings = MixerSettings::GetInstance(uavoManager);
Q_ASSERT(mSettings);
QString mixerTypePattern = "Mixer%1Type";
OutputCalibrationUtil::startOutputCalibration();
for (quint32 i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1));
Q_ASSERT(field);
if (field->getValue().toString() == field->getOptions().at(VehicleConfigurationHelper::MIXER_TYPE_MOTOR)) {
OutputCalibrationUtil *output = new OutputCalibrationUtil();
output->startChannelOutput(i, OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
output->setChannelOutputValue(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
m_outputs << output;
m_outputChannels << i;
}
}
m_outputUtil.startChannelOutput(m_outputChannels, OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
QThread::msleep(100);
m_outputUtil.setChannelOutputValue(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
ui->stopButton->setEnabled(true);
}
}
@ -124,35 +126,29 @@ void EscCalibrationPage::stopButtonClicked()
ui->outputHigh->setEnabled(false);
// Set to low pwm out
foreach(OutputCalibrationUtil * output, m_outputs) {
output->setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
}
m_outputUtil.setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
ui->outputLevel->setText(QString(tr("%1 µs")).arg(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
QApplication::processEvents();
QThread::msleep(2000);
// Ramp down to off pwm out
for (int i = LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS; i >= OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS; i -= 10) {
foreach(OutputCalibrationUtil * output, m_outputs) {
output->setChannelOutputValue(i);
}
m_outputUtil.setChannelOutputValue(i);
ui->outputLevel->setText(QString(tr("%1 µs")).arg(i));
QApplication::processEvents();
QThread::msleep(200);
}
// Stop output
foreach(OutputCalibrationUtil * output, m_outputs) {
output->stopChannelOutput();
delete output;
}
m_outputUtil.stopChannelOutput();
OutputCalibrationUtil::stopOutputCalibration();
ui->outputLevel->setText(QString(tr("%1 µs")).arg(OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
ui->outputHigh->setEnabled(false);
ui->outputLow->setEnabled(true);
ui->nonconnectedLabel->setEnabled(true);
ui->connectedLabel->setEnabled(false);
m_outputs.clear();
m_outputChannels.clear();
m_isCalibrating = false;
resetAllSecurityCheckboxes();
enableButtons(true);

View File

@ -58,8 +58,8 @@ private:
static const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1900;
Ui::EscCalibrationPage *ui;
bool m_isCalibrating;
QList<OutputCalibrationUtil *> m_outputs;
OutputCalibrationUtil m_outputUtil;
QList<quint16> m_outputChannels;
};
#endif // ESCCALIBRATIONPAGE_H

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -370,10 +370,10 @@ QString SetupWizard::getSummaryText()
summary.append("<b>").append(tr("Speed Controller (ESC) type: ")).append("</b>");
switch (getEscType()) {
case ESC_STANDARD:
summary.append(tr("Standard ESC (50 Hz)"));
summary.append(tr("Standard ESC (%1 Hz)").arg(VehicleConfigurationHelper::LEGACY_ESC_FREQUENCY));
break;
case ESC_RAPID:
summary.append(tr("Rapid ESC (500 Hz)"));
summary.append(tr("Rapid ESC (%1 Hz)").arg(VehicleConfigurationHelper::RAPID_ESC_FREQUENCY));
break;
default:
summary.append(tr("Unknown"));

View File

@ -690,6 +690,10 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
break;
}
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
break;
case VehicleConfigurationSource::VEHICLE_HELI:
case VehicleConfigurationSource::VEHICLE_SURFACE:
// TODO: Implement mixer / sliders settings for other vehicle types?
@ -1790,7 +1794,7 @@ void VehicleConfigurationHelper::setupElevon()
channels[0].pitch = -100;
channels[0].yaw = 0;
// Elevon Servo 1 (Chan 2)
// Elevon Servo 2 (Chan 2)
channels[1].type = MIXER_TYPE_SERVO;
channels[1].throttle1 = 0;
channels[1].throttle2 = 0;
@ -1828,7 +1832,7 @@ void VehicleConfigurationHelper::setupDualAileron()
channels[0].type = MIXER_TYPE_SERVO;
channels[0].throttle1 = 0;
channels[0].throttle2 = 0;
channels[0].roll = -100;
channels[0].roll = 100;
channels[0].pitch = 0;
channels[0].yaw = 0;

View File

@ -58,7 +58,7 @@ public:
bool setupVehicle(bool save = true);
bool setupHardwareSettings(bool save = true);
static const qint16 LEGACY_ESC_FREQUENCY = 50;
static const qint16 RAPID_ESC_FREQUENCY = 500;
static const qint16 RAPID_ESC_FREQUENCY = 490;
static const qint16 ANALOG_SERVO_FREQUENCY = 50;
static const qint16 DIGITAL_SERVO_FREQUENCY = 333;
static const int MIXER_TYPE_NONE = 0;