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
f10e77cb
Commit
f10e77cb
authored
Aug 29, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1800 from DonLakeFlyer/MultiVehicleManager
New MultiVehicleManager, Vehicle objects
parents
a8a115f2
ed2bcaa0
Changes
117
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
117 changed files
with
1356 additions
and
4162 deletions
+1356
-4162
QGCApplication.pro
QGCApplication.pro
+13
-10
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+9
-9
AutoPilotPlugin.h
src/AutoPilotPlugins/AutoPilotPlugin.h
+7
-6
AutoPilotPluginManager.cc
src/AutoPilotPlugins/AutoPilotPluginManager.cc
+6
-78
AutoPilotPluginManager.h
src/AutoPilotPlugins/AutoPilotPluginManager.h
+3
-17
GenericAutoPilotPlugin.cc
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
+4
-4
GenericAutoPilotPlugin.h
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
+1
-2
GenericParameterFacts.cc
src/AutoPilotPlugins/Generic/GenericParameterFacts.cc
+3
-3
GenericParameterFacts.h
src/AutoPilotPlugins/Generic/GenericParameterFacts.h
+1
-1
AirframeComponentController.cc
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
+2
-2
FlightModesComponentController.cc
src/AutoPilotPlugins/PX4/FlightModesComponentController.cc
+0
-1
PX4AutoPilotPlugin.cc
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+12
-13
PX4AutoPilotPlugin.h
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
+2
-3
PX4ParameterLoader.cc
src/AutoPilotPlugins/PX4/PX4ParameterLoader.cc
+3
-3
PX4ParameterLoader.h
src/AutoPilotPlugins/PX4/PX4ParameterLoader.h
+2
-2
PowerComponentController.cc
src/AutoPilotPlugins/PX4/PowerComponentController.cc
+1
-2
RadioComponentController.cc
src/AutoPilotPlugins/PX4/RadioComponentController.cc
+0
-1
SensorsComponentController.cc
src/AutoPilotPlugins/PX4/SensorsComponentController.cc
+2
-3
FactPanelController.cc
src/FactSystem/FactControls/FactPanelController.cc
+5
-6
FactPanelController.h
src/FactSystem/FactControls/FactPanelController.h
+3
-3
FactSystem.cc
src/FactSystem/FactSystem.cc
+0
-2
FactSystemTestBase.cc
src/FactSystem/FactSystemTestBase.cc
+9
-35
FactSystemTestBase.h
src/FactSystem/FactSystemTestBase.h
+0
-2
FactSystemTestGeneric.cc
src/FactSystem/FactSystemTestGeneric.cc
+1
-8
FactSystemTestPX4.cc
src/FactSystem/FactSystemTestPX4.cc
+1
-8
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+17
-17
ParameterLoader.h
src/FactSystem/ParameterLoader.h
+3
-3
QGCApplication.cc
src/QGCApplication.cc
+12
-8
QGCQuickWidget.cc
src/QGCQuickWidget.cc
+2
-0
MavManager.cc
src/QmlControls/MavManager.cc
+12
-19
MavManager.h
src/QmlControls/MavManager.h
+3
-2
ParameterEditorController.cc
src/QmlControls/ParameterEditorController.cc
+0
-1
MultiVehicleManager.cc
src/Vehicle/MultiVehicleManager.cc
+231
-0
MultiVehicleManager.h
src/Vehicle/MultiVehicleManager.h
+106
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+141
-0
Vehicle.h
src/Vehicle/Vehicle.h
+95
-0
SetupView.cc
src/VehicleSetup/SetupView.cc
+1
-51
SetupView.h
src/VehicleSetup/SetupView.h
+0
-19
SetupView.qml
src/VehicleSetup/SetupView.qml
+17
-18
SetupViewTest.cc
src/VehicleSetup/SetupViewTest.cc
+8
-9
VehicleSummary.qml
src/VehicleSetup/VehicleSummary.qml
+11
-9
CustomCommandWidgetController.cc
src/ViewWidgets/CustomCommandWidgetController.cc
+2
-2
ViewWidgetController.cc
src/ViewWidgets/ViewWidgetController.cc
+18
-38
ViewWidgetController.h
src/ViewWidgets/ViewWidgetController.h
+2
-3
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+4
-49
MockLink.params
src/comm/MockLink.params
+1
-1
JoystickInput.cc
src/input/JoystickInput.cc
+15
-27
JoystickInput.h
src/input/JoystickInput.h
+6
-5
Mouse6dofInput.cpp
src/input/Mouse6dofInput.cpp
+15
-19
Mouse6dofInput.h
src/input/Mouse6dofInput.h
+15
-13
FileManagerTest.cc
src/qgcunittest/FileManagerTest.cc
+7
-7
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+4
-11
MavlinkLogTest.cc
src/qgcunittest/MavlinkLogTest.cc
+4
-5
PX4RCCalibrationTest.cc
src/qgcunittest/PX4RCCalibrationTest.cc
+8
-10
UASUnitTest.cc
src/qgcunittest/UASUnitTest.cc
+0
-299
UASUnitTest.h
src/qgcunittest/UASUnitTest.h
+0
-57
FileManager.cc
src/uas/FileManager.cc
+6
-5
FileManager.h
src/uas/FileManager.h
+4
-2
QGCMAVLinkUASFactory.cc
src/uas/QGCMAVLinkUASFactory.cc
+0
-30
QGCMAVLinkUASFactory.h
src/uas/QGCMAVLinkUASFactory.h
+0
-29
UAS.cc
src/uas/UAS.cc
+58
-223
UAS.h
src/uas/UAS.h
+5
-31
UASInterface.h
src/uas/UASInterface.h
+0
-42
UASManager.cc
src/uas/UASManager.cc
+4
-222
UASManager.h
src/uas/UASManager.h
+0
-112
UASManagerInterface.h
src/uas/UASManagerInterface.h
+0
-30
UASMessageHandler.cc
src/uas/UASMessageHandler.cc
+7
-5
UASMessageHandler.h
src/uas/UASMessageHandler.h
+4
-5
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+37
-36
UASWaypointManager.h
src/uas/UASWaypointManager.h
+4
-2
HDDisplay.cc
src/ui/HDDisplay.cc
+6
-6
HDDisplay.h
src/ui/HDDisplay.h
+4
-2
HSIDisplay.cc
src/ui/HSIDisplay.cc
+9
-14
HSIDisplay.h
src/ui/HSIDisplay.h
+3
-2
HUD.cc
src/ui/HUD.cc
+9
-8
HUD.h
src/ui/HUD.h
+3
-3
JoystickAxis.cc
src/ui/JoystickAxis.cc
+12
-6
JoystickAxis.h
src/ui/JoystickAxis.h
+3
-2
JoystickButton.cc
src/ui/JoystickButton.cc
+6
-4
JoystickButton.h
src/ui/JoystickButton.h
+2
-2
JoystickWidget.cc
src/ui/JoystickWidget.cc
+2
-2
MainWindow.cc
src/ui/MainWindow.cc
+14
-60
MainWindow.h
src/ui/MainWindow.h
+5
-7
MainWindow.ui
src/ui/MainWindow.ui
+0
-61
MapWidget.cc
src/ui/MapWidget.cc
+0
-1113
MapWidget.h
src/ui/MapWidget.h
+0
-195
MapWidget.ui
src/ui/MapWidget.ui
+0
-25
QGCMAVLinkInspector.cc
src/ui/QGCMAVLinkInspector.cc
+11
-10
QGCMAVLinkInspector.h
src/ui/QGCMAVLinkInspector.h
+4
-2
QGCMapRCToParamDialog.cpp
src/ui/QGCMapRCToParamDialog.cpp
+2
-2
QGCRGBDView.cc
src/ui/QGCRGBDView.cc
+6
-7
QGCRGBDView.h
src/ui/QGCRGBDView.h
+4
-2
QGCUASFileViewMulti.cc
src/ui/QGCUASFileViewMulti.cc
+25
-26
QGCUASFileViewMulti.h
src/ui/QGCUASFileViewMulti.h
+7
-7
QGCWaypointListMulti.cc
src/ui/QGCWaypointListMulti.cc
+24
-18
QGCWaypointListMulti.h
src/ui/QGCWaypointListMulti.h
+4
-4
WaypointList.cc
src/ui/WaypointList.cc
+0
-2
WaypointList.cc.orig
src/ui/WaypointList.cc.orig
+0
-642
FlightDisplay.cc
src/ui/flightdisplay/FlightDisplay.cc
+0
-1
Linecharts.cc
src/ui/linechart/Linecharts.cc
+9
-9
Linecharts.h
src/ui/linechart/Linecharts.h
+2
-2
MAV2DIcon.cc
src/ui/map/MAV2DIcon.cc
+2
-1
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+41
-31
QGCMapWidget.h
src/ui/map/QGCMapWidget.h
+6
-5
QGCMapDisplay.cc
src/ui/mapdisplay/QGCMapDisplay.cc
+0
-1
MainToolBar.cc
src/ui/toolbar/MainToolBar.cc
+17
-21
MainToolBar.h
src/ui/toolbar/MainToolBar.h
+2
-2
UASControlWidget.cc
src/ui/uas/UASControlWidget.cc
+34
-46
UASControlWidget.h
src/ui/uas/UASControlWidget.h
+8
-6
UASInfoWidget.cc
src/ui/uas/UASInfoWidget.cc
+18
-18
UASInfoWidget.h
src/ui/uas/UASInfoWidget.h
+4
-4
UASListWidget.cc
src/ui/uas/UASListWidget.cc
+15
-17
UASListWidget.h
src/ui/uas/UASListWidget.h
+5
-3
UASQuickView.cc
src/ui/uas/UASQuickView.cc
+6
-22
UASQuickView.h
src/ui/uas/UASQuickView.h
+4
-3
UASView.cc
src/ui/uas/UASView.cc
+30
-27
UASView.h
src/ui/uas/UASView.h
+9
-9
No files found.
QGCApplication.pro
View file @
f10e77cb
...
...
@@ -260,7 +260,6 @@ HEADERS += \
src
/
QmlControls
/
ParameterEditorController
.
h
\
src
/
QmlControls
/
ScreenToolsController
.
h
\
src
/
SerialPortIds
.
h
\
src
/
uas
/
QGCMAVLinkUASFactory
.
h
\
src
/
uas
/
FileManager
.
h
\
src
/
uas
/
UAS
.
h
\
src
/
uas
/
UASInterface
.
h
\
...
...
@@ -394,7 +393,6 @@ SOURCES += \
src
/
QmlControls
/
MavManager
.
cc
\
src
/
QmlControls
/
ParameterEditorController
.
cc
\
src
/
QmlControls
/
ScreenToolsController
.
cc
\
src
/
uas
/
QGCMAVLinkUASFactory
.
cc
\
src
/
uas
/
FileManager
.
cc
\
src
/
uas
/
UAS
.
cc
\
src
/
uas
/
UASManager
.
cc
\
...
...
@@ -559,15 +557,12 @@ SOURCES += \
#
INCLUDEPATH
+=
\
src
/
AutoPilotPlugins
/
PX4
\
src
/
FirmwarePlugin
\
src
/
Vehicle
\
src
/
VehicleSetup
\
src
/
AutoPilotPlugins
/
PX4
\
HEADERS
+=
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
h
\
src
/
FirmwarePlugin
/
FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPluginManager
.
h
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
h
\
...
...
@@ -587,6 +582,12 @@ HEADERS+= \
src
/
AutoPilotPlugins
/
PX4
/
SafetyComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponentController
.
h
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
h
\
src
/
FirmwarePlugin
/
FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
Vehicle
/
MultiVehicleManager
.
h
\
src
/
Vehicle
/
Vehicle
.
h
\
src
/
VehicleSetup
/
SetupView
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
...
...
@@ -600,9 +601,6 @@ HEADERS += \
}
SOURCES
+=
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
cc
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
AutoPilotPluginManager
.
cc
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
cc
\
...
...
@@ -622,6 +620,11 @@ SOURCES += \
src
/
AutoPilotPlugins
/
PX4
/
SafetyComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponentController
.
cc
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
cc
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
src
/
Vehicle
/
MultiVehicleManager
.
cc
\
src
/
Vehicle
/
Vehicle
.
cc
\
src
/
VehicleSetup
/
SetupView
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
...
...
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
f10e77cb
...
...
@@ -30,16 +30,16 @@
#include "MainWindow.h"
#include "ParameterLoader.h"
AutoPilotPlugin
::
AutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
)
:
AutoPilotPlugin
::
AutoPilotPlugin
(
Vehicle
*
vehicle
,
QObject
*
parent
)
:
QObject
(
parent
),
_
uas
(
uas
),
_
vehicle
(
vehicle
),
_pluginReady
(
false
),
_setupComplete
(
false
)
{
Q_ASSERT
(
_uas
);
Q_ASSERT
(
vehicle
);
connect
(
_
uas
,
&
UASInterface
::
disconnected
,
this
,
&
AutoPilotPlugin
::
_uasDisconnected
);
connect
(
_
uas
,
&
UASInterface
::
armingChanged
,
this
,
&
AutoPilotPlugin
::
armedChanged
);
connect
(
_
vehicle
->
uas
()
,
&
UASInterface
::
disconnected
,
this
,
&
AutoPilotPlugin
::
_uasDisconnected
);
connect
(
_
vehicle
->
uas
()
,
&
UASInterface
::
armingChanged
,
this
,
&
AutoPilotPlugin
::
armedChanged
);
connect
(
this
,
&
AutoPilotPlugin
::
pluginReadyChanged
,
this
,
&
AutoPilotPlugin
::
_pluginReadyChanged
);
}
...
...
@@ -102,8 +102,8 @@ void AutoPilotPlugin::resetAllParametersToDefaults(void)
mavlink_message_t
msg
;
MAVLinkProtocol
*
mavlink
=
MAVLinkProtocol
::
instance
();
mavlink_msg_command_long_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
_
uas
->
getUASID
(),
0
,
MAV_CMD_PREFLIGHT_STORAGE
,
0
,
2
,
-
1
,
0
,
0
,
0
,
0
,
0
);
_
uas
->
sendMessage
(
msg
);
mavlink_msg_command_long_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
_
vehicle
->
uas
()
->
getUASID
(),
0
,
MAV_CMD_PREFLIGHT_STORAGE
,
0
,
2
,
-
1
,
0
,
0
,
0
,
0
,
0
);
_
vehicle
->
sendMessage
(
msg
);
}
void
AutoPilotPlugin
::
refreshAllParameters
(
void
)
...
...
@@ -169,7 +169,7 @@ const QMap<int, QMap<QString, QStringList> >& AutoPilotPlugin::getGroupMap(void)
void
AutoPilotPlugin
::
writeParametersToStream
(
QTextStream
&
stream
)
{
_getParameterLoader
()
->
writeParametersToStream
(
stream
,
_
uas
->
getUASName
());
_getParameterLoader
()
->
writeParametersToStream
(
stream
,
_
vehicle
->
uas
()
->
getUASName
());
}
QString
AutoPilotPlugin
::
readParametersFromStream
(
QTextStream
&
stream
)
...
...
@@ -179,5 +179,5 @@ QString AutoPilotPlugin::readParametersFromStream(QTextStream &stream)
bool
AutoPilotPlugin
::
armed
(
void
)
{
return
_
uas
->
isArmed
();
return
_
vehicle
->
uas
()
->
isArmed
();
}
src/AutoPilotPlugins/AutoPilotPlugin.h
View file @
f10e77cb
...
...
@@ -32,11 +32,12 @@
#include <QString>
#include <QQmlContext>
#include "UASInterface.h"
#include "VehicleComponent.h"
#include "FactSystem.h"
#include "Vehicle.h"
class
ParameterLoader
;
class
Vehicle
;
/// This is the base class for AutoPilot plugins
///
...
...
@@ -50,7 +51,7 @@ class AutoPilotPlugin : public QObject
Q_OBJECT
public:
AutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
);
AutoPilotPlugin
(
Vehicle
*
vehicle
,
QObject
*
parent
);
~
AutoPilotPlugin
();
/// true: plugin is ready for use, plugin should no longer be used
...
...
@@ -119,7 +120,7 @@ public:
bool
setupComplete
(
void
);
bool
armed
(
void
);
UASInterface
*
uas
(
void
)
{
return
_uas
;
}
Vehicle
*
vehicle
(
void
)
{
return
_vehicle
;
}
signals:
void
pluginReadyChanged
(
bool
pluginReady
);
...
...
@@ -134,9 +135,9 @@ protected:
/// Returns the ParameterLoader
virtual
ParameterLoader
*
_getParameterLoader
(
void
)
=
0
;
UASInterface
*
_uas
;
bool
_pluginReady
;
bool
_setupComplete
;
Vehicle
*
_vehicle
;
bool
_pluginReady
;
bool
_setupComplete
;
private
slots
:
void
_uasDisconnected
(
void
);
...
...
src/AutoPilotPlugins/AutoPilotPluginManager.cc
View file @
f10e77cb
...
...
@@ -27,98 +27,26 @@
#include "AutoPilotPluginManager.h"
#include "PX4/PX4AutoPilotPlugin.h"
#include "Generic/GenericAutoPilotPlugin.h"
#include "QGCApplication.h"
#include "QGCMessageBox.h"
#include "UASManager.h"
IMPLEMENT_QGC_SINGLETON
(
AutoPilotPluginManager
,
AutoPilotPluginManager
)
AutoPilotPluginManager
::
AutoPilotPluginManager
(
QObject
*
parent
)
:
QGCSingleton
(
parent
)
{
UASManagerInterface
*
uasMgr
=
UASManager
::
instance
();
Q_ASSERT
(
uasMgr
);
// We need to track uas coming and going so that we can instantiate plugins for each uas
connect
(
uasMgr
,
&
UASManagerInterface
::
UASCreated
,
this
,
&
AutoPilotPluginManager
::
_uasCreated
);
connect
(
uasMgr
,
SIGNAL
(
UASDeleted
(
UASInterface
*
)),
this
,
SLOT
(
_uasDeleted
(
UASInterface
*
)));
}
AutoPilotPluginManager
::~
AutoPilotPluginManager
()
{
#ifdef QT_DEBUG
foreach
(
MAV_AUTOPILOT
mavType
,
_pluginMap
.
keys
())
{
Q_ASSERT_X
(
_pluginMap
[
mavType
].
count
()
==
0
,
"AutoPilotPluginManager"
,
"LinkManager::_shutdown should have already closed all uas"
);
}
#endif
_pluginMap
.
clear
();
PX4AutoPilotPlugin
::
clearStaticData
();
GenericAutoPilotPlugin
::
clearStaticData
();
}
/// Create the plugin for this uas
void
AutoPilotPluginManager
::
_uasCreated
(
UASInterface
*
uas
)
{
Q_ASSERT
(
uas
);
MAV_AUTOPILOT
autopilotType
=
static_cast
<
MAV_AUTOPILOT
>
(
uas
->
getAutopilotType
());
int
uasId
=
uas
->
getUASID
();
Q_ASSERT
(
uasId
!=
0
);
if
(
_pluginMap
.
contains
(
autopilotType
))
{
Q_ASSERT_X
(
!
_pluginMap
[
autopilotType
].
contains
(
uasId
),
"AutoPilotPluginManager"
,
"Either we have duplicate UAS ids, or a UAS was not removed correctly."
);
}
AutoPilotPlugin
*
plugin
;
switch
(
autopilotType
)
{
case
MAV_AUTOPILOT_PX4
:
plugin
=
new
PX4AutoPilotPlugin
(
uas
,
this
);
Q_CHECK_PTR
(
plugin
);
_pluginMap
[
MAV_AUTOPILOT_PX4
][
uasId
]
=
QSharedPointer
<
AutoPilotPlugin
>
(
plugin
);
break
;
case
MAV_AUTOPILOT_GENERIC
:
default:
plugin
=
new
GenericAutoPilotPlugin
(
uas
,
this
);
Q_CHECK_PTR
(
plugin
);
_pluginMap
[
MAV_AUTOPILOT_GENERIC
][
uasId
]
=
QSharedPointer
<
AutoPilotPlugin
>
(
plugin
);
QGCMessageBox
::
warning
(
"Partial Support AutoPilot"
,
"Warning: You have connected QGroundControl to a firmware flight stack which is only partially supported. "
"If you are using the APM Flight Stack it is currently recommended to use Mission Planner, APM Planner or Tower as your ground control station."
);
}
}
/// Destroy the plugin associated with this uas
void
AutoPilotPluginManager
::
_uasDeleted
(
UASInterface
*
uas
)
AutoPilotPlugin
*
AutoPilotPluginManager
::
newAutopilotPluginForVehicle
(
Vehicle
*
vehicle
)
{
Q_ASSERT
(
uas
);
MAV_AUTOPILOT
autopilotType
=
_installedAutopilotType
(
static_cast
<
MAV_AUTOPILOT
>
(
uas
->
getAutopilotType
()));
int
uasId
=
uas
->
getUASID
();
Q_ASSERT
(
uasId
!=
0
);
if
(
_pluginMap
.
contains
(
autopilotType
)
&&
_pluginMap
[
autopilotType
].
contains
(
uasId
))
{
_pluginMap
[
autopilotType
][
uasId
].
clear
();
_pluginMap
[
autopilotType
].
remove
(
uasId
);
if
(
vehicle
->
firmwareType
()
==
MAV_AUTOPILOT_PX4
)
{
return
new
PX4AutoPilotPlugin
(
vehicle
,
vehicle
);
}
else
{
return
new
GenericAutoPilotPlugin
(
vehicle
,
vehicle
);
}
}
QSharedPointer
<
AutoPilotPlugin
>
AutoPilotPluginManager
::
getInstanceForAutoPilotPlugin
(
UASInterface
*
uas
)
{
Q_ASSERT
(
uas
);
MAV_AUTOPILOT
autopilotType
=
_installedAutopilotType
(
static_cast
<
MAV_AUTOPILOT
>
(
uas
->
getAutopilotType
()));
int
uasId
=
uas
->
getUASID
();
Q_ASSERT
(
uasId
!=
0
);
Q_ASSERT
(
_pluginMap
.
contains
(
autopilotType
));
Q_ASSERT
(
_pluginMap
[
autopilotType
].
contains
(
uasId
));
return
_pluginMap
[
autopilotType
][
uasId
];
}
/// If autopilot is not an installed plugin, returns MAV_AUTOPILOT_GENERIC
MAV_AUTOPILOT
AutoPilotPluginManager
::
_installedAutopilotType
(
MAV_AUTOPILOT
autopilot
)
{
return
_pluginMap
.
contains
(
autopilot
)
?
autopilot
:
MAV_AUTOPILOT_GENERIC
;
}
src/AutoPilotPlugins/AutoPilotPluginManager.h
View file @
f10e77cb
...
...
@@ -31,12 +31,9 @@
#include <QList>
#include <QString>
#include "UASInterface.h"
#include "VehicleComponent.h"
#include "AutoPilotPlugin.h"
#include "QGCSingleton.h"
#include "QGCMAVLink.h"
#include "Vehicle.h"
/// AutoPilotPlugin manager is a singleton which maintains the list of AutoPilotPlugin objects.
...
...
@@ -47,23 +44,12 @@ class AutoPilotPluginManager : public QGCSingleton
DECLARE_QGC_SINGLETON
(
AutoPilotPluginManager
,
AutoPilotPluginManager
)
public:
/// Returns the singleton AutoPilotPlugin instance for the specified uas. Returned as QSharedPointer
/// to prevent shutdown ordering problems with Qml destruction happening after Facts are destroyed.
/// @param uas Uas to get plugin for
QSharedPointer
<
AutoPilotPlugin
>
getInstanceForAutoPilotPlugin
(
UASInterface
*
uas
);
private
slots
:
void
_uasCreated
(
UASInterface
*
uas
);
void
_uasDeleted
(
UASInterface
*
uas
);
AutoPilotPlugin
*
newAutopilotPluginForVehicle
(
Vehicle
*
vehicle
);
private:
/// All access to singleton is through AutoPilotPluginManager::instance
AutoPilotPluginManager
(
QObject
*
parent
=
NULL
);
~
AutoPilotPluginManager
();
MAV_AUTOPILOT
_installedAutopilotType
(
MAV_AUTOPILOT
autopilot
);
QMap
<
MAV_AUTOPILOT
,
QMap
<
int
,
QSharedPointer
<
AutoPilotPlugin
>
>
>
_pluginMap
;
///< Map of AutoPilot plugins _pluginMap[MAV_TYPE][UASid]
};
#endif
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
View file @
f10e77cb
...
...
@@ -26,12 +26,12 @@
#include "GenericAutoPilotPlugin.h"
GenericAutoPilotPlugin
::
GenericAutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
)
:
AutoPilotPlugin
(
uas
,
parent
)
GenericAutoPilotPlugin
::
GenericAutoPilotPlugin
(
Vehicle
*
vehicle
,
QObject
*
parent
)
:
AutoPilotPlugin
(
vehicle
,
parent
)
{
Q_ASSERT
(
uas
);
Q_ASSERT
(
vehicle
);
_parameterFacts
=
new
GenericParameterFacts
(
this
,
uas
,
this
);
_parameterFacts
=
new
GenericParameterFacts
(
this
,
vehicle
,
this
);
Q_CHECK_PTR
(
_parameterFacts
);
connect
(
_parameterFacts
,
&
GenericParameterFacts
::
parametersReady
,
this
,
&
GenericAutoPilotPlugin
::
_parametersReady
);
...
...
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
View file @
f10e77cb
...
...
@@ -25,7 +25,6 @@
#define GENERICAUTOPILOT_H
#include "AutoPilotPlugin.h"
#include "AutoPilotPluginManager.h"
#include "GenericParameterFacts.h"
/// @file
...
...
@@ -38,7 +37,7 @@ class GenericAutoPilotPlugin : public AutoPilotPlugin
Q_OBJECT
public:
GenericAutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
GenericAutoPilotPlugin
(
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
// Overrides from AutoPilotPlugin
virtual
const
QVariantList
&
vehicleComponents
(
void
);
...
...
src/AutoPilotPlugins/Generic/GenericParameterFacts.cc
View file @
f10e77cb
...
...
@@ -28,8 +28,8 @@
#include <QDebug>
GenericParameterFacts
::
GenericParameterFacts
(
AutoPilotPlugin
*
autopilot
,
UASInterface
*
uas
,
QObject
*
parent
)
:
ParameterLoader
(
autopilot
,
uas
,
parent
)
GenericParameterFacts
::
GenericParameterFacts
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
)
:
ParameterLoader
(
autopilot
,
vehicle
,
parent
)
{
Q_ASSERT
(
uas
);
Q_ASSERT
(
vehicle
);
}
src/AutoPilotPlugins/Generic/GenericParameterFacts.h
View file @
f10e77cb
...
...
@@ -41,7 +41,7 @@ class GenericParameterFacts : public ParameterLoader
public:
/// @param uas Uas which this set of facts is associated with
GenericParameterFacts
(
AutoPilotPlugin
*
autopilot
,
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
GenericParameterFacts
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
/// Override from ParameterLoader
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
();
}
...
...
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
View file @
f10e77cb
...
...
@@ -27,7 +27,7 @@
#include "AirframeComponentController.h"
#include "AirframeComponentAirframes.h"
#include "QGCMAVLink.h"
#include "
UAS
Manager.h"
#include "
MultiVehicle
Manager.h"
#include "AutoPilotPluginManager.h"
#include "QGCApplication.h"
#include "QGCMessageBox.h"
...
...
@@ -98,7 +98,7 @@ AirframeComponentController::~AirframeComponentController()
void
AirframeComponentController
::
changeAutostart
(
void
)
{
if
(
UASManager
::
instance
()
->
getUASList
().
count
()
>
1
)
{
if
(
MultiVehicleManager
::
instance
()
->
vehicles
().
count
()
>
1
)
{
QGCMessageBox
::
warning
(
"Airframe Config"
,
"You cannot change airframe configuration while connected to multiple vehicles."
);
return
;
}
...
...
src/AutoPilotPlugins/PX4/FlightModesComponentController.cc
View file @
f10e77cb
...
...
@@ -26,7 +26,6 @@
#include "FlightModesComponentController.h"
#include "QGCMAVLink.h"
#include "UASManager.h"
#include "AutoPilotPluginManager.h"
#include <QVariant>
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
f10e77cb
...
...
@@ -23,7 +23,6 @@
#include "PX4AutoPilotPlugin.h"
#include "AutoPilotPluginManager.h"
#include "UASManager.h"
#include "PX4ParameterLoader.h"
#include "PX4AirframeLoader.h"
#include "FlightModesComponentController.h"
...
...
@@ -64,8 +63,8 @@ union px4_custom_mode {
float
data_float
;
};
PX4AutoPilotPlugin
::
PX4AutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
)
:
AutoPilotPlugin
(
uas
,
parent
),
PX4AutoPilotPlugin
::
PX4AutoPilotPlugin
(
Vehicle
*
vehicle
,
QObject
*
parent
)
:
AutoPilotPlugin
(
vehicle
,
parent
),
_parameterFacts
(
NULL
),
_airframeComponent
(
NULL
),
_radioComponent
(
NULL
),
...
...
@@ -75,15 +74,15 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) :
_powerComponent
(
NULL
),
_incorrectParameterVersion
(
false
)
{
Q_ASSERT
(
uas
);
Q_ASSERT
(
vehicle
);
_parameterFacts
=
new
PX4ParameterLoader
(
this
,
uas
,
this
);
_parameterFacts
=
new
PX4ParameterLoader
(
this
,
vehicle
,
this
);
Q_CHECK_PTR
(
_parameterFacts
);
connect
(
_parameterFacts
,
&
PX4ParameterLoader
::
parametersReady
,
this
,
&
PX4AutoPilotPlugin
::
_pluginReadyPreChecks
);
connect
(
_parameterFacts
,
&
PX4ParameterLoader
::
parameterListProgress
,
this
,
&
PX4AutoPilotPlugin
::
parameterListProgress
);
_airframeFacts
=
new
PX4AirframeLoader
(
this
,
uas
,
this
);
_airframeFacts
=
new
PX4AirframeLoader
(
this
,
_vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_airframeFacts
);
PX4ParameterLoader
::
loadParameterFactMetaData
();
...
...
@@ -105,7 +104,7 @@ void PX4AutoPilotPlugin::clearStaticData(void)
const
QVariantList
&
PX4AutoPilotPlugin
::
vehicleComponents
(
void
)
{
if
(
_components
.
count
()
==
0
&&
!
_incorrectParameterVersion
)
{
Q_ASSERT
(
_
uas
);
Q_ASSERT
(
_
vehicle
);
if
(
pluginReady
())
{
bool
noRCTransmitter
=
false
;
...
...
@@ -114,34 +113,34 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
noRCTransmitter
=
rcFact
->
value
().
toInt
()
==
1
;
}
_airframeComponent
=
new
AirframeComponent
(
_
uas
,
this
);
_airframeComponent
=
new
AirframeComponent
(
_
vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_airframeComponent
);
_airframeComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_airframeComponent
));
if
(
!
noRCTransmitter
)
{
_radioComponent
=
new
RadioComponent
(
_
uas
,
this
);
_radioComponent
=
new
RadioComponent
(
_
vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_radioComponent
);
_radioComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_radioComponent
));
_flightModesComponent
=
new
FlightModesComponent
(
_
uas
,
this
);
_flightModesComponent
=
new
FlightModesComponent
(
_
vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_flightModesComponent
);
_flightModesComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_flightModesComponent
));
}
_sensorsComponent
=
new
SensorsComponent
(
_
uas
,
this
);
_sensorsComponent
=
new
SensorsComponent
(
_
vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_sensorsComponent
);
_sensorsComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_sensorsComponent
));
_powerComponent
=
new
PowerComponent
(
_
uas
,
this
);
_powerComponent
=
new
PowerComponent
(
_
vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_powerComponent
);
_powerComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_powerComponent
));
_safetyComponent
=
new
SafetyComponent
(
_
uas
,
this
);
_safetyComponent
=
new
SafetyComponent
(
_
vehicle
->
uas
()
,
this
);
Q_CHECK_PTR
(
_safetyComponent
);
_safetyComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_safetyComponent
));
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
View file @
f10e77cb
...
...
@@ -25,8 +25,6 @@
#define PX4AUTOPILOT_H
#include "AutoPilotPlugin.h"
#include "AutoPilotPluginManager.h"
#include "UASInterface.h"
#include "PX4ParameterLoader.h"
#include "PX4AirframeLoader.h"
#include "AirframeComponent.h"
...
...
@@ -35,6 +33,7 @@
#include "SensorsComponent.h"
#include "SafetyComponent.h"
#include "PowerComponent.h"
#include "Vehicle.h"
#include <QImage>
...
...
@@ -47,7 +46,7 @@ class PX4AutoPilotPlugin : public AutoPilotPlugin
Q_OBJECT
public:
PX4AutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
);
PX4AutoPilotPlugin
(
Vehicle
*
vehicle
,
QObject
*
parent
);
~
PX4AutoPilotPlugin
();
// Overrides from AutoPilotPlugin
...
...
src/AutoPilotPlugins/PX4/PX4ParameterLoader.cc
View file @
f10e77cb
...
...
@@ -38,10 +38,10 @@ QGC_LOGGING_CATEGORY(PX4ParameterLoaderLog, "PX4ParameterLoaderLog")
bool
PX4ParameterLoader
::
_parameterMetaDataLoaded
=
false
;
QMap
<
QString
,
FactMetaData
*>
PX4ParameterLoader
::
_mapParameterName2FactMetaData
;
PX4ParameterLoader
::
PX4ParameterLoader
(
AutoPilotPlugin
*
autopilot
,
UASInterface
*
uas
,
QObject
*
parent
)
:
ParameterLoader
(
autopilot
,
uas
,
parent
)
PX4ParameterLoader
::
PX4ParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
)
:
ParameterLoader
(
autopilot
,
vehicle
,
parent
)
{
Q_ASSERT
(
uas
);
Q_ASSERT
(
vehicle
);
}
/// Converts a string to a typed QVariant
...
...
src/AutoPilotPlugins/PX4/PX4ParameterLoader.h
View file @
f10e77cb
...
...
@@ -31,8 +31,8 @@
#include "ParameterLoader.h"
#include "FactSystem.h"
#include "UASInterface.h"
#include "AutoPilotPlugin.h"
#include "Vehicle.h"
/// @file
/// @author Don Gagne <don@thegagnes.com>
...
...
@@ -47,7 +47,7 @@ class PX4ParameterLoader : public ParameterLoader
public:
/// @param uas Uas which this set of facts is associated with
PX4ParameterLoader
(
AutoPilotPlugin
*
aut
pilot
,
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
PX4ParameterLoader
(
AutoPilotPlugin
*
aut
opilot
,
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
/// Override from ParameterLoader
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
(
"SYS_AUTOSTART"
);
}
...
...
src/AutoPilotPlugins/PX4/PowerComponentController.cc
View file @
f10e77cb
...
...
@@ -26,7 +26,6 @@
#include "PowerComponentController.h"
#include "QGCMAVLink.h"
#include "UASManager.h"
#include "QGCMessageBox.h"
#include <QVariant>
...
...
@@ -71,7 +70,7 @@ void PowerComponentController::_handleUASTextMessage(int uasId, int compId, int
Q_UNUSED
(
compId
);
Q_UNUSED
(
severity
);
UASInterface
*
uas
=
_autopilot
->
uas
();
UASInterface
*
uas
=
_autopilot
->
vehicle
()
->
uas
();
Q_ASSERT
(
uas
);
if
(
uasId
!=
uas
->
getUASID
())
{
return
;
...
...
src/AutoPilotPlugins/PX4/RadioComponentController.cc
View file @
f10e77cb
...
...
@@ -26,7 +26,6 @@
/// @author Don Gagne <don@thegagnes.com
#include "RadioComponentController.h"
#include "UASManager.h"
#include "QGCMessageBox.h"
#include "AutoPilotPluginManager.h"
...
...
src/AutoPilotPlugins/PX4/SensorsComponentController.cc
View file @
f10e77cb
...
...
@@ -26,7 +26,6 @@
#include "SensorsComponentController.h"
#include "QGCMAVLink.h"
#include "UASManager.h"
#include "QGCMessageBox.h"
#include <QVariant>
...
...
@@ -208,7 +207,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
Q_UNUSED
(
compId
);
Q_UNUSED
(
severity
);
UASInterface
*
uas
=
_autopilot
->
uas
();
UASInterface
*
uas
=
_autopilot
->
vehicle
()
->
uas
();
Q_ASSERT
(
uas
);
if
(
uasId
!=
uas
->
getUASID
())
{
return
;
...
...
@@ -427,7 +426,7 @@ void SensorsComponentController::_refreshParams(void)
bool
SensorsComponentController
::
fixedWing
(
void
)
{
UASInterface
*
uas
=
_autopilot
->
uas
();
UASInterface
*
uas
=
_autopilot
->
vehicle
()
->
uas
();
Q_ASSERT
(
uas
);
return
uas
->
getSystemType
()
==
MAV_TYPE_FIXED_WING
||
uas
->
getSystemType
()
==
MAV_TYPE_VTOL_DUOROTOR
||
...
...
src/FactSystem/FactControls/FactPanelController.cc
View file @
f10e77cb
...
...
@@ -22,8 +22,7 @@
======================================================================*/
#include "FactPanelController.h"
#include "UASManager.h"
#include "AutoPilotPluginManager.h"
#include "MultiVehicleManager.h"
#include "QGCMessageBox.h"
#include <QQmlEngine>
...
...
@@ -34,15 +33,15 @@
QGC_LOGGING_CATEGORY
(
FactPanelControllerLog
,
"FactPanelControllerLog"
)
FactPanelController
::
FactPanelController
(
void
)
:
_autopilot
(
NULL
),
_factPanel
(
NULL
)
{
// FIXME: Get rid of these asserts
_vehicle
=
MultiVehicleManager
::
instance
()
->
activeVehicle
();
Q_ASSERT
(
_vehicle
);
_uas
=
UASManager
::
instance
()
->
getActiveUAS
();
_uas
=
_vehicle
->
uas
();
Q_ASSERT
(
_uas
);
_autopilot
=
AutoPilotPluginManager
::
instance
()
->
getInstanceForAutoPilotPlugin
(
_uas
);
_autopilot
=
_vehicle
->
autopilotPlugin
(
);
Q_ASSERT
(
_autopilot
);
Q_ASSERT
(
_autopilot
->
pluginReady
());
...
...
src/FactSystem/FactControls/FactPanelController.h
View file @
f10e77cb
...
...
@@ -32,7 +32,6 @@
#include "UASInterface.h"
#include "AutoPilotPlugin.h"
#include "UASManagerInterface.h"
#include "QGCLoggingCategory.h"
Q_DECLARE_LOGGING_CATEGORY
(
FactPanelControllerLog
)
...
...
@@ -62,8 +61,9 @@ protected:
/// Report a missing parameter to the FactPanel Qml element
void
_reportMissingParameter
(
int
componentId
,
const
QString
&
name
);
UASInterface
*
_uas
;
QSharedPointer
<
AutoPilotPlugin
>
_autopilot
;
Vehicle
*
_vehicle
;
UASInterface
*
_uas
;
AutoPilotPlugin
*
_autopilot
;
private
slots
:
void
_checkForMissingFactPanel
(
void
);
...
...
src/FactSystem/FactSystem.cc
View file @
f10e77cb
...
...
@@ -25,8 +25,6 @@
/// @author Don Gagne <don@thegagnes.com>
#include "FactSystem.h"
#include "UASManager.h"
#include "QGCApplication.h"
#include "FactPanelController.h"
#include <QtQml>
...
...
src/FactSystem/FactSystemTestBase.cc
View file @
f10e77cb
...
...
@@ -27,8 +27,7 @@
#include "FactSystemTestBase.h"
#include "LinkManager.h"
#include "MockLink.h"
#include "AutoPilotPluginManager.h"
#include "UASManager.h"
#include "MultiVehicleManager.h"
#include "QGCApplication.h"
#include "QGCMessageBox.h"
#include "QGCQuickWidget.h"
...
...
@@ -45,45 +44,20 @@ void FactSystemTestBase::_init(MAV_AUTOPILOT autopilot)
{
UnitTest
::
init
();
LinkManager
*
_linkMgr
=
LinkManager
::
instance
();
MockLink
*
link
=
new
MockLink
();
link
->
setAutopilotType
(
autopilot
);
_linkMgr
->
_addLink
(
link
);