Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize link performance metrics #732

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions src/cfclient/ui/main.py
Original file line number Diff line number Diff line change
@@ -99,6 +99,12 @@ class MainUI(QtWidgets.QMainWindow, main_window_class):
connectionFailedSignal = pyqtSignal(str, str)
disconnectedSignal = pyqtSignal(str)
linkQualitySignal = pyqtSignal(float)
latencySignal = pyqtSignal(float)
uplinkRSSISignal = pyqtSignal(float)
uplinkRateSignal = pyqtSignal(float)
downlinkRateSignal = pyqtSignal(float)
uplinkCongestionSignal = pyqtSignal(float)
downlinkCongestionSignal = pyqtSignal(float)

_input_device_error_signal = pyqtSignal(str)
_input_discovery_signal = pyqtSignal(object)
@@ -226,10 +232,36 @@ def __init__(self, *args):
self.batteryBar.setTextVisible(False)
self.linkQualityBar.setTextVisible(False)

# Connect link quality feedback
# Connect radio link statistics callbacks
self.cf.link_quality_updated.add_callback(self.linkQualitySignal.emit)
self.cf.link_statistics.latency.latency_updated.add_callback(self.latencySignal.emit)
self.cf.uplink_rssi_updated.add_callback(self.uplinkRSSISignal.emit)
self.cf.uplink_rate_updated.add_callback(self.uplinkRateSignal.emit)
self.cf.downlink_rate_updated.add_callback(self.downlinkRateSignal.emit)
self.cf.uplink_congestion_updated.add_callback(self.uplinkCongestionSignal.emit)
self.cf.downlink_congestion_updated.add_callback(self.downlinkCongestionSignal.emit)

self.linkQualitySignal.connect(
lambda percentage: self.linkQualityBar.setValue(int(percentage)))
lambda percentage: self.linkQualityBar.setValue(int(percentage))
)
self.latencySignal.connect(
lambda latency: self.latencyLineEdit.setText(f"{int(latency)} ms")
)
self.uplinkRSSISignal.connect(
lambda rssi: self.uplinkRSSILineEdit.setText(f"-{int(rssi)} dBm")
)
self.uplinkRateSignal.connect(
lambda rate: self.uplinkRateLineEdit.setText(f"{int(rate)} p/s")
)
self.downlinkRateSignal.connect(
lambda rate: self.downlinkRateLineEdit.setText(f"{int(rate)} p/s")
)
self.uplinkCongestionSignal.connect(
lambda congestion: self.uplinkCongestionBar.setValue(int(congestion*100))
)
self.downlinkCongestionSignal.connect(
lambda congestion: self.downlinkCongestionBar.setValue(int(congestion*100))
)

# Parse the log configuration files
self.logConfigReader = LogConfigReader(self.cf)
421 changes: 306 additions & 115 deletions src/cfclient/ui/main.ui
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1354</width>
<height>592</height>
<width>1634</width>
<height>771</height>
</rect>
</property>
<property name="windowTitle">
@@ -22,28 +22,8 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="6">
<widget class="QLabel" name="batteryLabel">
<property name="text">
<string>Battery:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="scanButton">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Scan</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QProgressBar" name="linkQualityBar">
<item row="1" column="7">
<widget class="QProgressBar" name="batteryBar">
<property name="minimumSize">
<size>
<width>30</width>
@@ -56,21 +36,30 @@
<height>16777215</height>
</size>
</property>
<property name="minimum">
<number>3400</number>
</property>
<property name="maximum">
<number>100</number>
<number>4180</number>
</property>
<property name="value">
<number>0</number>
<number>3800</number>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="textDirection">
<enum>QProgressBar::TopToBottom</enum>
</property>
<property name="format">
<string>Link quality %p%</string>
<string>Battery %v mV</string>
</property>
</widget>
</item>
<item row="0" column="4">
<item row="1" column="4">
<widget class="QPushButton" name="esButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -89,92 +78,97 @@
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLabel" name="label">
<property name="text">
<string> volts </string>
<item row="1" column="0">
<widget class="QComboBox" name="interfaceCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="connectButton">
<property name="minimumSize">
<size>
<width>80</width>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string/>
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Connect</string>
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QProgressBar" name="batteryBar">
<property name="minimumSize">
<item row="1" column="5">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>0</height>
<width>40</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="connectButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>16777215</height>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>3400</number>
</property>
<property name="maximum">
<number>4180</number>
</property>
<property name="value">
<number>3800</number>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
<property name="invertedAppearance">
<bool>false</bool>
<property name="toolTip">
<string/>
</property>
<property name="textDirection">
<enum>QProgressBar::TopToBottom</enum>
<property name="text">
<string>Connect</string>
</property>
<property name="format">
<string>Battery %v mV</string>
</widget>
</item>
<item row="1" column="11">
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</item>
<item row="1" column="6">
<widget class="QLabel" name="batteryLabel">
<property name="text">
<string>Battery:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="interfaceCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="1" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="minimumSize">
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>0</height>
<width>40</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
</spacer>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="scanButton">
<property name="minimumSize">
<size>
<width>250</width>
<height>16777215</height>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>false</bool>
<property name="text">
<string>Scan</string>
</property>
</widget>
</item>
<item row="0" column="8">
<item row="1" column="8">
<widget class="QLineEdit" name="_aff_volts">
<property name="enabled">
<bool>true</bool>
@@ -205,38 +199,235 @@
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QLabel" name="linkQualityLabel">
<item row="1" column="9">
<widget class="QLabel" name="label">
<property name="text">
<string>Link Quality:</string>
<string> volts </string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<item row="1" column="10">
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="5">
<widget class="QProgressBar" name="uplinkCongestionBar">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>40</height>
</size>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="downlinkLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Downlink</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Link statistics</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Pckt. Rate</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="uplinkRateLabel">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Uplink</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="linkQualityBar">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
<property name="format">
<string>Link quality %p%</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="uplinkRSSILabel">
<property name="text">
<string>RSSI</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QProgressBar" name="downlinkCongestionBar">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>40</height>
</size>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="uplinkCongestionLabel">
<property name="text">
<string>Congestion</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLineEdit" name="downlinkRateLineEdit">
<property name="minimumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLineEdit" name="uplinkRSSILineEdit">
<property name="minimumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>40</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="uplinkRateLineEdit">
<property name="minimumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="linkQualityLabel">
<property name="text">
<string>Link quality</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Latency</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="latencyLineEdit">
<property name="minimumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>40</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
@@ -307,8 +498,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1334</width>
<height>414</height>
<width>1614</width>
<height>545</height>
</rect>
</property>
<property name="sizePolicy">
@@ -359,8 +550,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1354</width>
<height>22</height>
<width>1634</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">