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
f132b110
Commit
f132b110
authored
Oct 29, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ParameterLoader to Vehicle, ParameterMetaData to FirmwarePlugin
parent
8b0b8906
Changes
31
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
122 additions
and
312 deletions
+122
-312
QGCApplication.pro
QGCApplication.pro
+4
-6
APMAutoPilotPlugin.cc
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
+1
-9
APMAutoPilotPlugin.h
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h
+0
-2
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+11
-11
AutoPilotPlugin.h
src/AutoPilotPlugins/AutoPilotPlugin.h
+0
-2
AutoPilotPluginManager.cc
src/AutoPilotPlugins/AutoPilotPluginManager.cc
+0
-6
AutoPilotPluginManager.h
src/AutoPilotPlugins/AutoPilotPluginManager.h
+0
-1
GenericAutoPilotPlugin.cc
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
+0
-8
GenericAutoPilotPlugin.h
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
+0
-2
PX4AirframeLoader.cc
src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc
+0
-6
PX4AirframeLoader.h
src/AutoPilotPlugins/PX4/PX4AirframeLoader.h
+0
-1
PX4AutoPilotPlugin.cc
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+1
-10
PX4AutoPilotPlugin.h
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
+0
-2
FactSystem.h
src/FactSystem/FactSystem.h
+1
-1
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+2
-8
ParameterLoader.h
src/FactSystem/ParameterLoader.h
+0
-8
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+2
-14
APMFirmwarePlugin.h
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
+4
-3
APMParameterMetaData.cc
src/FirmwarePlugin/APM/APMParameterMetaData.cc
+12
-21
APMParameterMetaData.h
src/FirmwarePlugin/APM/APMParameterMetaData.h
+10
-13
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+5
-2
GenericFirmwarePlugin.cc
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.cc
+4
-12
GenericFirmwarePlugin.h
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.h
+2
-4
GenericParameterLoader.cc
src/FirmwarePlugin/Generic/GenericParameterLoader.cc
+0
-37
GenericParameterLoader.h
src/FirmwarePlugin/Generic/GenericParameterLoader.h
+0
-48
PX4FirmwarePlugin.cc
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
+2
-14
PX4FirmwarePlugin.h
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
+4
-3
PX4ParameterMetaData.cc
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
+28
-36
PX4ParameterMetaData.h
src/FirmwarePlugin/PX4/PX4ParameterMetaData.h
+10
-19
Vehicle.cc
src/Vehicle/Vehicle.cc
+14
-3
Vehicle.h
src/Vehicle/Vehicle.h
+5
-0
No files found.
QGCApplication.pro
View file @
f132b110
...
...
@@ -527,14 +527,13 @@ HEADERS+= \
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
h
\
src
/
FirmwarePlugin
/
FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
APMFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
APMParameter
Loader
.
h
\
src
/
FirmwarePlugin
/
APM
/
APMParameter
MetaData
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduCopterFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduPlaneFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduRoverFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
Generic
/
GenericParameterLoader
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4Parameter
Loader
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4Parameter
MetaData
.
h
\
src
/
Vehicle
/
MultiVehicleManager
.
h
\
src
/
Vehicle
/
Vehicle
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
...
...
@@ -568,15 +567,14 @@ SOURCES += \
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponentController
.
cc
\
src
/
FirmwarePlugin
/
APM
/
APMFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
APMParameter
Loader
.
cc
\
src
/
FirmwarePlugin
/
APM
/
APMParameter
MetaData
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduCopterFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduPlaneFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduRoverFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
cc
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
Generic
/
GenericParameterLoader
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4Parameter
Loader
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4Parameter
MetaData
.
cc
\
src
/
Vehicle
/
MultiVehicleManager
.
cc
\
src
/
Vehicle
/
Vehicle
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
...
...
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
View file @
f132b110
...
...
@@ -25,7 +25,7 @@
#include "AutoPilotPluginManager.h"
#include "QGCMessageBox.h"
#include "UAS.h"
#include "FirmwarePlugin/APM/APMParameter
Loader
.h" // FIXME: Hack
#include "FirmwarePlugin/APM/APMParameter
MetaData
.h" // FIXME: Hack
#include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack
/// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type.
...
...
@@ -34,9 +34,6 @@ APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) :
_incorrectParameterVersion
(
false
)
{
Q_ASSERT
(
vehicle
);
// This kicks off parameter load
_firmwarePlugin
->
getParameterLoader
(
this
,
vehicle
);
}
APMAutoPilotPlugin
::~
APMAutoPilotPlugin
()
...
...
@@ -44,11 +41,6 @@ APMAutoPilotPlugin::~APMAutoPilotPlugin()
}
void
APMAutoPilotPlugin
::
clearStaticData
(
void
)
{
APMParameterLoader
::
clearStaticData
();
}
const
QVariantList
&
APMAutoPilotPlugin
::
vehicleComponents
(
void
)
{
static
const
QVariantList
emptyList
;
...
...
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h
View file @
f132b110
...
...
@@ -39,8 +39,6 @@ public:
// Overrides from AutoPilotPlugin
virtual
const
QVariantList
&
vehicleComponents
(
void
);
static
void
clearStaticData
(
void
);
public
slots
:
// FIXME: This is public until we restructure AutoPilotPlugin/FirmwarePlugin/Vehicle
void
_parametersReadyPreChecks
(
bool
missingParameters
);
...
...
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
f132b110
...
...
@@ -109,34 +109,34 @@ void AutoPilotPlugin::resetAllParametersToDefaults(void)
void
AutoPilotPlugin
::
refreshAllParameters
(
void
)
{
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
refreshAllParameters
();
_
vehicle
->
getParameterLoader
(
)
->
refreshAllParameters
();
}
void
AutoPilotPlugin
::
refreshParameter
(
int
componentId
,
const
QString
&
name
)
{
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
refreshParameter
(
componentId
,
name
);
_
vehicle
->
getParameterLoader
(
)
->
refreshParameter
(
componentId
,
name
);
}
void
AutoPilotPlugin
::
refreshParametersPrefix
(
int
componentId
,
const
QString
&
namePrefix
)
{
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
refreshParametersPrefix
(
componentId
,
namePrefix
);
_
vehicle
->
getParameterLoader
(
)
->
refreshParametersPrefix
(
componentId
,
namePrefix
);
}
bool
AutoPilotPlugin
::
parameterExists
(
int
componentId
,
const
QString
&
name
)
{
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
parameterExists
(
componentId
,
name
);
return
_
vehicle
->
getParameterLoader
(
)
->
parameterExists
(
componentId
,
name
);
}
Fact
*
AutoPilotPlugin
::
getParameterFact
(
int
componentId
,
const
QString
&
name
)
{
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
getFact
(
componentId
,
name
);
return
_
vehicle
->
getParameterLoader
(
)
->
getFact
(
componentId
,
name
);
}
bool
AutoPilotPlugin
::
factExists
(
FactSystem
::
Provider_t
provider
,
int
componentId
,
const
QString
&
name
)
{
switch
(
provider
)
{
case
FactSystem
:
:
ParameterProvider
:
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
parameterExists
(
componentId
,
name
);
return
_
vehicle
->
getParameterLoader
(
)
->
parameterExists
(
componentId
,
name
);
// Other providers will go here once they come online
}
...
...
@@ -149,7 +149,7 @@ Fact* AutoPilotPlugin::getFact(FactSystem::Provider_t provider, int componentId,
{
switch
(
provider
)
{
case
FactSystem
:
:
ParameterProvider
:
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
getFact
(
componentId
,
name
);
return
_
vehicle
->
getParameterLoader
(
)
->
getFact
(
componentId
,
name
);
// Other providers will go here once they come online
}
...
...
@@ -160,20 +160,20 @@ Fact* AutoPilotPlugin::getFact(FactSystem::Provider_t provider, int componentId,
QStringList
AutoPilotPlugin
::
parameterNames
(
int
componentId
)
{
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
parameterNames
(
componentId
);
return
_
vehicle
->
getParameterLoader
(
)
->
parameterNames
(
componentId
);
}
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
AutoPilotPlugin
::
getGroupMap
(
void
)
{
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
getGroupMap
();
return
_
vehicle
->
getParameterLoader
(
)
->
getGroupMap
();
}
void
AutoPilotPlugin
::
writeParametersToStream
(
QTextStream
&
stream
)
{
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
writeParametersToStream
(
stream
,
_vehicle
->
uas
()
->
getUASName
());
_
vehicle
->
getParameterLoader
(
)
->
writeParametersToStream
(
stream
,
_vehicle
->
uas
()
->
getUASName
());
}
QString
AutoPilotPlugin
::
readParametersFromStream
(
QTextStream
&
stream
)
{
return
_
firmwarePlugin
->
getParameterLoader
(
this
,
_vehicle
)
->
readParametersFromStream
(
stream
);
return
_
vehicle
->
getParameterLoader
(
)
->
readParametersFromStream
(
stream
);
}
src/AutoPilotPlugins/AutoPilotPlugin.h
View file @
f132b110
...
...
@@ -114,8 +114,6 @@ public:
// Must be implemented by derived class
virtual
const
QVariantList
&
vehicleComponents
(
void
)
=
0
;
static
void
clearStaticData
(
void
);
// Property accessors
bool
parametersReady
(
void
)
{
return
_parametersReady
;
}
bool
missingParameters
(
void
)
{
return
_missingParameters
;
}
...
...
src/AutoPilotPlugins/AutoPilotPluginManager.cc
View file @
f132b110
...
...
@@ -37,12 +37,6 @@ AutoPilotPluginManager::AutoPilotPluginManager(QObject* parent) :
}
AutoPilotPluginManager
::~
AutoPilotPluginManager
()
{
PX4AutoPilotPlugin
::
clearStaticData
();
GenericAutoPilotPlugin
::
clearStaticData
();
}
AutoPilotPlugin
*
AutoPilotPluginManager
::
newAutopilotPluginForVehicle
(
Vehicle
*
vehicle
)
{
switch
(
vehicle
->
firmwareType
())
{
...
...
src/AutoPilotPlugins/AutoPilotPluginManager.h
View file @
f132b110
...
...
@@ -49,7 +49,6 @@ public:
private:
/// All access to singleton is through AutoPilotPluginManager::instance
AutoPilotPluginManager
(
QObject
*
parent
=
NULL
);
~
AutoPilotPluginManager
();
};
#endif
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
View file @
f132b110
...
...
@@ -31,14 +31,6 @@ GenericAutoPilotPlugin::GenericAutoPilotPlugin(Vehicle* vehicle, QObject* parent
AutoPilotPlugin
(
vehicle
,
parent
)
{
Q_ASSERT
(
vehicle
);
// This kicks off parameter load
_firmwarePlugin
->
getParameterLoader
(
this
,
vehicle
);
}
void
GenericAutoPilotPlugin
::
clearStaticData
(
void
)
{
// No Static data yet
}
const
QVariantList
&
GenericAutoPilotPlugin
::
vehicleComponents
(
void
)
...
...
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
View file @
f132b110
...
...
@@ -40,8 +40,6 @@ public:
// Overrides from AutoPilotPlugin
virtual
const
QVariantList
&
vehicleComponents
(
void
);
static
void
clearStaticData
(
void
);
public
slots
:
// FIXME: This is public until we restructure AutoPilotPlugin/FirmwarePlugin/Vehicle
...
...
src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc
View file @
f132b110
...
...
@@ -190,9 +190,3 @@ void PX4AirframeLoader::loadAirframeFactMetaData(void)
_airframeMetaDataLoaded
=
true
;
}
void
PX4AirframeLoader
::
clearStaticData
(
void
)
{
AirframeComponentAirframes
::
clear
();
_airframeMetaDataLoaded
=
false
;
}
src/AutoPilotPlugins/PX4/PX4AirframeLoader.h
View file @
f132b110
...
...
@@ -50,7 +50,6 @@ public:
PX4AirframeLoader
(
AutoPilotPlugin
*
autpilot
,
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
static
void
loadAirframeFactMetaData
(
void
);
static
void
clearStaticData
(
void
);
private:
enum
{
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
f132b110
...
...
@@ -28,7 +28,7 @@
#include "AirframeComponentController.h"
#include "QGCMessageBox.h"
#include "UAS.h"
#include "FirmwarePlugin/PX4/PX4Parameter
Loader
.h" // FIXME: Hack
#include "FirmwarePlugin/PX4/PX4Parameter
MetaData
.h" // FIXME: Hack
#include "FirmwarePlugin/PX4/PX4FirmwarePlugin.h" // FIXME: Hack
/// @file
...
...
@@ -81,9 +81,6 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) :
Q_CHECK_PTR
(
_airframeFacts
);
PX4AirframeLoader
::
loadAirframeFactMetaData
();
// This kicks off parameter load
_firmwarePlugin
->
getParameterLoader
(
this
,
vehicle
);
}
PX4AutoPilotPlugin
::~
PX4AutoPilotPlugin
()
...
...
@@ -91,12 +88,6 @@ PX4AutoPilotPlugin::~PX4AutoPilotPlugin()
delete
_airframeFacts
;
}
void
PX4AutoPilotPlugin
::
clearStaticData
(
void
)
{
PX4ParameterLoader
::
clearStaticData
();
PX4AirframeLoader
::
clearStaticData
();
}
const
QVariantList
&
PX4AutoPilotPlugin
::
vehicleComponents
(
void
)
{
if
(
_components
.
count
()
==
0
&&
!
_incorrectParameterVersion
)
{
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
View file @
f132b110
...
...
@@ -51,8 +51,6 @@ public:
// Overrides from AutoPilotPlugin
virtual
const
QVariantList
&
vehicleComponents
(
void
);
static
void
clearStaticData
(
void
);
// These methods should only be used by objects within the plugin
AirframeComponent
*
airframeComponent
(
void
)
{
return
_airframeComponent
;
}
RadioComponent
*
radioComponent
(
void
)
{
return
_radioComponent
;
}
...
...
src/FactSystem/FactSystem.h
View file @
f132b110
...
...
@@ -37,7 +37,7 @@
/// additional meta data associated with a Fact such as description, min/max ranges and so forth.
/// The FactValidator object is a QML validator which validates input according to the FactMetaData
/// settings. Client code can then use this system to expose sets of Facts to QML code. An example
/// of this is the PX4Parameter
Loader
onbject which is part of the PX4 AutoPilot plugin. It exposes
/// of this is the PX4Parameter
MetaData
onbject which is part of the PX4 AutoPilot plugin. It exposes
/// the firmware parameters to QML such that you can bind QML ui elements directly to parameters.
class
FactSystem
:
public
QGCSingleton
...
...
src/FactSystem/ParameterLoader.cc
View file @
f132b110
...
...
@@ -198,7 +198,7 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param
// Attempt to determine default component id
if
(
_defaultComponentId
==
FactSystem
::
defaultComponentId
&&
_defaultComponentIdParam
.
isEmpty
())
{
_defaultComponentIdParam
=
getDefaultComponentIdParam
();
_defaultComponentIdParam
=
_vehicle
->
firmwarePlugin
()
->
getDefaultComponentIdParam
();
}
if
(
!
_defaultComponentIdParam
.
isEmpty
()
&&
_defaultComponentIdParam
==
parameterName
)
{
_defaultComponentId
=
componentId
;
...
...
@@ -255,7 +255,7 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param
fact
->
_containerSetValue
(
value
);
if
(
setMetaData
)
{
_addMetaDataToFact
(
fact
);
_
vehicle
->
firmwarePlugin
()
->
addMetaDataToFact
(
fact
);
}
_dataMutex
.
unlock
();
...
...
@@ -293,12 +293,6 @@ void ParameterLoader::_valueUpdated(const QVariant& value)
qCDebug
(
ParameterLoaderLog
)
<<
"Set parameter (componentId:"
<<
componentId
<<
"name:"
<<
name
<<
value
<<
")"
;
}
void
ParameterLoader
::
_addMetaDataToFact
(
Fact
*
fact
)
{
FactMetaData
*
metaData
=
new
FactMetaData
(
fact
->
type
(),
this
);
fact
->
setMetaData
(
metaData
);
}
void
ParameterLoader
::
refreshAllParameters
(
void
)
{
_dataMutex
.
lock
();
...
...
src/FactSystem/ParameterLoader.h
View file @
f132b110
...
...
@@ -86,10 +86,6 @@ public:
QString
readParametersFromStream
(
QTextStream
&
stream
);
void
writeParametersToStream
(
QTextStream
&
stream
,
const
QString
&
name
);
/// Return the parameter for which the default component id is derived from. Return an empty
/// string is this is not available.
virtual
QString
getDefaultComponentIdParam
(
void
)
const
=
0
;
signals:
/// Signalled when the full set of facts are ready
...
...
@@ -102,10 +98,6 @@ signals:
void
restartWaitingParamTimer
(
void
);
protected:
/// Base implementation adds generic meta data based on variant type. Derived class can override to provide
/// more details meta data.
virtual
void
_addMetaDataToFact
(
Fact
*
fact
);
AutoPilotPlugin
*
_autopilot
;
Vehicle
*
_vehicle
;
MAVLinkProtocol
*
_mavlink
;
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
f132b110
...
...
@@ -141,7 +141,6 @@ QString APMCustomMode::modeString() const
APMFirmwarePlugin
::
APMFirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
,
_parameterLoader
(
NULL
)
{
_textSeverityAdjustmentNeeded
=
false
;
}
...
...
@@ -387,18 +386,7 @@ bool APMFirmwarePlugin::sendHomePositionToVehicle(void)
return
true
;
}
ParameterLoader
*
APMFirmwarePlugin
::
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
)
void
APMFirmwarePlugin
::
addMetaDataToFact
(
Fact
*
fact
)
{
if
(
!
_parameterLoader
)
{
_parameterLoader
=
new
APMParameterLoader
(
autopilotPlugin
,
vehicle
,
this
);
Q_CHECK_PTR
(
_parameterLoader
);
// FIXME: Why do I need SIGNAL/SLOT to make this work
connect
(
_parameterLoader
,
SIGNAL
(
parametersReady
(
bool
)),
autopilotPlugin
,
SLOT
(
_parametersReadyPreChecks
(
bool
)));
connect
(
_parameterLoader
,
&
APMParameterLoader
::
parameterListProgress
,
autopilotPlugin
,
&
APMAutoPilotPlugin
::
parameterListProgress
);
_parameterLoader
->
loadParameterFactMetaData
();
}
return
_parameterLoader
;
_parameterMetaData
.
addMetaDataToFact
(
fact
);
}
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
f132b110
...
...
@@ -29,7 +29,7 @@
#include "FirmwarePlugin.h"
#include "QGCLoggingCategory.h"
#include "APMParameter
Loader
.h"
#include "APMParameter
MetaData
.h"
Q_DECLARE_LOGGING_CATEGORY
(
APMFirmwarePluginLog
)
...
...
@@ -89,7 +89,8 @@ public:
virtual
void
adjustMavlinkMessage
(
mavlink_message_t
*
message
);
virtual
void
initializeVehicle
(
Vehicle
*
vehicle
);
virtual
bool
sendHomePositionToVehicle
(
void
);
virtual
ParameterLoader
*
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
);
virtual
void
addMetaDataToFact
(
Fact
*
fact
);
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
(
"SYSID_SW_TYPE"
);
}
protected:
/// All access to singleton is through stack specific implementation
...
...
@@ -103,7 +104,7 @@ private:
APMFirmwareVersion
_firmwareVersion
;
bool
_textSeverityAdjustmentNeeded
;
QList
<
APMCustomMode
>
_supportedModes
;
APMParameter
Loader
*
_parameterLoader
;
APMParameter
MetaData
_parameterMetaData
;
};
#endif
src/FirmwarePlugin/APM/APMParameter
Loader
.cc
→
src/FirmwarePlugin/APM/APMParameter
MetaData
.cc
View file @
f132b110
...
...
@@ -24,7 +24,7 @@
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "APMParameter
Loader
.h"
#include "APMParameter
MetaData
.h"
#include "QGCApplication.h"
#include "QGCLoggingCategory.h"
...
...
@@ -33,15 +33,15 @@
#include <QDir>
#include <QDebug>
QGC_LOGGING_CATEGORY
(
APMParameter
LoaderLog
,
"APMParameterLoader
Log"
)
QGC_LOGGING_CATEGORY
(
APMParameter
MetaDataLog
,
"APMParameterMetaData
Log"
)
bool
APMParameterLoader
::
_parameterMetaDataLoaded
=
false
;
QMap
<
QString
,
FactMetaData
*>
APMParameterLoader
::
_mapParameterName2FactMetaData
;
bool
APMParameterMetaData
::
_parameterMetaDataLoaded
=
false
;
QMap
<
QString
,
FactMetaData
*>
APMParameterMetaData
::
_mapParameterName2FactMetaData
;
APMParameter
Loader
::
APMParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
)
:
ParameterLoader
(
autopilot
,
vehicle
,
parent
)
APMParameter
MetaData
::
APMParameterMetaData
(
QObject
*
parent
)
:
QObject
(
parent
)
{
Q_ASSERT
(
vehicle
);
_loadParameterFactMetaData
(
);
}
/// Converts a string to a typed QVariant
...
...
@@ -49,7 +49,7 @@ APMParameterLoader::APMParameterLoader(AutoPilotPlugin* autopilot, Vehicle* vehi
/// @param type Type for Fact which dictates the QVariant type as well
/// @param convertOk Returned: true: conversion success, false: conversion failure
/// @return Returns the correctly type QVariant
QVariant
APMParameter
Loader
::
_stringToTypedVariant
(
const
QString
&
string
,
FactMetaData
::
ValueType_t
type
,
bool
*
convertOk
)
QVariant
APMParameter
MetaData
::
_stringToTypedVariant
(
const
QString
&
string
,
FactMetaData
::
ValueType_t
type
,
bool
*
convertOk
)
{
QVariant
var
(
string
);
...
...
@@ -81,7 +81,7 @@ QVariant APMParameterLoader::_stringToTypedVariant(const QString& string, FactMe
/// Load Parameter Fact meta data
///
/// The meta data comes from firmware parameters.xml file.
void
APMParameter
Loader
::
loadParameterFactMetaData
(
void
)
void
APMParameter
MetaData
::
_
loadParameterFactMetaData
(
void
)
{
if
(
_parameterMetaDataLoaded
)
{
return
;
...
...
@@ -94,20 +94,11 @@ void APMParameterLoader::loadParameterFactMetaData(void)
// has multiple sets of static meta data
}
void
APMParameterLoader
::
clearStaticData
(
void
)
{
foreach
(
QString
parameterName
,
_mapParameterName2FactMetaData
.
keys
())
{
delete
_mapParameterName2FactMetaData
[
parameterName
];
}
_mapParameterName2FactMetaData
.
clear
();
_parameterMetaDataLoaded
=
false
;
}
/// Override from FactLoad which connects the meta data to the fact
void
APMParameter
Loader
::
_
addMetaDataToFact
(
Fact
*
fact
)
void
APMParameter
MetaData
::
addMetaDataToFact
(
Fact
*
fact
)
{
// FIXME: Will need to switch here based on _vehicle->firmwareType() to pull right set of meta data
// Use generic meta data
ParameterLoader
::
_addMetaDataToFact
(
fact
);
FactMetaData
*
metaData
=
new
FactMetaData
(
fact
->
type
(),
fact
);
fact
->
setMetaData
(
metaData
);
}
src/FirmwarePlugin/APM/APMParameter
Loader
.h
→
src/FirmwarePlugin/APM/APMParameter
MetaData
.h
View file @
f132b110
...
...
@@ -21,15 +21,14 @@
======================================================================*/
#ifndef APMParameter
Loader
_H
#define APMParameter
Loader
_H
#ifndef APMParameter
MetaData
_H
#define APMParameter
MetaData
_H
#include <QObject>
#include <QMap>
#include <QXmlStreamReader>
#include <QLoggingCategory>
#include "ParameterLoader.h"
#include "FactSystem.h"
#include "AutoPilotPlugin.h"
#include "Vehicle.h"
...
...
@@ -37,24 +36,24 @@
/// @file
/// @author Don Gagne <don@thegagnes.com>
Q_DECLARE_LOGGING_CATEGORY
(
APMParameter
Loader
Log
)
Q_DECLARE_LOGGING_CATEGORY
(
APMParameter
MetaData
Log
)
/// Collection of Parameter Facts for PX4 AutoPilot
class
APMParameter
Loader
:
public
ParameterLoader
class
APMParameter
MetaData
:
public
QObject
{
Q_OBJECT
public:
/// @param uas Uas which this set of facts is associated with
APMParameter
Loader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
APMParameter
MetaData
(
QObject
*
parent
=
NULL
);
/// Override from ParameterLoader
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
(
"SYSID_SW_TYPE"
);
}
static
void
loadParameterFactMetaData
(
void
);
static
void
clearStaticData
(
void
);
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
(
"SYSID_SW_TYPE"
);
}
// Overrides from ParameterLoader
static
void
addMetaDataToFact
(
Fact
*
fact
);
private:
enum
{
XmlStateNone
,
...
...
@@ -65,10 +64,8 @@ private:
XmlStateDone
};
// Overrides from ParameterLoader
virtual
void
_addMetaDataToFact
(
Fact
*
fact
);
// Class methods
static
void
_loadParameterFactMetaData
(
void
);
static
QVariant
_stringToTypedVariant
(
const
QString
&
string
,
FactMetaData
::
ValueType_t
type
,
bool
*
convertOk
);
static
bool
_parameterMetaDataLoaded
;
///< true: parameter meta data already loaded
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
f132b110
...
...
@@ -105,8 +105,11 @@ public:
/// false: Do not send first item to vehicle, sequence numbers must be adjusted
virtual
bool
sendHomePositionToVehicle
(
void
)
=
0
;
/// Returns the ParameterLoader
virtual
ParameterLoader
*
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
)
=
0
;
/// Returns the parameter that is used to identify the default component
virtual
QString
getDefaultComponentIdParam
(
void
)
const
=
0
;
/// Adds the parameter meta data to the Fact
virtual
void
addMetaDataToFact
(
Fact
*
fact
)
=
0
;
protected:
FirmwarePlugin
(
QObject
*
parent
=
NULL
)
:
QGCSingleton
(
parent
)
{
}
...
...
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.cc
View file @
f132b110
...
...
@@ -33,7 +33,6 @@ IMPLEMENT_QGC_SINGLETON(GenericFirmwarePlugin, FirmwarePlugin)
GenericFirmwarePlugin
::
GenericFirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
,
_parameterLoader
(
NULL
)
{
}
...
...
@@ -121,16 +120,9 @@ bool GenericFirmwarePlugin::sendHomePositionToVehicle(void)
return
false
;
}
ParameterLoader
*
GenericFirmwarePlugin
::
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
)
void
GenericFirmwarePlugin
::
addMetaDataToFact
(
Fact
*
fact
)
{
if
(
!
_parameterLoader
)
{
_parameterLoader
=
new
GenericParameterLoader
(
autopilotPlugin
,
vehicle
,
this
);
Q_CHECK_PTR
(
_parameterLoader
);
// FIXME: Why do I need SIGNAL/SLOT to make this work
connect
(
_parameterLoader
,
SIGNAL
(
parametersReady
(
bool
)),
autopilotPlugin
,
SLOT
(
_parametersReadyPreChecks
(
bool
)));
connect
(
_parameterLoader
,
&
GenericParameterLoader
::
parameterListProgress
,
autopilotPlugin
,
&
GenericAutoPilotPlugin
::
parameterListProgress
);
}
return
_parameterLoader
;
// Add default meta data
FactMetaData
*
metaData
=
new
FactMetaData
(
fact
->
type
(),
fact
);
fact
->
setMetaData
(
metaData
);
}
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.h
View file @
f132b110
...
...
@@ -28,7 +28,6 @@
#define GenericFirmwarePlugin_H
#include "FirmwarePlugin.h"
#include "GenericParameterLoader.h"
class
GenericFirmwarePlugin
:
public
FirmwarePlugin
{
...
...
@@ -48,13 +47,12 @@ public:
virtual
void
adjustMavlinkMessage
(
mavlink_message_t
*
message
);
virtual
void
initializeVehicle
(
Vehicle
*
vehicle
);
virtual
bool
sendHomePositionToVehicle
(
void
);
virtual
ParameterLoader
*
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
);
virtual
void
addMetaDataToFact
(
Fact
*
fact
);
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
();
}
private:
/// All access to singleton is through AutoPilotPluginManager::instance
GenericFirmwarePlugin
(
QObject
*
parent
=
NULL
);
GenericParameterLoader
*
_parameterLoader
;
};
#endif
src/FirmwarePlugin/Generic/GenericParameterLoader.cc
deleted
100644 → 0
View file @
8b0b8906
/*=====================================================================
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/>.
======================================================================*/
#include "GenericParameterLoader.h"
GenericParameterLoader
::
GenericParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
)
:
ParameterLoader
(
autopilot
,
vehicle
,
parent
)
{
Q_ASSERT
(
vehicle
);
}
/// Override from ParameterLoader which connects the meta data to the fact
void
GenericParameterLoader
::
_addMetaDataToFact
(
Fact
*
fact
)
{
// Use generic meta data
ParameterLoader
::
_addMetaDataToFact
(
fact
);
}
src/FirmwarePlugin/Generic/GenericParameterLoader.h
deleted
100644 → 0
View file @
8b0b8906
/*=====================================================================
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 GenericParameterLoader_H
#define GenericParameterLoader_H
#include "ParameterLoader.h"
#include "FactSystem.h"
#include "AutoPilotPlugin.h"
#include "Vehicle.h"
class
GenericParameterLoader
:
public
ParameterLoader
{
Q_OBJECT
public:
/// @param uas Uas which this set of facts is associated with
GenericParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
/// Override from ParameterLoader
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
();
}
private:
// Overrides from ParameterLoader
virtual
void
_addMetaDataToFact
(
Fact
*
fact
);
};
#endif
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
f132b110
...
...
@@ -90,7 +90,6 @@ static const struct Modes2Name rgModes2Name[] = {
PX4FirmwarePlugin
::
PX4FirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
,
_parameterLoader
(
NULL
)
{
}
...
...
@@ -212,18 +211,7 @@ bool PX4FirmwarePlugin::sendHomePositionToVehicle(void)
return
false
;
}
ParameterLoader
*
PX4FirmwarePlugin
::
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
)
void
PX4FirmwarePlugin
::
addMetaDataToFact
(
Fact
*
fact
)
{
if
(
!
_parameterLoader
)
{
_parameterLoader
=
new
PX4ParameterLoader
(
autopilotPlugin
,
vehicle
,
this
);
Q_CHECK_PTR
(
_parameterLoader
);
// FIXME: Why do I need SIGNAL/SLOT to make this work
connect
(
_parameterLoader
,
SIGNAL
(
parametersReady
(
bool
)),
autopilotPlugin
,
SLOT
(
_parametersReadyPreChecks
(
bool
)));
connect
(
_parameterLoader
,
&
PX4ParameterLoader
::
parameterListProgress
,
autopilotPlugin
,
&
PX4AutoPilotPlugin
::
parameterListProgress
);
_parameterLoader
->
loadParameterFactMetaData
();
}
return
_parameterLoader
;
_parameterMetaData
.
addMetaDataToFact
(
fact
);
}
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
f132b110
...
...
@@ -28,7 +28,7 @@
#define PX4FirmwarePlugin_H
#include "FirmwarePlugin.h"
#include "PX4Parameter
Loader
.h"
#include "PX4Parameter
MetaData
.h"
class
PX4FirmwarePlugin
:
public
FirmwarePlugin
{
...
...
@@ -48,13 +48,14 @@ public:
virtual
void
adjustMavlinkMessage
(
mavlink_message_t
*
message
);
virtual
void
initializeVehicle
(
Vehicle
*
vehicle
);
virtual
bool
sendHomePositionToVehicle
(
void
);
virtual
ParameterLoader
*
getParameterLoader
(
AutoPilotPlugin
*
autopilotPlugin
,
Vehicle
*
vehicle
);
virtual
void
addMetaDataToFact
(
Fact
*
fact
);
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
(
"SYS_AUTOSTART"
);
}
private:
/// All access to singleton is through AutoPilotPluginManager::instance
PX4FirmwarePlugin
(
QObject
*
parent
=
NULL
);
PX4Parameter
Loader
*
_parameterLoader
;
PX4Parameter
MetaData
_parameterMetaData
;
};
#endif
src/FirmwarePlugin/PX4/PX4Parameter
Loader
.cc
→
src/FirmwarePlugin/PX4/PX4Parameter
MetaData
.cc
View file @
f132b110
This diff is collapsed.
Click to expand it.
src/FirmwarePlugin/PX4/PX4Parameter
Loader
.h
→
src/FirmwarePlugin/PX4/PX4Parameter
MetaData
.h
View file @
f132b110
...
...
@@ -21,15 +21,14 @@
======================================================================*/
#ifndef PX4P
ARAMETERLOADER
_H
#define PX4P
ARAMETERLOADER
_H
#ifndef PX4P
arameterMetaData
_H
#define PX4P
arameterMetaData
_H
#include <QObject>
#include <QMap>
#include <QXmlStreamReader>
#include <QLoggingCategory>
#include "ParameterLoader.h"
#include "FactSystem.h"
#include "AutoPilotPlugin.h"
#include "Vehicle.h"
...
...
@@ -37,24 +36,19 @@
/// @file
/// @author Don Gagne <don@thegagnes.com>
Q_DECLARE_LOGGING_CATEGORY
(
PX4Parameter
Loader
Log
)
Q_DECLARE_LOGGING_CATEGORY
(
PX4Parameter
MetaData
Log
)
/// Collection of Parameter Facts for PX4 AutoPilot
class
PX4Parameter
Loader
:
public
ParameterLoader
class
PX4Parameter
MetaData
:
public
QObject
{
Q_OBJECT
public:
/// @param uas Uas which this set of facts is associated with
PX4ParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
PX4ParameterMetaData
(
QObject
*
parent
=
NULL
);
void
addMetaDataToFact
(
Fact
*
fact
);
/// Override from ParameterLoader
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
(
"SYS_AUTOSTART"
);
}
static
void
loadParameterFactMetaData
(
void
);
static
void
clearStaticData
(
void
);
private:
enum
{
XmlStateNone
,
...
...
@@ -63,16 +57,13 @@ private:
XmlStateFoundGroup
,
XmlStateFoundParameter
,
XmlStateDone
};
// Overrides from ParameterLoader
virtual
void
_addMetaDataToFact
(
Fact
*
fact
);
};
// Class methods
static
void
_loadParameterFactMetaData
(
void
);
static
QVariant
_stringToTypedVariant
(
const
QString
&
string
,
FactMetaData
::
ValueType_t
type
,
bool
*
convertOk
);
static
bool
_parameterMetaDataLoaded
;
///< true: parameter meta data already loaded
static
QMap
<
QString
,
FactMetaData
*>
_mapParameterName2FactMetaData
;
///< Maps from a parameter name to FactMetaData
};
#endif
\ No newline at end of file
#endif
src/Vehicle/Vehicle.cc
View file @
f132b110
...
...
@@ -32,6 +32,7 @@
#include "JoystickManager.h"
#include "MissionManager.h"
#include "CoordinateVector.h"
#include "ParameterLoader.h"
QGC_LOGGING_CATEGORY
(
VehicleLog
,
"VehicleLog"
)
...
...
@@ -89,6 +90,7 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType,
,
_updateCount
(
0
)
,
_missionManager
(
NULL
)
,
_missionManagerInitialRequestComplete
(
false
)
,
_parameterLoader
(
NULL
)
,
_armed
(
false
)
,
_base_mode
(
0
)
,
_custom_mode
(
0
)
...
...
@@ -154,9 +156,13 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType,
_loadSettings
();
_missionManager
=
new
MissionManager
(
this
);
connect
(
_missionManager
,
&
MissionManager
::
error
,
this
,
&
Vehicle
::
_missionManagerError
);
_missionManager
=
new
MissionManager
(
this
);
connect
(
_missionManager
,
&
MissionManager
::
error
,
this
,
&
Vehicle
::
_missionManagerError
);
_parameterLoader
=
new
ParameterLoader
(
_autopilotPlugin
,
this
/* Vehicle */
,
this
/* parent */
);
connect
(
_parameterLoader
,
SIGNAL
(
parametersReady
(
bool
)),
_autopilotPlugin
,
SLOT
(
_parametersReadyPreChecks
(
bool
)));
connect
(
_parameterLoader
,
SIGNAL
(
parameterListProgress
(
float
)),
_autopilotPlugin
,
SLOT
(
parameterListProgress
(
float
)));
_firmwarePlugin
->
initializeVehicle
(
this
);
_sendMultipleTimer
.
start
(
_sendMessageMultipleIntraMessageDelay
);
...
...
@@ -1148,3 +1154,8 @@ void Vehicle::_communicationInactivityTimedOut(void)
linkMgr
->
disconnectLink
(
_links
[
i
].
data
());
}
}
ParameterLoader
*
Vehicle
::
getParameterLoader
(
void
)
{
return
_parameterLoader
;
}
src/Vehicle/Vehicle.h
View file @
f132b110
...
...
@@ -42,6 +42,7 @@ class UASInterface;
class
FirmwarePlugin
;
class
AutoPilotPlugin
;
class
MissionManager
;
class
ParameterLoader
;
Q_DECLARE_LOGGING_CATEGORY
(
VehicleLog
)
...
...
@@ -248,6 +249,8 @@ public:
double
waypointDistance
()
{
return
_waypointDistance
;
}
uint16_t
currentWaypoint
()
{
return
_currentWaypoint
;
}
unsigned
int
heartbeatTimeout
()
{
return
_currentHeartbeatTimeout
;
}
ParameterLoader
*
getParameterLoader
(
void
);
public
slots
:
void
setLatitude
(
double
latitude
);
...
...
@@ -411,6 +414,8 @@ private:
MissionManager
*
_missionManager
;
bool
_missionManagerInitialRequestComplete
;
ParameterLoader
*
_parameterLoader
;
bool
_armed
;
///< true: vehicle is armed
uint8_t
_base_mode
;
///< base_mode from HEARTBEAT
...
...
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