-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from cwruRobotics/add-ip-to-debug
Add IP Address to gui debug tab
- Loading branch information
Showing
10 changed files
with
93 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
(os.path.join('share', PACKAGE_NAME, 'udev_rules'), | ||
glob('udev_rules/*')) | ||
], | ||
install_requires=['setuptools', 'flake8==4.0.1', 'mypy >= 1.7', 'socket'], | ||
install_requires=['setuptools', 'flake8==4.0.1', 'mypy >= 1.7'], | ||
zip_safe=True, | ||
maintainer='Michael Carlstrom', | ||
maintainer_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
string ethernet_address "N/A" | ||
string wireless_address "N/A" | ||
# IPv4 Addresses never longer than 15 characters | ||
string<=15 ethernet_address "N/A" | ||
string<=15 wireless_address "N/A" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
from gui.widgets.arm import Arm | ||
from gui.widgets.ip_widget import IPWidget | ||
from gui.widgets.logger import Logger | ||
from gui.widgets.thruster_tester import ThrusterTester | ||
from gui.widgets.arm import Arm | ||
from PyQt6.QtWidgets import QHBoxLayout, QVBoxLayout, QWidget | ||
from PyQt6.QtCore import Qt | ||
|
||
|
||
class DebugWidget(QWidget): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
top_bar = QHBoxLayout() | ||
top_bar.addWidget(IPWidget(), alignment=Qt.AlignmentFlag.AlignTop | | ||
Qt.AlignmentFlag.AlignLeft) | ||
|
||
right_bar = QVBoxLayout() | ||
right_bar.addWidget(ThrusterTester()) | ||
right_bar.addWidget(Arm()) | ||
right_bar.addStretch() | ||
right_bar.setAlignment(Qt.AlignmentFlag.AlignRight) | ||
|
||
top_pane = QHBoxLayout() | ||
top_pane.addStretch(2) | ||
top_pane.addLayout(right_bar) | ||
top_bar.addStretch(2) | ||
top_bar.addLayout(right_bar) | ||
|
||
root_layout = QVBoxLayout(self) | ||
root_layout.addLayout(top_pane) | ||
root_layout = QVBoxLayout() | ||
root_layout.addLayout(top_bar) | ||
root_layout.addStretch() | ||
root_layout.addWidget(Logger()) | ||
self.setLayout(root_layout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from gui.event_nodes.subscriber import GUIEventSubscriber | ||
from PyQt6.QtCore import pyqtSignal, pyqtSlot | ||
from PyQt6.QtWidgets import QLabel, QVBoxLayout, QWidget | ||
|
||
from rov_msgs.msg import IPAddress | ||
|
||
|
||
class IPWidget(QWidget): | ||
|
||
signal = pyqtSignal(IPAddress) | ||
|
||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
self.signal.connect(self.refresh) | ||
self.sub = GUIEventSubscriber(IPAddress, 'ip_address', self.signal) | ||
|
||
ip_layout = QVBoxLayout() | ||
wired_str = f'Last known Pi Wired IP: {IPAddress.ETHERNET_ADDRESS__DEFAULT}' | ||
wireless_str = f'Last known Pi Wireless IP: {IPAddress.WIRELESS_ADDRESS__DEFAULT}' | ||
self.ethernet_label = QLabel(wired_str) | ||
self.wireless_label = QLabel(wireless_str) | ||
|
||
ip_layout.addWidget(self.ethernet_label) | ||
ip_layout.addWidget(self.wireless_label) | ||
self.setLayout(ip_layout) | ||
|
||
@pyqtSlot(IPAddress) | ||
def refresh(self, msg: IPAddress) -> None: | ||
self.ethernet_label.setText(f'Last known Pi Wired IP: {msg.ethernet_address}') | ||
self.wireless_label.setText(f'Last known Pi Wireless IP: {msg.wireless_address}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters