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
738f451b
Commit
738f451b
authored
Aug 02, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip decoupling the UI (view) from the param data model
parent
2a0a9430
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
189 additions
and
73 deletions
+189
-73
qgroundcontrol.pro
qgroundcontrol.pro
+4
-2
QGCUASParamManager.cc
src/uas/QGCUASParamManager.cc
+1
-0
QGCUASParamManager.h
src/uas/QGCUASParamManager.h
+7
-1
UAS.cc
src/uas/UAS.cc
+3
-0
UAS.h
src/uas/UAS.h
+12
-0
UASInterface.h
src/uas/UASInterface.h
+6
-0
UASParameterDataModel.cc
src/uas/UASParameterDataModel.cc
+26
-0
UASParameterDataModel.h
src/uas/UASParameterDataModel.h
+42
-0
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+82
-66
QGCParamWidget.h
src/ui/QGCParamWidget.h
+6
-4
No files found.
qgroundcontrol.pro
View file @
738f451b
...
...
@@ -468,7 +468,8 @@ HEADERS += src/MG.h \
src
/
ui
/
configuration
/
SerialSettingsDialog
.
h
\
src
/
ui
/
configuration
/
terminalconsole
.
h
\
src
/
ui
/
configuration
/
ApmHighlighter
.
h
\
src
/
ui
/
configuration
/
ApmFirmwareConfig
.
h
src
/
ui
/
configuration
/
ApmFirmwareConfig
.
h
\
src
/
uas
/
UASParameterDataModel
.
h
#
Google
Earth
is
only
supported
on
Mac
OS
and
Windows
with
Visual
Studio
Compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
HEADERS
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
h
...
...
@@ -683,7 +684,8 @@ SOURCES += src/main.cc \
src
/
ui
/
configuration
/
console
.
cpp
\
src
/
ui
/
configuration
/
SerialSettingsDialog
.
cc
\
src
/
ui
/
configuration
/
ApmHighlighter
.
cc
\
src
/
ui
/
configuration
/
ApmFirmwareConfig
.
cc
src
/
ui
/
configuration
/
ApmFirmwareConfig
.
cc
\
src
/
uas
/
UASParameterDataModel
.
cc
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
src/uas/QGCUASParamManager.cc
View file @
738f451b
...
...
@@ -12,6 +12,7 @@ QGCUASParamManager::QGCUASParamManager(UASInterface* uas, QWidget *parent) :
retransmissionBurstRequestSize
(
5
)
{
uas
->
setParamManager
(
this
);
paramDataModel
=
uas
->
getParamDataModel
();
}
...
...
src/uas/QGCUASParamManager.h
View file @
738f451b
...
...
@@ -7,6 +7,7 @@
#include <QVariant>
class
UASInterface
;
class
UASParameterDataModel
;
class
QGCUASParamManager
:
public
QWidget
{
...
...
@@ -62,9 +63,14 @@ public slots:
virtual
void
requestParameterList
()
=
0
;
protected:
//Parameter data model
UASInterface
*
mav
;
///< The MAV this widget is controlling
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
changedValues
;
///< Changed values
//
QMap<int, QMap<QString, QVariant>* > changedValues; ///< Changed values
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
parameters
;
///< All parameters
UASParameterDataModel
*
paramDataModel
;
///< Shared data model of parameters
// Communications management
QVector
<
bool
>
received
;
///< Successfully received parameters
QMap
<
int
,
QList
<
int
>*
>
transmissionMissingPackets
;
///< Missing packets
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
transmissionMissingWriteAckPackets
;
///< Missing write ACK packets
...
...
src/uas/UAS.cc
View file @
738f451b
...
...
@@ -131,6 +131,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramsOnceRequested
(
false
),
paramManager
(
NULL
),
paramDataModel
(
NULL
),
simulation
(
0
),
...
...
@@ -151,6 +152,8 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
componentMulti
[
i
]
=
false
;
}
paramDataModel
->
setUASID
(
this
->
getUASID
());
// Store a list of available actions for this UAS.
// Basically everything exposted as a SLOT with no return value or arguments.
...
...
src/uas/UAS.h
View file @
738f451b
...
...
@@ -492,6 +492,7 @@ protected: //COMMENTS FOR TEST UNIT
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
parameters
;
///< All parameters
bool
paramsOnceRequested
;
///< If the parameter list has been read at least once
QGCUASParamManager
*
paramManager
;
///< Parameter manager class
UASParameterDataModel
*
paramDataModel
;
///< The parameter data model for this UAS
/// SIMULATION
QGCHilLink
*
simulation
;
///< Hardware in the loop simulation link
...
...
@@ -519,10 +520,20 @@ public:
QGCUASParamManager
*
getParamManager
()
const
{
return
paramManager
;
}
/** @brief Get reference to the parameter data model (same one shared with the parameter manager) **/
UASParameterDataModel
*
getParamDataModel
()
{
return
paramDataModel
;
}
/** @brief Get the HIL simulation */
QGCHilLink
*
getHILSimulation
()
const
{
return
simulation
;
}
// TODO Will be removed
/** @brief Set reference to the param manager **/
void
setParamManager
(
QGCUASParamManager
*
manager
)
{
...
...
@@ -949,6 +960,7 @@ protected:
quint64
lastSendTimeSensors
;
QList
<
QAction
*>
actions
;
///< A list of actions that this UAS can perform.
protected
slots
:
/** @brief Write settings to disk */
void
writeSettings
();
...
...
src/uas/UASInterface.h
View file @
738f451b
...
...
@@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project
#include "LinkInterface.h"
#include "ProtocolInterface.h"
#include "UASParameterDataModel.h"
#include "UASWaypointManager.h"
#include "QGCUASParamManager.h"
#include "RadioCalibration/RadioCalibrationData.h"
...
...
@@ -152,8 +153,13 @@ public:
/** @brief Get reference to the waypoint manager **/
virtual
UASWaypointManager
*
getWaypointManager
(
void
)
=
0
;
/** @brief Access the parameter data model for this UAS (sans widget). This is the same parameter data model used by the parameter manager. **/
virtual
UASParameterDataModel
*
getParamDataModel
()
=
0
;
/** @brief Get reference to the param manager **/
virtual
QGCUASParamManager
*
getParamManager
()
const
=
0
;
// TODO Will be removed
/** @brief Set reference to the param manager **/
virtual
void
setParamManager
(
QGCUASParamManager
*
manager
)
=
0
;
...
...
src/uas/UASParameterDataModel.cc
0 → 100644
View file @
738f451b
#include "UASParameterDataModel.h"
#include <QVariant>
UASParameterDataModel
::
UASParameterDataModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
void
UASParameterDataModel
::
setPendingParameter
(
int
componentId
,
QString
&
key
,
QVariant
&
value
)
{
QMap
<
QString
,
QVariant
>
*
compPendingParams
=
pendingParameters
.
value
(
componentId
);
//TODO insert blank map if necessary
if
(
NULL
==
compPendingParams
)
{
pendingParameters
.
insert
(
componentId
,
new
QMap
<
QString
,
QVariant
>
());
compPendingParams
=
pendingParameters
.
value
(
componentId
);
}
compPendingParams
->
insert
(
key
,
value
);
}
src/uas/UASParameterDataModel.h
0 → 100644
View file @
738f451b
#ifndef UASPARAMETERDATAMODEL_H
#define UASPARAMETERDATAMODEL_H
#include <QMap>
#include <QObject>
#include <QVariant>
class
UASParameterDataModel
:
public
QObject
{
Q_OBJECT
public:
explicit
UASParameterDataModel
(
QObject
*
parent
=
0
);
/** @brief Write a new pending parameter value that may be eventually sent to the UAS */
virtual
void
setPendingParameter
(
int
componentId
,
QString
&
paramKey
,
QVariant
&
paramValue
)
=
0
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
getPendingParameters
()
{
return
pendingParameters
;
}
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
getOnboardParameters
()
{
return
onboardParameters
;
}
void
setUASID
(
int
anId
)
{
this
->
uasId
=
anId
;
}
signals:
public
slots
:
protected:
int
uasId
;
///< The UAS / MAV to which this data model pertains
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
pendingParameters
;
///< Changed values that have not yet been transmitted to the UAS, by component ID
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
onboardParameters
;
///< All parameters confirmed to be stored onboard the UAS, by component ID
};
#endif // UASPARAMETERDATAMODEL_H
src/ui/QGCParamWidget.cc
View file @
738f451b
This diff is collapsed.
Click to expand it.
src/ui/QGCParamWidget.h
View file @
738f451b
...
...
@@ -71,9 +71,9 @@ public slots:
/** @brief Add a component to the list */
void
addComponent
(
int
uas
,
int
component
,
QString
componentName
);
/** @brief Add a parameter to the list with retransmission / safety checks */
void
addParameter
(
int
uas
,
int
component
,
int
paramCount
,
int
paramId
,
QString
parameterName
,
QVariant
value
);
void
receivedParameterUpdate
(
int
uas
,
int
component
,
int
paramCount
,
int
paramId
,
QString
parameterName
,
QVariant
value
);
/** @brief Add a parameter to the list */
void
addParameter
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
void
receivedParameterUpdate
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
/** @brief Request list of parameters from MAV */
void
requestParameterList
();
/** @brief Request one single parameter */
...
...
@@ -92,9 +92,11 @@ public slots:
void
parameterItemChanged
(
QTreeWidgetItem
*
prev
,
int
column
);
/** @brief Store parameters to a file */
void
saveParameters
();
void
saveParameters
ToFile
();
/** @brief Load parameters from a file */
void
loadParameters
();
void
loadParametersFromFile
();
void
loadedParameterForComponent
(
int
componentId
,
QStringList
&
wpParams
);
/** @brief Check for missing parameters */
void
retransmissionGuardTick
();
...
...
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