dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
vehicleconfigurationhelper.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #ifndef VEHICLECONFIGURATIONHELPER_H
30 #define VEHICLECONFIGURATIONHELPER_H
31 
33 
36 #include <actuatorsettings.h>
37 #include <systemsettings.h>
38 
39 #include <QEventLoop>
40 #include <QList>
41 #include <QPair>
42 
44 {
45  int type;
46  int throttle1;
47  int throttle2;
48  int roll;
49  int pitch;
50  int yaw;
51 
53  : type()
54  , throttle1()
55  , throttle2()
56  , roll()
57  , pitch()
58  , yaw()
59  {
60  }
61 
62  mixerChannelSettings(int t, int th1, int th2, int r, int p, int y)
63  : type(t)
64  , throttle1(th1)
65  , throttle2(th2)
66  , roll(r)
67  , pitch(p)
68  , yaw(y)
69  {
70  }
71 };
72 
82 class VehicleConfigurationHelper : public QObject
83 {
84  Q_OBJECT
85 
86 public:
88  bool setupVehicle(bool save = true);
89  bool setupHardwareSettings(bool save = true);
90 
91  enum EscFrequency {
98  };
99 
100 signals:
101  void saveProgress(int total, int current, QString description);
102 
103 private:
104  static const int MIXER_TYPE_DISABLED = 0;
105  static const int MIXER_TYPE_MOTOR = 1;
106  static const int MIXER_TYPE_SERVO = 2;
107  static const float DEFAULT_ENABLED_ACCEL_TAU;
108 
109  VehicleConfigurationSource *m_configSource;
110  UAVObjectManager *m_uavoManager;
111 
112  QList<QPair<UAVDataObject *, QString> *> m_modifiedObjects;
113  void addModifiedObject(UAVDataObject *object, QString description);
114  void clearModifiedObjects();
115 
116  void applyHardwareConfiguration();
117  void applyVehicleConfiguration();
118  void applyActuatorConfiguration();
119  void applyFlighModeConfiguration();
120  void applySensorBiasConfiguration();
121  void applyStabilizationConfiguration();
122  void applyManualControlDefaults();
123 
124  void applyMixerConfiguration(mixerChannelSettings channels[]);
125 
126  GUIConfigDataUnion getGUIConfigData();
127  void applyMultiGUISettings(SystemSettings::AirframeTypeOptions airframe,
128  GUIConfigDataUnion guiConfig);
129 
130  bool saveChangesToController(bool save);
131  QEventLoop m_eventLoop;
132  bool m_transactionOK;
133  bool m_transactionTimeout;
134  int m_currentTransactionObjectID;
135  int m_progress;
136 
137  void resetVehicleConfig();
138  void resetGUIData();
139 
140  void setupTriCopter();
141  void setupQuadCopter();
142  void setupHexaCopter();
143  void setupOctoCopter();
144 
145 private slots:
146  void uavoTransactionCompleted(UAVObject *object, bool success);
147  void uavoTransactionCompleted(int oid, bool success);
148  void saveChangesTimeout();
149 };
150 
151 #endif // VEHICLECONFIGURATIONHELPER_H
VehicleConfigurationHelper(VehicleConfigurationSource *configSource)
const char t[]
Definition: coreconstants.h:40
mixerChannelSettings(int t, int th1, int th2, int r, int p, int y)
void saveProgress(int total, int current, QString description)
Definition: icore.h:39
The VehicleConfigurationHelper class provides an interface between the settings selected in the wizar...
save(matfile $(SAVEOBJECTSCODE))
y
Definition: OPPlots.m:101