Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
62550909
Commit
62550909
authored
Nov 26, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
parent
0dd0e656
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
28 deletions
+88
-28
qgroundcontrol.pro
qgroundcontrol.pro
+2
-1
AutoPilotPlugin.h
src/AutoPilotPlugins/AutoPilotPlugin.h
+1
-5
AutoPilotPluginManager.cc
src/AutoPilotPlugins/AutoPilotPluginManager.cc
+14
-17
AutoPilotPluginManager.h
src/AutoPilotPlugins/AutoPilotPluginManager.h
+63
-0
GenericAutoPilotPlugin.cc
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
+2
-1
GenericAutoPilotPlugin.h
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
+1
-1
PX4AutoPilotPlugin.cc
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+4
-2
PX4AutoPilotPlugin.h
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
+1
-1
No files found.
qgroundcontrol.pro
View file @
62550909
...
...
@@ -702,6 +702,7 @@ HEADERS+= \
src
/
VehicleSetup
/
VehicleSetupButton
.
h
\
src
/
VehicleSetup
/
VehicleComponentButton
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPluginManager
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
PX4AutoPilotPlugin
.
h
\
...
...
@@ -716,7 +717,7 @@ SOURCES += \
src
/
VehicleSetup
/
SummaryPage
.
cc
\
src
/
VehicleSetup
/
ParameterEditor
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
Manager
.
cc
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
PX4AutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
PX4Component
.
cc
\
...
...
src/AutoPilotPlugins/AutoPilotPlugin.h
View file @
62550909
...
...
@@ -43,10 +43,6 @@ 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
;
...
...
@@ -63,7 +59,7 @@ public:
protected:
// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin
AutoPilotPlugin
(
void
);
AutoPilotPlugin
(
QObject
*
parent
=
NULL
)
:
QObject
(
parent
)
{
}
};
#endif
src/AutoPilotPlugins/AutoPilotPlugin.cc
→
src/AutoPilotPlugins/AutoPilotPlugin
Manager
.cc
View file @
62550909
...
...
@@ -24,33 +24,30 @@
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "AutoPilotPlugin.h"
#include "AutoPilotPlugin
Manager
.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
)
AutoPilotPluginManager
::
AutoPilotPluginManager
(
QObject
*
parent
)
:
QObject
(
parent
)
{
// All plugins are constructed here so that they end up on the correct thread
_pluginMap
[
MAV_AUTOPILOT_PX4
]
=
new
PX4AutoPilotPlugin
(
this
);
Q_ASSERT
(
_pluginMap
.
contains
(
MAV_AUTOPILOT_PX4
));
_pluginMap
[
MAV_AUTOPILOT_GENERIC
]
=
new
GenericAutoPilotPlugin
(
this
);
Q_ASSERT
(
_pluginMap
.
contains
(
MAV_AUTOPILOT_GENERIC
));
}
AutoPilotPlugin
*
AutoPilotPlugin
::
getInstanceForAutoPilotPlugin
(
int
autopilotType
)
AutoPilotPlugin
*
AutoPilotPlugin
Manager
::
getInstanceForAutoPilotPlugin
(
int
autopilotType
)
{
switch
(
autopilotType
)
{
case
MAV_AUTOPILOT_PX4
:
if
(
PX4_AutoPilot
==
NULL
)
{
PX4_AutoPilot
=
new
PX4AutoPilotPlugin
;
}
Q_ASSERT
(
PX4_AutoPilot
);
return
PX4_AutoPilot
;
Q_ASSERT
(
_pluginMap
.
contains
(
MAV_AUTOPILOT_PX4
));
return
_pluginMap
[
MAV_AUTOPILOT_PX4
];
default:
if
(
Generic_AutoPilot
==
NULL
)
{
Generic_AutoPilot
=
new
GenericAutoPilotPlugin
;
}
Q_ASSERT
(
Generic_AutoPilot
);
return
Generic_AutoPilot
;
Q_ASSERT
(
_pluginMap
.
contains
(
MAV_AUTOPILOT_GENERIC
));
return
_pluginMap
[
MAV_AUTOPILOT_GENERIC
];
}
}
src/AutoPilotPlugins/AutoPilotPluginManager.h
0 → 100644
View file @
62550909
/*=====================================================================
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 AUTOPILOTPLUGINMANAGER_H
#define AUTOPILOTPLUGINMANAGER_H
#include <QObject>
#include <QList>
#include <QString>
#include "UASInterface.h"
#include "VehicleComponent.h"
#include "QGCApplication.h"
#include "AutoPilotPlugin.h"
/// @file
/// @brief The AutoPilotPlugin manager is a singleton which maintains the list of AutoPilotPlugin objects.
///
/// @author Don Gagne <don@thegagnes.com>
class
AutoPilotPluginManager
:
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.
AutoPilotPlugin
*
getInstanceForAutoPilotPlugin
(
int
autopilotType
);
private:
/// @brief Only QGCQpplication is allowed to call constructor. All access to singleton is through
/// QGCApplication::singletonAutoPilotPluginManager.
AutoPilotPluginManager
(
QObject
*
parent
=
NULL
);
/// @brief Only QGCQpplication is allowed to call constructor. All access to singleton is through
/// QGCApplication::singletonAutoPilotPluginManager.
friend
class
QGCApplication
;
QMap
<
int
,
AutoPilotPlugin
*>
_pluginMap
;
};
#endif
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
View file @
62550909
...
...
@@ -26,7 +26,8 @@
#include "GenericAutoPilotPlugin.h"
GenericAutoPilotPlugin
::
GenericAutoPilotPlugin
(
void
)
GenericAutoPilotPlugin
::
GenericAutoPilotPlugin
(
QObject
*
parent
)
:
AutoPilotPlugin
(
parent
)
{
}
...
...
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
View file @
62550909
...
...
@@ -36,7 +36,7 @@ class GenericAutoPilotPlugin : public AutoPilotPlugin
Q_OBJECT
public:
GenericAutoPilotPlugin
(
void
);
GenericAutoPilotPlugin
(
QObject
*
parent
=
NULL
);
virtual
QList
<
VehicleComponent
*>
getVehicleComponents
(
UASInterface
*
uas
)
const
;
virtual
QList
<
FullMode_t
>
getModes
(
void
)
const
;
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
62550909
...
...
@@ -26,6 +26,7 @@
#include "RadioComponent.h"
#include "SensorsComponent.h"
#include "FlightModesComponent.h"
#include "AutoPilotPluginManager.h"
/// @file
/// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type.
...
...
@@ -61,7 +62,8 @@ union px4_custom_mode {
float
data_float
;
};
PX4AutoPilotPlugin
::
PX4AutoPilotPlugin
(
void
)
PX4AutoPilotPlugin
::
PX4AutoPilotPlugin
(
QObject
*
parent
)
:
AutoPilotPlugin
(
parent
)
{
}
...
...
@@ -165,7 +167,7 @@ QString PX4AutoPilotPlugin::getShortModeText(uint8_t baseMode, uint32_t customMo
mode
=
"|OFFBOARD"
;
}
}
else
{
mode
=
AutoPilotPlugin
::
getInstanceForAutoPilotPlugin
(
MAV_AUTOPILOT_GENERIC
)
->
getShortModeText
(
baseMode
,
customMode
);
mode
=
qgcApp
()
->
singletonAutoPilotPluginManager
()
->
getInstanceForAutoPilotPlugin
(
MAV_AUTOPILOT_GENERIC
)
->
getShortModeText
(
baseMode
,
customMode
);
}
return
mode
;
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
View file @
62550909
...
...
@@ -35,7 +35,7 @@ class PX4AutoPilotPlugin : public AutoPilotPlugin
Q_OBJECT
public:
PX4AutoPilotPlugin
(
void
);
PX4AutoPilotPlugin
(
QObject
*
parent
);
virtual
QList
<
VehicleComponent
*>
getVehicleComponents
(
UASInterface
*
uas
)
const
;
virtual
QList
<
FullMode_t
>
getModes
(
void
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment