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

Flood Visualization #83

Merged
merged 31 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
449d66b
Ben, cope and seethe
Tazmania40 Sep 30, 2023
dcce984
Merge remote-tracking branch 'origin/main' into flood-visuals
Tazmania40 Sep 30, 2023
8b0c5e7
New things
Tazmania40 Sep 30, 2023
9dfab19
It's not working today <3
Tazmania40 Sep 30, 2023
459c7ef
God please let this pass the linter
Tazmania40 Dec 16, 2023
05f4c3b
making things pass the linter
Tazmania40 Dec 16, 2023
3f141c9
stupid linter, it should work now
Tazmania40 Dec 16, 2023
e59693f
Resolving a lingering merge conflict
Tazmania40 Dec 16, 2023
9fab689
resolving that lingering merge conflict pt 2 electric bugaloo
Tazmania40 Dec 16, 2023
1b2cad9
Merge branch 'main' into flood-visuals
Tazmania40 Jan 20, 2024
d45533f
It's not actively erroring but it doesn't work yet
Tazmania40 Jan 20, 2024
c6bf7df
Linter please let this pass
Tazmania40 Jan 27, 2024
0cca867
everything actually works supposedly
Tazmania40 Jan 27, 2024
e6a40d7
Merge branch 'main' into flood-visuals
Tazmania40 Jan 27, 2024
c49bed2
stupid linter
Tazmania40 Jan 27, 2024
61572e4
owo
Tazmania40 Jan 27, 2024
8a706f7
Added error spam
Tazmania40 Jan 27, 2024
b746773
losing kindness because the linter dislikes me
Tazmania40 Jan 27, 2024
d217ea4
Updating the Readme
Tazmania40 Jan 27, 2024
ba67173
Doing updates
Tazmania40 Jan 27, 2024
7726754
oops
Tazmania40 Jan 27, 2024
78033d6
removing fonts
Tazmania40 Jan 27, 2024
175888f
Adding Latch variable hehe
Tazmania40 Jan 27, 2024
a7996ff
changing the latch name
Tazmania40 Jan 27, 2024
ff1aa0d
making things camelcase
Tazmania40 Jan 27, 2024
164d5d3
updating names to match
Tazmania40 Jan 27, 2024
e94bd01
changing one word
Tazmania40 Jan 27, 2024
98ff7ff
removing a comment because ben is mean
Tazmania40 Jan 27, 2024
a191fee
Organize imports
benjaminwp18 Jan 27, 2024
857c443
Merge branch 'flood-visuals' of github.com:cwruRobotics/rov-24 into f…
benjaminwp18 Jan 27, 2024
020426d
Organize more imports
benjaminwp18 Jan 27, 2024
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
1 change: 1 addition & 0 deletions src/rov_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rosidl_generate_interfaces(${PROJECT_NAME}
"srv/AutonomousFlight.srv"
"msg/Manip.msg"
"msg/CameraControllerSwitch.msg"
"msg/Flooding.msg"
DEPENDENCIES std_msgs
)

Expand Down
2 changes: 2 additions & 0 deletions src/rov_msgs/msg/Flooding.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# True means the robot is actively flooding
bool flooding
10 changes: 10 additions & 0 deletions src/surface/gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ Has two buttons for arming and disarming the pixhawk.

Sends a request to arm or disarm the pixhawk. Receives a confirmation about the success of the arm or disarm.

### Flood Warnng

Shows whether the robot is flooding or not on the GUI

#### Subscribed Topics

* **`/tether/flooding`** ([rov_msgs/msg/Flooding])

A custom message for whether the robot is actively flooding

### Logger

Reads ROS logging information and displays it on the gui.
Expand Down
5 changes: 5 additions & 0 deletions src/surface/gui/gui/pilot_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from gui.app import App
from gui.widgets.arm import Arm
from gui.widgets.flood_warning import FloodWarning
from gui.widgets.video_widget import SwitchableVideoWidget
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QHBoxLayout
Expand All @@ -23,6 +24,10 @@ def __init__(self) -> None:
"camera_switch")
layout.addWidget(self.video_area, alignment=Qt.AlignmentFlag.AlignCenter)

self.floodWidget: FloodWarning = FloodWarning()
layout.addWidget(self.floodWidget, alignment=Qt.AlignmentFlag.AlignRight
| Qt.AlignmentFlag.AlignTop)

self.arm: Arm = Arm()
layout.addWidget(self.arm,
alignment=Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignBottom)
Expand Down
45 changes: 45 additions & 0 deletions src/surface/gui/gui/widgets/flood_warning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from gui.event_nodes.subscriber import GUIEventSubscriber
from PyQt6.QtCore import pyqtSignal, pyqtSlot
from PyQt6.QtGui import QFont
from PyQt6.QtWidgets import QLabel, QVBoxLayout, QWidget

from rov_msgs.msg import Flooding


class FloodWarning(QWidget):

signal: pyqtSignal = pyqtSignal(Flooding)

def __init__(self) -> None:
super().__init__()
# Boilerplate PyQt Setup to link to ROS through a signal/subscriber
self.signal.connect(self.refresh)
self.subscription: GUIEventSubscriber = GUIEventSubscriber(Flooding,
'flooding',
self.signal)
# Create a latch variable
self.warning_msg_latch: bool = False
# Create basic 2 vertical stacked boxes layout
self.flood_layour = QVBoxLayout()
# Create the label that tells us what this is
self.label: QLabel = QLabel('Flooding Indicator')
font: QFont = QFont("Arial", 14)
self.label.setFont(font)
self.flood_layour.addWidget(self.label)

self.indicator: QLabel = QLabel('No Water present')
self.indicator.setFont(font)
self.flood_layour.addWidget(self.indicator)
self.setLayout(self.flood_layour)

@pyqtSlot(Flooding)
def refresh(self, msg: Flooding) -> None:
if msg.flooding:
self.indicator.setText('FLOODING')
self.subscription.get_logger().error("Robot is actively flooding, do something!")
self.warning_msg_latch = True
else:
self.indicator.setText('No Water present')
if self.warning_msg_latch:
self.subscription.get_logger().warning("Robot flooding has reset itself.")
self.warning_msg_latch = False
3 changes: 2 additions & 1 deletion src/surface/gui/launch/pilot_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def generate_launch_description() -> LaunchDescription:
remappings=[("/surface/gui/mavros/cmd/arming", "/tether/mavros/cmd/arming"),
("/surface/gui/camera_switch", "/surface/camera_switch"),
("/surface/gui/bottom_cam/image_raw", "/tether/bottom_cam/image_raw"),
("/surface/gui/front_cam/image_raw", "/tether/front_cam/image_raw")],
("/surface/gui/front_cam/image_raw", "/tether/front_cam/image_raw"),
("/surface/gui/flooding", "/tether/flooding")],
emulate_tty=True,
output='screen'
)
Expand Down