33 #include <actuatorcommand.h>
46 for (
int i = 0;
i < (int)(ActuatorCommand::CHANNEL_NUMELEM);
i++) {
53 MixerSettings::GetInstance(getUAVObjectManager())->getField(
"Mixer1Type")->getOptions();
58 foreach (QPushButton *btn, findChildren<QPushButton *>()) {
59 btn->setAttribute(Qt::WA_LayoutUsesWidgetRect);
75 SystemSettings *systemSettings = SystemSettings::GetInstance(getUAVObjectManager());
76 Q_ASSERT(systemSettings);
77 SystemSettings::DataFields systemSettingsData = systemSettings->getData();
80 for (i = 0; i < (int)(SystemSettings::AIRFRAMECATEGORYSPECIFICCONFIGURATION_NUMELEM); i++)
81 configData.
UAVObject[i] = systemSettingsData.AirframeCategorySpecificConfiguration[i];
84 Q_ASSERT(SystemSettings::AIRFRAMECATEGORYSPECIFICCONFIGURATION_NUMELEM
91 SystemSettings::AirframeTypeOptions vehicle)
97 Q_ASSERT(SystemSettings::AIRFRAMECATEGORYSPECIFICCONFIGURATION_NUMELEM
101 SystemSettings *systemSettings = SystemSettings::GetInstance(getUAVObjectManager());
102 Q_ASSERT(systemSettings);
103 SystemSettings::DataFields systemSettingsData = systemSettings->getData();
106 for (i = 0; i < (int)(SystemSettings::AIRFRAMECATEGORYSPECIFICCONFIGURATION_NUMELEM); i++) {
107 systemSettingsData.AirframeCategorySpecificConfiguration[
i] = configData.
UAVObject[
i];
110 systemSettingsData.AirframeType = vehicle;
112 systemSettings->setData(systemSettingsData);
117 Q_UNUSED(configData);
129 if (index >= 0 && index < box->count())
130 box->setCurrentIndex(index);
139 for (
int i = 1;
i <= boxCount;
i++) {
140 QComboBox *box = owner->findChild<QComboBox *>(QString(
"%0%1").arg(boxName).arg(
i));
142 box->setEnabled(enable);
152 if (channel >= 0 && channel <
mixerTypes.count()) {
157 mixerType = field->
getValue().toString();
164 MixerSettings::Mixer1TypeOptions mixerType)
168 if (channel >= 0 && channel <
mixerTypes.count()) {
199 for (
int channel = 0; channel < (int)ActuatorCommand::CHANNEL_NUMELEM; channel++) {
204 setMixerType(mixer, channel, MixerSettings::MIXER1TYPE_DISABLED);
211 MixerSettings::Mixer1VectorElem elementName)
229 MixerSettings::Mixer1VectorElem elementName,
double value)
249 QPointer<UAVObjectField> field = mixer->
getField(elementName);
260 QPointer<UAVObjectField> field = mixer->
getField(elementName);
267 MixerSettings::Mixer1VectorElem curveType,
QList<double> curve)
269 QPointer<UAVObjectField> field;
272 if (field && field->getNumElements() == curve.length()) {
273 for (
int i = 0;
i < curve.length();
i++)
279 MixerSettings::Mixer1VectorElem curveType,
285 QPointer<UAVObjectField> field;
290 for (
auto i = 0;
i < field->getNumElements();
i++) {
291 curve->append(field->getValue(
i).toDouble());
301 for (
int i = 0;
i < curve->count();
i++) {
302 if (curve->at(
i) != 0)
312 for (
int i = 0;
i < curve->count();
i++)
313 min = std::min(min, curve->at(
i));
321 for (
int i = 0;
i < curve->count();
i++)
322 max = std::max(max, curve->at(
i));
357 for (
int i = 0;
i < labels.length();
i++) {
358 QLabel *lbl = owner->findChild<QLabel *>(QString(
"%0%1").arg(boxName).arg(
i + 1));
360 lbl->setText(labels[
i]);
363 int i = labels.length();
364 while (QLabel *lbl = owner->findChild<QLabel *>(QString(
"%0%1").arg(boxName).arg(i + 1))) {
365 lbl->setText(QString(
""));
VehicleConfig(QWidget *parent=nullptr)
QStringList mixerTypeDescriptions
QString getMixerType(UAVDataObject *mixer, int channel)
static void SetConfigData(GUIConfigDataUnion configData, SystemSettings::AirframeTypeOptions vehicle)
static GUIConfigDataUnion GetConfigData()
static void resetField(UAVObjectField *field)
double getDouble(int index=0) const
Core plugin system that manages the plugins, their life cycle and their registered objects...
static const double mixerRange
QVariant getValue(int index=0) const
int getNumElements() const
bool isValidThrottleCurve(QList< double > *curve)
double getMixerVectorValue(UAVDataObject *mixer, int channel, MixerSettings::Mixer1VectorElem elementName)
virtual void ResetActuators(GUIConfigDataUnion *configData)
void setValue(const QVariant &data, int index=0)
void getThrottleCurve(UAVDataObject *mixer, MixerSettings::Mixer1VectorElem curveType, QList< double > *curve)
double getMixerValue(UAVDataObject *mixer, QString elementName)
void resetMixerVector(UAVDataObject *mixer, int channel)
UAVObjectField * getField(const QString &name)
void resetMixers(UAVDataObject *mixer)
void setMixerType(UAVDataObject *mixer, int channel, MixerSettings::Mixer1TypeOptions mixerType)
void setMixerVectorValue(UAVDataObject *mixer, int channel, MixerSettings::Mixer1VectorElem elementName, double value)
QStringList getElementNames() const
static void enableComboBoxes(QWidget *owner, QString boxName, int boxCount, bool enable)
void setThrottleCurve(UAVDataObject *mixer, MixerSettings::Mixer1VectorElem curveType, QList< double > curve)
double getCurveMax(QList< double > *curve)
void setDouble(double value, int index=0)
void setMixerValue(UAVDataObject *mixer, QString elementName, double value)
void setLabelText(QWidget *owner, const QString &boxName, const QStringList &labels)
static const double mixerScale
double getCurveMin(QList< double > *curve)
static void setComboCurrentIndex(QComboBox *box, int index)