1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-09 20:46:07 +01:00
LibrePilot/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.h

123 lines
3.9 KiB
C
Raw Normal View History

/**
******************************************************************************
*
* @file vehicleconfigurationhelper.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup VehicleConfigurationHelper
* @{
* @brief
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef VEHICLECONFIGURATIONHELPER_H
#define VEHICLECONFIGURATIONHELPER_H
#include <QList>
#include <QPair>
#include "vehicleconfigurationsource.h"
#include "uavobjectmanager.h"
#include "systemsettings.h"
#include "cfg_vehicletypes/vehicleconfig.h"
#include "actuatorsettings.h"
struct mixerChannelSettings {
int type;
int throttle1;
int throttle2;
int roll;
int pitch;
int yaw;
mixerChannelSettings() : type(), throttle1(), throttle2(), roll(), pitch(), yaw() {}
mixerChannelSettings(int t, int th1, int th2, int r, int p, int y)
: type(t), throttle1(th1), throttle2(th2), roll(r), pitch(p), yaw(y) {}
};
class VehicleConfigurationHelper : public QObject {
Q_OBJECT
public:
VehicleConfigurationHelper(VehicleConfigurationSource *configSource);
bool setupVehicle(bool save = true);
bool setupHardwareSettings(bool save = true);
2014-11-02 15:38:41 +01:00
bool isApplicable(UAVObject *dataObj);
2014-09-30 20:40:54 +02:00
static const qint16 LEGACY_ESC_FREQUENCY = 50;
static const qint16 RAPID_ESC_FREQUENCY = 500;
static const qint16 ANALOG_SERVO_FREQUENCY = 50;
static const qint16 DIGITAL_SERVO_FREQUENCY = 333;
static const int MIXER_TYPE_NONE = 0;
static const int MIXER_TYPE_MOTOR = 1;
static const int MIXER_TYPE_REVERSABLEMOTOR = 2;
static const int MIXER_TYPE_SERVO = 3;
signals:
void saveProgress(int total, int current, QString description);
private:
static const float DEFAULT_ENABLED_ACCEL_TAU = 0.1;
VehicleConfigurationSource *m_configSource;
UAVObjectManager *m_uavoManager;
QList<QPair<UAVDataObject *, QString> * > m_modifiedObjects;
void addModifiedObject(UAVDataObject *object, QString description);
void clearModifiedObjects();
void applyHardwareConfiguration();
void applyVehicleConfiguration();
void applyActuatorConfiguration();
void applyFlightModeConfiguration();
void applySensorBiasConfiguration();
void applyStabilizationConfiguration();
void applyManualControlDefaults();
void applyTemplateSettings();
void applyMixerConfiguration(mixerChannelSettings channels[]);
GUIConfigDataUnion getGUIConfigData();
void applyMultiGUISettings(SystemSettings::AirframeTypeOptions airframe, GUIConfigDataUnion guiConfig);
bool saveChangesToController(bool save);
QEventLoop m_eventLoop;
bool m_transactionOK;
bool m_transactionTimeout;
int m_currentTransactionObjectID;
int m_progress;
void resetVehicleConfig();
void resetGUIData();
void setupTriCopter();
void setupQuadCopter();
void setupHexaCopter();
void setupOctoCopter();
2014-06-08 05:04:12 +02:00
void setupElevon();
void setupDualAileron();
Changed the element id's in one of the SVG files that I incorrectly edited. This prevents the error: Could not resolve property : SVGID_1_ Error comes from qsvghandler.cpp or qsvgstyle.cpp in the QT libraries Qt5.2.0//5.2.0-beta1/Src/qtsvg/src/svg/ The fixedwing-shapes.svg and flyingwing-shapes.svg files need modified to prevent the errors caused by qsvgtinydocument.cpp in the QT libraries. Couldn't find node aileron. Skipping rendering. Couldn't find node vtail. Skipping rendering. These errors come from the case statement that was added to updateImageAnd Description() for FixedWingPage + switch (type) { + case SetupWizard::FIXED_WING_AILERON: + elementId = "aileron"; + break; + case SetupWizard::FIXED_WING_VTAIL: + elementId = "vtail"; + break; + default: + elementId = ""; + break; + } A similar error needs to be resolved in connectiondiagram.cpp + switch (m_configSource->getVehicleSubType()) { + case VehicleConfigurationSource::FIXED_WING_AILERON: + elementsToShow << "aileron"; + break; + case VehicleConfigurationSource::FIXED_WING_VTAIL: + elementsToShow << "vtail"; + break; + default: + break; + } Likewise outputcalibrationpage.cpp will need to reverence the elements inside the SVG file properly. + m_vehicleElementIds << "fixed-aileron" << "aileron"; + m_vehicleHighlightElementIndexes << 0 << 1; ... + m_vehicleElementIds << "fixed-vtail" << "vtail"; + m_vehicleHighlightElementIndexes << 0 << 1; Until these elements are fixed in the SVG files the wizard will not render properly and allow the user to click *next*.
2013-11-24 23:29:38 +01:00
void setupAileron();
private slots:
void uAVOTransactionCompleted(UAVObject *object, bool success);
void uAVOTransactionCompleted(int oid, bool success);
void saveChangesTimeout();
};
#endif // VEHICLECONFIGURATIONHELPER_H