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
4348fabe
Commit
4348fabe
authored
Apr 10, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3179 from DonLakeFlyer/SeqLoss
Show mavlink sequence number packet loss in UI
parents
0f884579
393f1533
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
283 additions
and
63 deletions
+283
-63
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+9
-4
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+3
-2
UASInfo.ui
src/ui/UASInfo.ui
+215
-34
UASInfoWidget.cc
src/ui/uas/UASInfoWidget.cc
+45
-17
UASInfoWidget.h
src/ui/uas/UASInfoWidget.h
+11
-6
No files found.
src/comm/MAVLinkProtocol.cc
View file @
4348fabe
...
@@ -63,7 +63,11 @@ MAVLinkProtocol::MAVLinkProtocol(QGCApplication* app)
...
@@ -63,7 +63,11 @@ MAVLinkProtocol::MAVLinkProtocol(QGCApplication* app)
,
_linkMgr
(
NULL
)
,
_linkMgr
(
NULL
)
,
_multiVehicleManager
(
NULL
)
,
_multiVehicleManager
(
NULL
)
{
{
memset
(
&
totalReceiveCounter
,
0
,
sizeof
(
totalReceiveCounter
));
memset
(
&
totalLossCounter
,
0
,
sizeof
(
totalLossCounter
));
memset
(
&
totalErrorCounter
,
0
,
sizeof
(
totalErrorCounter
));
memset
(
&
currReceiveCounter
,
0
,
sizeof
(
currReceiveCounter
));
memset
(
&
currLossCounter
,
0
,
sizeof
(
currLossCounter
));
}
}
MAVLinkProtocol
::~
MAVLinkProtocol
()
MAVLinkProtocol
::~
MAVLinkProtocol
()
...
@@ -357,11 +361,12 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
...
@@ -357,11 +361,12 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
{
{
// Calculate new loss ratio
// Calculate new loss ratio
// Receive loss
// Receive loss
float
receiveLoss
=
(
double
)
currLossCounter
[
mavlinkChannel
]
/
(
double
)(
currReceiveCounter
[
mavlinkChannel
]
+
currLossCounter
[
mavlinkChannel
]);
float
receiveLoss
Percent
=
(
double
)
currLossCounter
[
mavlinkChannel
]
/
(
double
)(
currReceiveCounter
[
mavlinkChannel
]
+
currLossCounter
[
mavlinkChannel
]);
receiveLoss
*=
100.0
f
;
receiveLoss
Percent
*=
100.0
f
;
currLossCounter
[
mavlinkChannel
]
=
0
;
currLossCounter
[
mavlinkChannel
]
=
0
;
currReceiveCounter
[
mavlinkChannel
]
=
0
;
currReceiveCounter
[
mavlinkChannel
]
=
0
;
emit
receiveLossChanged
(
message
.
sysid
,
receiveLoss
);
emit
receiveLossPercentChanged
(
message
.
sysid
,
receiveLossPercent
);
emit
receiveLossTotalChanged
(
message
.
sysid
,
totalLossCounter
[
mavlinkChannel
]);
}
}
// The packet is emitted as a whole, as it is only 255 - 261 bytes short
// The packet is emitted as a whole, as it is only 255 - 261 bytes short
...
...
src/comm/MAVLinkProtocol.h
View file @
4348fabe
...
@@ -242,8 +242,9 @@ signals:
...
@@ -242,8 +242,9 @@ signals:
void
actionGuardChanged
(
bool
enabled
);
void
actionGuardChanged
(
bool
enabled
);
/** @brief Emitted if action request timeout changed */
/** @brief Emitted if action request timeout changed */
void
actionRetransmissionTimeoutChanged
(
int
ms
);
void
actionRetransmissionTimeoutChanged
(
int
ms
);
/** @brief Update the packet loss from one system */
void
receiveLossChanged
(
int
uasId
,
float
loss
);
void
receiveLossPercentChanged
(
int
uasId
,
float
lossPercent
);
void
receiveLossTotalChanged
(
int
uasId
,
int
totalLoss
);
/**
/**
* @brief Emitted if a new radio status packet received
* @brief Emitted if a new radio status packet received
...
...
src/ui/UASInfo.ui
View file @
4348fabe
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
2
30
</width>
<width>
2
43
</width>
<height>
161
</height>
<height>
161
</height>
</rect>
</rect>
</property>
</property>
...
@@ -16,8 +16,17 @@
...
@@ -16,8 +16,17 @@
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
<string
notr=
"true"
/>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"0,0,0,0,0,0,0,100"
columnstretch=
"0,0,0,0,0,0,0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"0,0,0,0,0,0,0,100,0"
columnstretch=
"0,0,0,0,0,0,0"
>
<property
name=
"margin"
>
<property
name=
"leftMargin"
>
<number>
3
</number>
</property>
<property
name=
"topMargin"
>
<number>
3
</number>
</property>
<property
name=
"rightMargin"
>
<number>
3
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
3
</number>
<number>
3
</number>
</property>
</property>
<property
name=
"spacing"
>
<property
name=
"spacing"
>
...
@@ -288,14 +297,14 @@
...
@@ -288,14 +297,14 @@
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"0"
>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_
3
"
>
<widget
class=
"QLabel"
name=
"label_
seq
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
M
CU Load
</string>
<string>
M
AV Seq Loss
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"1"
>
<item
row=
"3"
column=
"1"
>
<spacer
name=
"horizontalSpacer_
4
"
>
<spacer
name=
"horizontalSpacer_
seq
"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
</property>
</property>
...
@@ -311,7 +320,7 @@
...
@@ -311,7 +320,7 @@
</spacer>
</spacer>
</item>
</item>
<item
row=
"3"
column=
"2"
>
<item
row=
"3"
column=
"2"
>
<widget
class=
"QLabel"
name=
"
load
Label"
>
<widget
class=
"QLabel"
name=
"
seqLoss
Label"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
0
</string>
<string>
0
</string>
</property>
</property>
...
@@ -324,7 +333,7 @@
...
@@ -324,7 +333,7 @@
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"3"
>
<item
row=
"3"
column=
"3"
>
<widget
class=
"QLabel"
name=
"label_
9
"
>
<widget
class=
"QLabel"
name=
"label_
seq1
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
%
</string>
<string>
%
</string>
</property>
</property>
...
@@ -337,7 +346,7 @@
...
@@ -337,7 +346,7 @@
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"4"
colspan=
"2"
>
<item
row=
"3"
column=
"4"
colspan=
"2"
>
<widget
class=
"QProgressBar"
name=
"
load
Bar"
>
<widget
class=
"QProgressBar"
name=
"
seqLoss
Bar"
>
<property
name=
"sizePolicy"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
10
</horstretch>
<horstretch>
10
</horstretch>
...
@@ -373,44 +382,199 @@
...
@@ -373,44 +382,199 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"5"
column=
"0"
colspan=
"6"
>
<item
row=
"4"
column=
"0"
>
<widget
class=
"Line"
name=
"line"
>
<widget
class=
"QLabel"
name=
"label_seqcnt"
>
<property
name=
"text"
>
<string>
Seq Loss Cnt
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"1"
>
<spacer
name=
"horizontalSpacer_seqcnt"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
</property>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Maximum
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
13
</width>
<height>
15
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"4"
column=
"2"
>
<widget
class=
"QLabel"
name=
"seqcntLossLabel"
>
<property
name=
"text"
>
<string>
0
</string>
</property>
<property
name=
"textFormat"
>
<enum>
Qt::AutoText
</enum>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"7"
column=
"0"
colspan=
"7"
>
<item
row=
"4"
column=
"3"
>
<spacer
name=
"verticalSpacer"
>
<widget
class=
"QLabel"
name=
"label_seqcnt1"
>
<property
name=
"text"
>
<string></string>
</property>
<property
name=
"textFormat"
>
<enum>
Qt::AutoText
</enum>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item
row=
"4"
column=
"4"
colspan=
"2"
>
<widget
class=
"QProgressBar"
name=
"seqcntLossBar"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
10
</horstretch>
<verstretch>
18
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
100
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
20
</height>
</size>
</property>
<property
name=
"baseSize"
>
<size>
<width>
0
</width>
<height>
18
</height>
</size>
</property>
<property
name=
"value"
>
<number>
0
</number>
</property>
<property
name=
"textVisible"
>
<bool>
true
</bool>
</property>
<property
name=
"format"
>
<string>
%p%
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
MCU Load
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"1"
>
<spacer
name=
"horizontalSpacer_4"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::
Vertic
al
</enum>
<enum>
Qt::
Horizont
al
</enum>
</property>
</property>
<property
name=
"sizeType"
>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::
Expanding
</enum>
<enum>
QSizePolicy::
Maximum
</enum>
</property>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<size>
<width>
0
</width>
<width>
13
</width>
<height>
0
</height>
<height>
15
</height>
</size>
</size>
</property>
</property>
</spacer>
</spacer>
</item>
</item>
<item
row=
"
6"
column=
"0"
colspan=
"6
"
>
<item
row=
"
5"
column=
"2
"
>
<widget
class=
"QLabel"
name=
"
error
Label"
>
<widget
class=
"QLabel"
name=
"
load
Label"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
No error status received yet
</string>
<string>
0
</string>
</property>
<property
name=
"textFormat"
>
<enum>
Qt::AutoText
</enum>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"4"
column=
"0"
>
<item
row=
"5"
column=
"3"
>
<widget
class=
"QLabel"
name=
"label_9"
>
<property
name=
"text"
>
<string>
%
</string>
</property>
<property
name=
"textFormat"
>
<enum>
Qt::AutoText
</enum>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item
row=
"5"
column=
"4"
colspan=
"2"
>
<widget
class=
"QProgressBar"
name=
"loadBar"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
10
</horstretch>
<verstretch>
18
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
100
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
20
</height>
</size>
</property>
<property
name=
"baseSize"
>
<size>
<width>
0
</width>
<height>
18
</height>
</size>
</property>
<property
name=
"value"
>
<number>
0
</number>
</property>
<property
name=
"textVisible"
>
<bool>
true
</bool>
</property>
<property
name=
"format"
>
<string>
%p%
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
CPU Load
</string>
<string>
CPU Load
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"4"
column=
"2"
>
<item
row=
"6"
column=
"1"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
13
</width>
<height>
15
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"6"
column=
"2"
>
<widget
class=
"QLabel"
name=
"label_5"
>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
0
</string>
<string>
0
</string>
...
@@ -420,14 +584,14 @@
...
@@ -420,14 +584,14 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
4
"
column=
"3"
>
<item
row=
"
6
"
column=
"3"
>
<widget
class=
"QLabel"
name=
"label_10"
>
<widget
class=
"QLabel"
name=
"label_10"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
%
</string>
<string>
%
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
4
"
column=
"4"
colspan=
"2"
>
<item
row=
"
6
"
column=
"4"
colspan=
"2"
>
<widget
class=
"QProgressBar"
name=
"progressBar"
>
<widget
class=
"QProgressBar"
name=
"progressBar"
>
<property
name=
"maximumSize"
>
<property
name=
"maximumSize"
>
<size>
<size>
...
@@ -446,15 +610,32 @@
...
@@ -446,15 +610,32 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
4"
column=
"1
"
>
<item
row=
"
7"
column=
"0"
colspan=
"6
"
>
<
spacer
name=
"horizontalSpacer
"
>
<
widget
class=
"Line"
name=
"line
"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
</property>
</property>
</widget>
</item>
<item
row=
"8"
column=
"0"
colspan=
"6"
>
<widget
class=
"QLabel"
name=
"errorLabel"
>
<property
name=
"text"
>
<string>
No error status received yet
</string>
</property>
</widget>
</item>
<item
row=
"9"
column=
"0"
colspan=
"7"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Expanding
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<size>
<width>
13
</width>
<width>
0
</width>
<height>
15
</height>
<height>
0
</height>
</size>
</size>
</property>
</property>
</spacer>
</spacer>
...
...
src/ui/uas/UASInfoWidget.cc
View file @
4348fabe
...
@@ -46,10 +46,12 @@ This file is part of the PIXHAWK project
...
@@ -46,10 +46,12 @@ This file is part of the PIXHAWK project
UASInfoWidget
::
UASInfoWidget
(
const
QString
&
title
,
QAction
*
action
,
QWidget
*
parent
,
QString
name
)
UASInfoWidget
::
UASInfoWidget
(
const
QString
&
title
,
QAction
*
action
,
QWidget
*
parent
,
QString
name
)
:
QGCDockWidget
(
title
,
action
,
parent
)
:
QGCDockWidget
(
title
,
action
,
parent
)
,
_activeUAS
(
NULL
)
,
_seqLossPercent
(
0
)
,
_seqLossTotal
(
0
)
{
{
ui
.
setupUi
(
this
);
ui
.
setupUi
(
this
);
this
->
name
=
name
;
this
->
name
=
name
;
activeUAS
=
NULL
;
connect
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
UASInfoWidget
::
_activeVehicleChanged
);
connect
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
UASInfoWidget
::
_activeVehicleChanged
);
_activeVehicleChanged
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
());
_activeVehicleChanged
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
());
...
@@ -76,6 +78,9 @@ UASInfoWidget::UASInfoWidget(const QString& title, QAction* action, QWidget *par
...
@@ -76,6 +78,9 @@ UASInfoWidget::UASInfoWidget(const QString& title, QAction* action, QWidget *par
this
->
setVisible
(
false
);
this
->
setVisible
(
false
);
loadSettings
();
loadSettings
();
connect
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
(),
&
MAVLinkProtocol
::
receiveLossPercentChanged
,
this
,
&
UASInfoWidget
::
updateSeqLossPercent
);
connect
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
(),
&
MAVLinkProtocol
::
receiveLossTotalChanged
,
this
,
&
UASInfoWidget
::
updateSeqLossTotal
);
}
}
UASInfoWidget
::~
UASInfoWidget
()
UASInfoWidget
::~
UASInfoWidget
()
...
@@ -101,20 +106,20 @@ void UASInfoWidget::hideEvent(QHideEvent* event)
...
@@ -101,20 +106,20 @@ void UASInfoWidget::hideEvent(QHideEvent* event)
void
UASInfoWidget
::
_activeVehicleChanged
(
Vehicle
*
vehicle
)
void
UASInfoWidget
::
_activeVehicleChanged
(
Vehicle
*
vehicle
)
{
{
if
(
activeUAS
)
{
if
(
_
activeUAS
)
{
disconnect
(
activeUAS
,
&
UASInterface
::
batteryChanged
,
this
,
&
UASInfoWidget
::
updateBattery
);
disconnect
(
_
activeUAS
,
&
UASInterface
::
batteryChanged
,
this
,
&
UASInfoWidget
::
updateBattery
);
disconnect
(
activeUAS
,
&
UASInterface
::
dropRateChanged
,
this
,
&
UASInfoWidget
::
updateReceiveLoss
);
disconnect
(
_
activeUAS
,
&
UASInterface
::
dropRateChanged
,
this
,
&
UASInfoWidget
::
updateReceiveLoss
);
disconnect
(
static_cast
<
UAS
*>
(
activeUAS
),
&
UAS
::
loadChanged
,
this
,
&
UASInfoWidget
::
updateCPULoad
);
disconnect
(
static_cast
<
UAS
*>
(
_
activeUAS
),
&
UAS
::
loadChanged
,
this
,
&
UASInfoWidget
::
updateCPULoad
);
disconnect
(
activeUAS
,
&
UASInterface
::
errCountChanged
,
this
,
&
UASInfoWidget
::
updateErrorCount
);
disconnect
(
_
activeUAS
,
&
UASInterface
::
errCountChanged
,
this
,
&
UASInfoWidget
::
updateErrorCount
);
activeUAS
=
NULL
;
_
activeUAS
=
NULL
;
}
}
if
(
vehicle
)
{
if
(
vehicle
)
{
activeUAS
=
vehicle
->
uas
();
_
activeUAS
=
vehicle
->
uas
();
connect
(
activeUAS
,
&
UASInterface
::
batteryChanged
,
this
,
&
UASInfoWidget
::
updateBattery
);
connect
(
_
activeUAS
,
&
UASInterface
::
batteryChanged
,
this
,
&
UASInfoWidget
::
updateBattery
);
connect
(
activeUAS
,
&
UASInterface
::
dropRateChanged
,
this
,
&
UASInfoWidget
::
updateReceiveLoss
);
connect
(
_
activeUAS
,
&
UASInterface
::
dropRateChanged
,
this
,
&
UASInfoWidget
::
updateReceiveLoss
);
connect
(
static_cast
<
UAS
*>
(
activeUAS
),
&
UAS
::
loadChanged
,
this
,
&
UASInfoWidget
::
updateCPULoad
);
connect
(
static_cast
<
UAS
*>
(
_
activeUAS
),
&
UAS
::
loadChanged
,
this
,
&
UASInfoWidget
::
updateCPULoad
);
connect
(
activeUAS
,
&
UASInterface
::
errCountChanged
,
this
,
&
UASInfoWidget
::
updateErrorCount
);
connect
(
_
activeUAS
,
&
UASInterface
::
errCountChanged
,
this
,
&
UASInfoWidget
::
updateErrorCount
);
}
}
}
}
...
@@ -128,8 +133,8 @@ void UASInfoWidget::updateBattery(UASInterface* uas, double voltage, double curr
...
@@ -128,8 +133,8 @@ void UASInfoWidget::updateBattery(UASInterface* uas, double voltage, double curr
void
UASInfoWidget
::
updateErrorCount
(
int
uasid
,
QString
component
,
QString
device
,
int
count
)
void
UASInfoWidget
::
updateErrorCount
(
int
uasid
,
QString
component
,
QString
device
,
int
count
)
{
{
//qDebug() << __FILE__ << __LINE__ << activeUAS->getUASID() << "=" << uasid;
//qDebug() << __FILE__ << __LINE__ <<
_
activeUAS->getUASID() << "=" << uasid;
if
(
activeUAS
->
getUASID
()
==
uasid
)
{
if
(
_
activeUAS
->
getUASID
()
==
uasid
)
{
errors
.
remove
(
component
+
":"
+
device
);
errors
.
remove
(
component
+
":"
+
device
);
errors
.
insert
(
component
+
":"
+
device
,
count
);
errors
.
insert
(
component
+
":"
+
device
,
count
);
}
}
...
@@ -140,7 +145,7 @@ void UASInfoWidget::updateErrorCount(int uasid, QString component, QString devic
...
@@ -140,7 +145,7 @@ void UASInfoWidget::updateErrorCount(int uasid, QString component, QString devic
*/
*/
void
UASInfoWidget
::
updateCPULoad
(
UASInterface
*
uas
,
double
load
)
void
UASInfoWidget
::
updateCPULoad
(
UASInterface
*
uas
,
double
load
)
{
{
if
(
activeUAS
==
uas
)
{
if
(
_
activeUAS
==
uas
)
{
this
->
load
=
load
;
this
->
load
=
load
;
}
}
}
}
...
@@ -151,6 +156,24 @@ void UASInfoWidget::updateReceiveLoss(int uasId, float receiveLoss)
...
@@ -151,6 +156,24 @@ void UASInfoWidget::updateReceiveLoss(int uasId, float receiveLoss)
this
->
receiveLoss
=
this
->
receiveLoss
*
0.8
f
+
receiveLoss
*
0.2
f
;
this
->
receiveLoss
=
this
->
receiveLoss
*
0.8
f
+
receiveLoss
*
0.2
f
;
}
}
void
UASInfoWidget
::
updateSeqLossPercent
(
int
uasId
,
float
seqLossPercent
)
{
if
(
_activeUAS
&&
_activeUAS
->
getUASID
()
==
uasId
)
{
_seqLossPercent
=
_seqLossPercent
*
0.8
f
+
seqLossPercent
*
0.2
f
;
}
else
{
_seqLossPercent
=
0
;
}
}
void
UASInfoWidget
::
updateSeqLossTotal
(
int
uasId
,
int
seqLossTotal
)
{
if
(
_activeUAS
&&
_activeUAS
->
getUASID
()
==
uasId
)
{
_seqLossTotal
=
seqLossTotal
;
}
else
{
_seqLossTotal
=
0
;
}
}
/**
/**
The send loss is typically calculated on the GCS based on packets
The send loss is typically calculated on the GCS based on packets
that were received scrambled from the MAV
that were received scrambled from the MAV
...
@@ -169,14 +192,14 @@ void UASInfoWidget::setVoltage(UASInterface* uas, double voltage)
...
@@ -169,14 +192,14 @@ void UASInfoWidget::setVoltage(UASInterface* uas, double voltage)
void
UASInfoWidget
::
setChargeLevel
(
UASInterface
*
uas
,
double
chargeLevel
)
void
UASInfoWidget
::
setChargeLevel
(
UASInterface
*
uas
,
double
chargeLevel
)
{
{
if
(
activeUAS
==
uas
)
{
if
(
_
activeUAS
==
uas
)
{
this
->
chargeLevel
=
chargeLevel
;
this
->
chargeLevel
=
chargeLevel
;
}
}
}
}
void
UASInfoWidget
::
setTimeRemaining
(
UASInterface
*
uas
,
double
seconds
)
void
UASInfoWidget
::
setTimeRemaining
(
UASInterface
*
uas
,
double
seconds
)
{
{
if
(
activeUAS
==
uas
)
{
if
(
_
activeUAS
==
uas
)
{
this
->
timeRemaining
=
seconds
;
this
->
timeRemaining
=
seconds
;
}
}
}
}
...
@@ -192,6 +215,11 @@ void UASInfoWidget::refresh()
...
@@ -192,6 +215,11 @@ void UASInfoWidget::refresh()
ui
.
receiveLossBar
->
setValue
(
qMax
(
0
,
qMin
(
static_cast
<
int
>
(
receiveLoss
),
100
)));
ui
.
receiveLossBar
->
setValue
(
qMax
(
0
,
qMin
(
static_cast
<
int
>
(
receiveLoss
),
100
)));
ui
.
receiveLossLabel
->
setText
(
QString
::
number
(
receiveLoss
,
'f'
,
2
));
ui
.
receiveLossLabel
->
setText
(
QString
::
number
(
receiveLoss
,
'f'
,
2
));
ui
.
seqLossBar
->
setValue
(
qMax
(
0
,
qMin
(
static_cast
<
int
>
(
_seqLossPercent
),
100
)));
ui
.
seqLossLabel
->
setText
(
QString
::
number
(
_seqLossPercent
,
'f'
,
2
));
ui
.
seqcntLossLabel
->
setText
(
QString
::
number
(
_seqLossTotal
));
ui
.
sendLossBar
->
setValue
(
sendLoss
);
ui
.
sendLossBar
->
setValue
(
sendLoss
);
ui
.
sendLossLabel
->
setText
(
QString
::
number
(
sendLoss
,
'f'
,
2
));
ui
.
sendLossLabel
->
setText
(
QString
::
number
(
sendLoss
,
'f'
,
2
));
...
...
src/ui/uas/UASInfoWidget.h
View file @
4348fabe
...
@@ -61,6 +61,9 @@ public slots:
...
@@ -61,6 +61,9 @@ public slots:
*/
*/
void
updateReceiveLoss
(
int
uasId
,
float
receiveLoss
);
void
updateReceiveLoss
(
int
uasId
,
float
receiveLoss
);
void
updateSeqLossPercent
(
int
uasId
,
float
seqLoss
);
void
updateSeqLossTotal
(
int
uasId
,
int
seqLossTotal
);
/**
/**
* @brief Set the loss rate of packets sent from the MAV
* @brief Set the loss rate of packets sent from the MAV
* @param uasId UNUSED
* @param uasId UNUSED
...
@@ -79,7 +82,6 @@ public slots:
...
@@ -79,7 +82,6 @@ public slots:
protected:
protected:
UASInterface
*
activeUAS
;
// Configuration variables
// Configuration variables
int
voltageDecimals
;
int
voltageDecimals
;
...
@@ -110,6 +112,9 @@ private slots:
...
@@ -110,6 +112,9 @@ private slots:
private:
private:
Ui
::
uasInfo
ui
;
Ui
::
uasInfo
ui
;
UASInterface
*
_activeUAS
;
float
_seqLossPercent
;
int
_seqLossTotal
;
};
};
#endif // _UASINFOWIDGET_H_
#endif // _UASINFOWIDGET_H_
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