forked from mavlink/qgroundcontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New AutoPilotPlugin and VehicleSetup
- Loading branch information
1 parent
c9a43c9
commit 006b4d3
Showing
33 changed files
with
2,880 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*===================================================================== | ||
QGroundControl Open Source Ground Control Station | ||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
This file is part of the QGROUNDCONTROL project | ||
QGROUNDCONTROL 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. | ||
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. | ||
======================================================================*/ | ||
|
||
/// @file | ||
/// @author Don Gagne <[email protected]> | ||
|
||
#include "AutoPilotPlugin.h" | ||
#include "PX4/PX4AutoPilotPlugin.h" | ||
#include "Generic/GenericAutoPilotPlugin.h" | ||
|
||
static AutoPilotPlugin* PX4_AutoPilot = NULL; ///< Singleton plugin for MAV_AUTOPILOT_PX4 | ||
static AutoPilotPlugin* Generic_AutoPilot = NULL; ///< Singleton plugin for AutoPilots which do not have a specifically implemented plugin | ||
|
||
AutoPilotPlugin::AutoPilotPlugin(void) | ||
{ | ||
|
||
} | ||
|
||
AutoPilotPlugin* AutoPilotPlugin::getInstanceForAutoPilotPlugin(int autopilotType) | ||
{ | ||
switch (autopilotType) { | ||
case MAV_AUTOPILOT_PX4: | ||
if (PX4_AutoPilot == NULL) { | ||
PX4_AutoPilot = new PX4AutoPilotPlugin; | ||
} | ||
Q_ASSERT(PX4_AutoPilot); | ||
return PX4_AutoPilot; | ||
|
||
default: | ||
if (Generic_AutoPilot == NULL) { | ||
Generic_AutoPilot = new GenericAutoPilotPlugin; | ||
} | ||
Q_ASSERT(Generic_AutoPilot); | ||
return Generic_AutoPilot; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/*===================================================================== | ||
QGroundControl Open Source Ground Control Station | ||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
This file is part of the QGROUNDCONTROL project | ||
QGROUNDCONTROL 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. | ||
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. | ||
======================================================================*/ | ||
|
||
#ifndef AUTOPILOTPLUGIN_H | ||
#define AUTOPILOTPLUGIN_H | ||
|
||
#include <QObject> | ||
#include <QList> | ||
#include <QString> | ||
|
||
#include "UASInterface.h" | ||
#include "VehicleComponent.h" | ||
|
||
/// @file | ||
/// @brief The AutoPilotPlugin class is an abstract base class which represent the methods and objects | ||
/// which are specific to a certain AutoPilot. This is the only place where AutoPilot specific | ||
/// code should reside in QGroundControl. The remainder of the QGroundControl source is | ||
/// generic to a common mavlink implementation. | ||
/// @author Don Gagne <[email protected]> | ||
|
||
class AutoPilotPlugin : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
/// @brief Returns the singleton AutoPilot instance for the specified auto pilot type. | ||
/// @param autopilotType Specified using the MAV_AUTOPILOT_* values. | ||
static AutoPilotPlugin* getInstanceForAutoPilotPlugin(int autopilotType); | ||
|
||
/// @brief Returns the list of VehicleComponent objects associated with the AutoPilot. | ||
virtual QList<VehicleComponent*> getVehicleComponents(UASInterface* uas) const = 0; | ||
|
||
typedef struct { | ||
uint8_t baseMode; | ||
uint32_t customMode; | ||
} FullMode_t; | ||
|
||
/// @brief Returns the list of modes which are available for this AutoPilot. | ||
virtual QList<FullMode_t> getModes(void) const = 0; | ||
|
||
/// @brief Returns a human readable short description for the specified mode. | ||
virtual QString getShortModeText(uint8_t baseMode, uint32_t customMode) const = 0; | ||
|
||
protected: | ||
// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin | ||
AutoPilotPlugin(void); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/*===================================================================== | ||
QGroundControl Open Source Ground Control Station | ||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
This file is part of the QGROUNDCONTROL project | ||
QGROUNDCONTROL 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. | ||
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. | ||
======================================================================*/ | ||
|
||
/// @file | ||
/// @author Don Gagne <[email protected]> | ||
|
||
#include "GenericAutoPilotPlugin.h" | ||
|
||
GenericAutoPilotPlugin::GenericAutoPilotPlugin(void) | ||
{ | ||
|
||
} | ||
|
||
QList<VehicleComponent*> GenericAutoPilotPlugin::getVehicleComponents(UASInterface* uas) const | ||
{ | ||
Q_UNUSED(uas); | ||
|
||
// Generic autopilot has no configurable components | ||
return QList<VehicleComponent*>(); | ||
} | ||
|
||
QList<AutoPilotPlugin::FullMode_t> GenericAutoPilotPlugin::getModes(void) const | ||
{ | ||
QList<FullMode_t> modeList; | ||
FullMode_t fullMode; | ||
|
||
fullMode.customMode = 0; | ||
|
||
fullMode.baseMode = MAV_MODE_FLAG_MANUAL_INPUT_ENABLED; | ||
modeList << fullMode; | ||
|
||
fullMode.baseMode = MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_STABILIZE_ENABLED; | ||
modeList << fullMode; | ||
|
||
fullMode.baseMode = MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_GUIDED_ENABLED; | ||
modeList << fullMode; | ||
|
||
fullMode.baseMode = MAV_MODE_FLAG_AUTO_ENABLED | MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_GUIDED_ENABLED; | ||
modeList << fullMode; | ||
|
||
return modeList; | ||
} | ||
|
||
QString GenericAutoPilotPlugin::getShortModeText(uint8_t baseMode, uint32_t customMode) const | ||
{ | ||
Q_UNUSED(customMode); | ||
|
||
QString mode; | ||
|
||
// use base_mode - not autopilot-specific | ||
if (baseMode == 0) { | ||
mode = "|PREFLIGHT"; | ||
} else if (baseMode & MAV_MODE_FLAG_DECODE_POSITION_AUTO) { | ||
mode = "|AUTO"; | ||
} else if (baseMode & MAV_MODE_FLAG_DECODE_POSITION_MANUAL) { | ||
mode = "|MANUAL"; | ||
if (baseMode & MAV_MODE_FLAG_DECODE_POSITION_GUIDED) { | ||
mode += "|GUIDED"; | ||
} else if (baseMode & MAV_MODE_FLAG_DECODE_POSITION_STABILIZE) { | ||
mode += "|STABILIZED"; | ||
} | ||
} | ||
|
||
return mode; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*===================================================================== | ||
QGroundControl Open Source Ground Control Station | ||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
This file is part of the QGROUNDCONTROL project | ||
QGROUNDCONTROL 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. | ||
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. | ||
======================================================================*/ | ||
|
||
#ifndef GENERICAUTOPILOT_H | ||
#define GENERICAUTOPILOT_H | ||
|
||
#include "AutoPilotPlugin.h" | ||
|
||
/// @file | ||
/// @brief This is the generic implementation of the AutoPilotPlugin class for mavs | ||
/// we do not have a specific AutoPilotPlugin implementation. | ||
/// @author Don Gagne <[email protected]> | ||
|
||
class GenericAutoPilotPlugin : public AutoPilotPlugin | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
GenericAutoPilotPlugin(void); | ||
|
||
virtual QList<VehicleComponent*> getVehicleComponents(UASInterface* uas) const ; | ||
virtual QList<FullMode_t> getModes(void) const; | ||
virtual QString getShortModeText(uint8_t baseMode, uint32_t customMode) const; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.