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
de5fc6a5
Commit
de5fc6a5
authored
Aug 26, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reimplement write and read timeout retransmission
Also move default component ID into data model
parent
1f76bbed
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
230 additions
and
316 deletions
+230
-316
QGCUASParamManager.cc
src/uas/QGCUASParamManager.cc
+4
-21
QGCUASParamManager.h
src/uas/QGCUASParamManager.h
+0
-1
UASParameterCommsMgr.cc
src/uas/UASParameterCommsMgr.cc
+175
-272
UASParameterCommsMgr.h
src/uas/UASParameterCommsMgr.h
+24
-21
UASParameterDataModel.cc
src/uas/UASParameterDataModel.cc
+22
-1
UASParameterDataModel.h
src/uas/UASParameterDataModel.h
+5
-0
No files found.
src/uas/QGCUASParamManager.cc
View file @
de5fc6a5
...
...
@@ -11,8 +11,7 @@ QGCUASParamManager::QGCUASParamManager(QObject *parent) :
QObject
(
parent
),
mav
(
NULL
),
paramDataModel
(
this
),
paramCommsMgr
(
NULL
),
defaultComponentId
(
-
1
)
paramCommsMgr
(
NULL
)
{
...
...
@@ -63,22 +62,7 @@ void QGCUASParamManager::clearAllPendingParams()
int
QGCUASParamManager
::
getDefaultComponentId
()
{
int
result
=
0
;
if
(
-
1
!=
defaultComponentId
)
return
defaultComponentId
;
QList
<
int
>
components
=
getComponentForParam
(
"SYS_AUTOSTART"
);
//TODO is this the best way to find the right component?
// Guard against multiple components responding - this will never show in practice
if
(
1
==
components
.
count
())
{
result
=
components
.
first
();
defaultComponentId
=
result
;
}
qDebug
()
<<
"Default compId: "
<<
result
;
return
result
;
return
paramDataModel
.
getDefaultComponentId
();
}
QList
<
int
>
QGCUASParamManager
::
getComponentForParam
(
const
QString
&
parameter
)
const
...
...
@@ -119,7 +103,6 @@ void QGCUASParamManager::requestParameterListIfEmpty()
if
(
mav
)
{
int
totalOnboard
=
paramDataModel
.
countOnboardParams
();
if
(
totalOnboard
<
2
)
{
//TODO arbitrary constant, maybe 0 is OK?
defaultComponentId
=
-
1
;
//reset this ...we have no idea what the default component ID is
requestParameterList
();
}
}
...
...
@@ -135,7 +118,7 @@ void QGCUASParamManager::setParameter(int compId, QString paramName, QVariant va
{
if
((
0
==
compId
)
||
(
-
1
==
compId
))
{
//attempt to get an actual component ID
compId
=
getDefaultComponentId
();
compId
=
paramDataModel
.
getDefaultComponentId
();
}
paramDataModel
.
updatePendingParamWithValue
(
compId
,
paramName
,
value
);
}
...
...
@@ -152,7 +135,7 @@ void QGCUASParamManager::setPendingParam(int compId, const QString& paramName,
{
if
((
0
==
compId
)
||
(
-
1
==
compId
))
{
//attempt to get an actual component ID
compId
=
getDefaultComponentId
();
compId
=
paramDataModel
.
getDefaultComponentId
();
}
paramDataModel
.
updatePendingParamWithValue
(
compId
,
paramName
,
value
);
}
...
...
src/uas/QGCUASParamManager.h
View file @
de5fc6a5
...
...
@@ -125,7 +125,6 @@ protected:
UASInterface
*
mav
;
///< The MAV this manager is controlling
UASParameterDataModel
paramDataModel
;
///< Shared data model of parameters
UASParameterCommsMgr
*
paramCommsMgr
;
///< Shared comms mgr for parameters
int
defaultComponentId
;
///< Cached default component ID
};
...
...
src/uas/UASParameterCommsMgr.cc
View file @
de5fc6a5
This diff is collapsed.
Click to expand it.
src/uas/UASParameterCommsMgr.h
View file @
de5fc6a5
...
...
@@ -32,8 +32,9 @@ public:
protected:
/** @brief Activate / deactivate parameter retransmission */
virtual
void
setRetransmissionGuardEnabled
(
bool
enabled
);
/** @brief activate the silence timer if there are unack'd reads or writes */
virtual
void
updateSilenceTimer
();
virtual
void
setParameterStatusMsg
(
const
QString
&
msg
,
ParamCommsStatusLevel_t
level
=
ParamCommsStatusLevel_OK
);
...
...
@@ -43,6 +44,12 @@ protected:
/** @brief clear transmissionMissingPackets and transmissionMissingWriteAckPackets */
void
clearRetransmissionLists
(
int
&
missingReadCount
,
int
&
missingWriteCount
);
/** @brief we are waiting for a response to this read param request */
virtual
void
markReadParamWaiting
(
int
compId
,
int
paramId
);
/** @brief we are waiting for a response to this write param request */
void
markWriteParamWaiting
(
int
compId
,
QString
paramName
,
QVariant
value
);
void
resendReadWriteRequests
();
void
resetAfterListReceive
();
...
...
@@ -75,8 +82,8 @@ public slots:
/** @brief Request list of parameters from MAV */
virtual
void
requestParameterList
();
/** @brief
Check for missing parameters
*/
virtual
void
retransmissionGuardTick
();
/** @brief
The max silence time expired
*/
virtual
void
silenceTimerExpired
();
/** @brief Request a single parameter update by name */
virtual
void
requestParameterUpdate
(
int
component
,
const
QString
&
parameter
);
...
...
@@ -88,28 +95,24 @@ public slots:
protected:
QMap
<
int
,
int
>
knownParamListSize
;
///< The known param list size for each component, by component ID
quint64
lastReceiveTime
;
///< The last time we received anything from our partner
quint64
lastSilenceTimerReset
;
UASInterface
*
mav
;
///< The MAV we're talking to
int
maxSilenceTimeout
;
///< If nothing received within this period of time, abandon resends
UASParameterDataModel
*
paramDataModel
;
// Communications management
QVector
<
bool
>
receivedParamsList
;
///< Successfully received parameters
QMap
<
int
,
QList
<
int
>*
>
missingReadPackets
;
///< Missing packets
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
missingWriteAckPackets
;
///< Missing write ACK packets
bool
transmissionListMode
;
///< Currently requesting list
QMap
<
int
,
bool
>
transmissionListSizeKnown
;
///< List size initialized?
bool
transmissionActive
;
///< Missing packets, working on list?
bool
persistParamsAfterSend
;
///< Copy all parameters to persistent storage after sending
quint64
transmissionTimeout
;
///< Timeout
QTimer
retransmissionTimer
;
///< Timer handling parameter retransmission
quint64
lastTimerReset
;
///< Last time the guard timer was reset, to prevent premature firing
int
retransmissionTimeout
;
///< Retransmission request timeout, in milliseconds
int
rewriteTimeout
;
///< Write request timeout, in milliseconds
int
retransmissionBurstRequestSize
;
///< Number of packets requested for retransmission per burst
quint64
listRecvTimeout
;
///< How long to wait for first parameter list response before re-requesting
// Status
QString
parameterStatusMsg
;
QMap
<
int
,
QSet
<
int
>*>
readsWaiting
;
///< All reads that have not yet been received, by component ID
int
retransmitBurstLimit
;
///< Number of packets requested for retransmission per burst
int
silenceTimeout
;
///< If nothing received within this period of time, start resends
QTimer
silenceTimer
;
///< Timer handling parameter retransmission
bool
transmissionListMode
;
///< Currently requesting list
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
writesWaiting
;
///< All writes that have not yet been ack'd, by component ID
};
...
...
src/uas/UASParameterDataModel.cc
View file @
de5fc6a5
...
...
@@ -9,7 +9,8 @@
#include "QGCMAVLink.h"
UASParameterDataModel
::
UASParameterDataModel
(
QObject
*
parent
)
:
QObject
(
parent
)
QObject
(
parent
),
defaultComponentId
(
-
1
)
{
onboardParameters
.
clear
();
pendingParameters
.
clear
();
...
...
@@ -199,6 +200,26 @@ bool UASParameterDataModel::getOnboardParamValue(int componentId, const QString&
return
false
;
}
int
UASParameterDataModel
::
getDefaultComponentId
()
{
int
result
=
0
;
if
(
-
1
!=
defaultComponentId
)
return
defaultComponentId
;
QList
<
int
>
components
=
getComponentForOnboardParam
(
"SYS_AUTOSTART"
);
//TODO is this the best way to find the right component?
// Guard against multiple components responding - this will never show in practice
if
(
1
==
components
.
count
())
{
result
=
components
.
first
();
defaultComponentId
=
result
;
}
qDebug
()
<<
"Default compId: "
<<
result
;
return
result
;
}
QList
<
int
>
UASParameterDataModel
::
getComponentForOnboardParam
(
const
QString
&
parameter
)
const
{
QList
<
int
>
components
;
...
...
src/uas/UASParameterDataModel.h
View file @
de5fc6a5
...
...
@@ -28,6 +28,9 @@ public:
virtual
QString
getParamDescription
(
const
QString
&
param
)
{
return
paramDescriptions
.
value
(
param
,
""
);
}
virtual
void
setParamDescriptions
(
const
QMap
<
QString
,
QString
>&
paramInfo
);
/** @brief Get the default component ID for the UAS */
virtual
int
getDefaultComponentId
();
//TODO make this method protected?
/** @brief Ensure that the data model is aware of this component
* @param compId Id of the component
...
...
@@ -113,6 +116,8 @@ public slots:
virtual
void
clearAllPendingParams
();
protected:
int
defaultComponentId
;
///< Cached default component ID
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
...
...
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