2 ******************************************************************************
4 * @file GCSControlgadget.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup GCSControlGadgetPlugin GCSControl Gadget Plugin
10 * @brief A gadget to control the UAV, either from the keyboard or a joystick
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef GCSControlGADGET_H_
29 #define GCSControlGADGET_H_
31 #include <coreplugin/iuavgadget.h>
32 #include "manualcontrolcommand.h"
33 #include "gcscontrolgadgetconfiguration.h"
34 #include "sdlgamepad/sdlgamepad.h"
36 #include "gcscontrolplugin.h"
38 #include <QHostAddress>
46 class GCSControlGadgetWidget
;
50 class GCSControlGadget
: public Core::IUAVGadget
{
53 GCSControlGadget(QString classId
, GCSControlGadgetWidget
*widget
, QWidget
*parent
= 0, QObject
*plugin
= 0);
56 QList
<int> context() const
64 QString
contextHelpId() const
69 void loadConfiguration(IUAVGadgetConfiguration
*config
);
72 ManualControlCommand
*getManualControlCommand();
73 double constrain(double value
);
77 UAVObject::Metadata mccInitialData
;
83 buttonSettingsStruct buttonSettings
[8];
84 double bound(double input
);
85 double wrap(double input
);
86 bool channelReverse
[8];
87 QUdpSocket
*control_sock
;
91 void sticksChangedRemotely(double leftX
, double leftY
, double rightX
, double rightY
);
94 void manualControlCommandUpdated(UAVObject
*);
95 void sticksChangedLocally(double leftX
, double leftY
, double rightX
, double rightY
);
96 void readUDPCommand();
98 // signals from joystick
99 void gamepads(quint8 count
);
100 void buttonState(ButtonNumber number
, bool pressed
);
101 void axesValues(QListInt16 values
);
105 #endif // GCSControlGADGET_H_