From 5ad0aef1b7d3aa4024a72afe990411b6152d3f0e Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Sat, 10 Feb 2024 14:10:26 -0500 Subject: [PATCH] test --- .../camera_streamer/launch/camera_launch.py | 4 +-- src/pi/camera_streamer/test/test_flake8.py | 4 +-- src/pi/heartbeat/heartbeat/heartbeat_node.py | 8 ++---- src/pi/heartbeat/launch/heartbeat_launch.py | 4 +-- src/pi/heartbeat/setup.py | 5 +--- src/pi/heartbeat/test/test_flake8.py | 4 +-- src/pi/manipulators/test/test_flake8.py | 4 +-- src/pi/pi_main/launch/pi_launch.py | 22 ++++----------- src/pi/pi_main/pi_main/ip_publisher.py | 4 +-- src/pi/pi_main/pi_main/run_on_boot.py | 4 +-- src/pi/pi_main/test/test_flake8.py | 4 +-- .../launch/mavros_launch.py | 4 +-- .../pixhawk_communication/test/test_flake8.py | 4 +-- src/pi/realsense/launch/realsense_launch.py | 17 +++--------- src/pi/realsense/test/test_flake8.py | 4 +-- .../flight_control/auto_docking_node.py | 8 ++---- .../flight_control/keyboard_control_node.py | 14 +++------- .../flight_control/manual_control_node.py | 26 +++++------------- .../launch/flight_control_launch.py | 4 +-- .../launch/keyboard_control_launch.py | 9 ++----- .../flight_control/test/test_flake8.py | 4 +-- .../test/test_keyboard_control.py | 4 +-- .../test/test_manual_control.py | 4 +-- src/surface/gui/gui/app.py | 9 ++----- src/surface/gui/gui/event_nodes/client.py | 6 +---- src/surface/gui/gui/event_nodes/publisher.py | 5 +--- src/surface/gui/gui/event_nodes/server.py | 11 ++------ src/surface/gui/gui/event_nodes/subscriber.py | 9 ++----- src/surface/gui/gui/operator_app.py | 15 +++-------- src/surface/gui/gui/pilot_app.py | 8 ++---- src/surface/gui/gui/styles/custom_styles.py | 3 +-- src/surface/gui/gui/widgets/arm.py | 22 ++++----------- src/surface/gui/gui/widgets/circle.py | 15 ++++++----- src/surface/gui/gui/widgets/debug_tab.py | 21 +++++---------- src/surface/gui/gui/widgets/flood_warning.py | 24 +++++------------ src/surface/gui/gui/widgets/heartbeat.py | 15 +++++------ src/surface/gui/gui/widgets/ip_widget.py | 15 +++-------- src/surface/gui/gui/widgets/logger.py | 27 ++++--------------- src/surface/gui/gui/widgets/seagrass.py | 4 +-- src/surface/gui/gui/widgets/task_selector.py | 22 ++++----------- .../gui/gui/widgets/thruster_tester.py | 18 +++---------- src/surface/gui/gui/widgets/timer.py | 7 +---- src/surface/gui/gui/widgets/video_widget.py | 21 +++------------ src/surface/gui/launch/operator_launch.py | 13 +++------ src/surface/gui/launch/pilot_launch.py | 13 +++------ src/surface/gui/test/test_flake8.py | 4 +-- .../launch/controller_launch.py | 4 +-- .../ps5_controller/test/test_flake8.py | 4 +-- src/surface/rov_flir/launch/flir_launch.py | 12 +++------ src/surface/rov_flir/test/test_flake8.py | 4 +-- src/surface/rov_gazebo/launch/sim_launch.py | 16 +++-------- src/surface/rov_gazebo/test/test_flake8.py | 4 +-- .../launch/surface_all_nodes_launch.py | 16 +++-------- .../launch/surface_operator_launch.py | 21 ++++----------- .../launch/surface_pilot_launch.py | 21 ++++----------- src/surface/surface_main/test/test_flake8.py | 4 +-- .../launch/vehicle_manager_launch.py | 4 +-- src/surface/vehicle_manager/setup.py | 5 +--- .../vehicle_manager/test/test_flake8.py | 4 +-- .../connection_manager_node.py | 12 +++------ 60 files changed, 149 insertions(+), 458 deletions(-) diff --git a/src/pi/camera_streamer/launch/camera_launch.py b/src/pi/camera_streamer/launch/camera_launch.py index 0bfd0f67..ff5fec27 100644 --- a/src/pi/camera_streamer/launch/camera_launch.py +++ b/src/pi/camera_streamer/launch/camera_launch.py @@ -1,8 +1,6 @@ """camera_streamer launch file.""" -from launch.launch_description import ( - LaunchDescription, -) +from launch.launch_description import LaunchDescription from launch_ros.actions import Node diff --git a/src/pi/camera_streamer/test/test_flake8.py b/src/pi/camera_streamer/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/pi/camera_streamer/test/test_flake8.py +++ b/src/pi/camera_streamer/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/pi/heartbeat/heartbeat/heartbeat_node.py b/src/pi/heartbeat/heartbeat/heartbeat_node.py index 14718edc..171a5a97 100644 --- a/src/pi/heartbeat/heartbeat/heartbeat_node.py +++ b/src/pi/heartbeat/heartbeat/heartbeat_node.py @@ -1,11 +1,7 @@ import rclpy -from rclpy.executors import ( - MultiThreadedExecutor, -) +from rclpy.executors import MultiThreadedExecutor from rclpy.node import Node -from rclpy.qos import ( - qos_profile_system_default, -) +from rclpy.qos import qos_profile_system_default from rov_msgs.msg import Heartbeat diff --git a/src/pi/heartbeat/launch/heartbeat_launch.py b/src/pi/heartbeat/launch/heartbeat_launch.py index c1444372..fdada999 100644 --- a/src/pi/heartbeat/launch/heartbeat_launch.py +++ b/src/pi/heartbeat/launch/heartbeat_launch.py @@ -1,6 +1,4 @@ -from launch.launch_description import ( - LaunchDescription, -) +from launch.launch_description import LaunchDescription from launch_ros.actions import Node diff --git a/src/pi/heartbeat/setup.py b/src/pi/heartbeat/setup.py index 9b30f6d7..45f3a64c 100644 --- a/src/pi/heartbeat/setup.py +++ b/src/pi/heartbeat/setup.py @@ -1,10 +1,7 @@ import os from glob import glob -from setuptools import ( - find_packages, - setup, -) +from setuptools import find_packages, setup PACKAGE_NAME = "heartbeat" diff --git a/src/pi/heartbeat/test/test_flake8.py b/src/pi/heartbeat/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/pi/heartbeat/test/test_flake8.py +++ b/src/pi/heartbeat/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/pi/manipulators/test/test_flake8.py b/src/pi/manipulators/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/pi/manipulators/test/test_flake8.py +++ b/src/pi/manipulators/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/pi/pi_main/launch/pi_launch.py b/src/pi/pi_main/launch/pi_launch.py index 2ec8dc09..5eba3c50 100644 --- a/src/pi/pi_main/launch/pi_launch.py +++ b/src/pi/pi_main/launch/pi_launch.py @@ -2,23 +2,11 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.actions import ( - GroupAction, - IncludeLaunchDescription, -) -from launch.launch_description import ( - LaunchDescription, -) -from launch.launch_description_sources import ( - PythonLaunchDescriptionSource, -) -from launch_ros.actions import ( - Node, - PushRosNamespace, -) +from ament_index_python.packages import get_package_share_directory +from launch.actions import GroupAction, IncludeLaunchDescription +from launch.launch_description import LaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_ros.actions import Node, PushRosNamespace def generate_launch_description() -> LaunchDescription: diff --git a/src/pi/pi_main/pi_main/ip_publisher.py b/src/pi/pi_main/pi_main/ip_publisher.py index c1293680..9bff42b5 100644 --- a/src/pi/pi_main/pi_main/ip_publisher.py +++ b/src/pi/pi_main/pi_main/ip_publisher.py @@ -4,9 +4,7 @@ import rclpy from rclpy.node import Node -from rclpy.qos import ( - qos_profile_system_default, -) +from rclpy.qos import qos_profile_system_default from rov_msgs.msg import IPAddress diff --git a/src/pi/pi_main/pi_main/run_on_boot.py b/src/pi/pi_main/pi_main/run_on_boot.py index 48e2ac6d..95f8c908 100644 --- a/src/pi/pi_main/pi_main/run_on_boot.py +++ b/src/pi/pi_main/pi_main/run_on_boot.py @@ -5,9 +5,7 @@ import subprocess # nosec import sys -from ament_index_python.packages import ( - get_package_share_directory, -) +from ament_index_python.packages import get_package_share_directory from robot_upstart.job import Job diff --git a/src/pi/pi_main/test/test_flake8.py b/src/pi/pi_main/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/pi/pi_main/test/test_flake8.py +++ b/src/pi/pi_main/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/pi/pixhawk_communication/launch/mavros_launch.py b/src/pi/pixhawk_communication/launch/mavros_launch.py index 8e62432f..cd97dbb6 100644 --- a/src/pi/pixhawk_communication/launch/mavros_launch.py +++ b/src/pi/pixhawk_communication/launch/mavros_launch.py @@ -1,8 +1,6 @@ """mavros_launch launch file.""" -from launch.launch_description import ( - LaunchDescription, -) +from launch.launch_description import LaunchDescription from launch_ros.actions import Node diff --git a/src/pi/pixhawk_communication/test/test_flake8.py b/src/pi/pixhawk_communication/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/pi/pixhawk_communication/test/test_flake8.py +++ b/src/pi/pixhawk_communication/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/pi/realsense/launch/realsense_launch.py b/src/pi/realsense/launch/realsense_launch.py index 6228befe..c09f3a47 100644 --- a/src/pi/realsense/launch/realsense_launch.py +++ b/src/pi/realsense/launch/realsense_launch.py @@ -2,19 +2,10 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.actions import ( - GroupAction, - IncludeLaunchDescription, -) -from launch.launch_description import ( - LaunchDescription, -) -from launch.launch_description_sources import ( - PythonLaunchDescriptionSource, -) +from ament_index_python.packages import get_package_share_directory +from launch.actions import GroupAction, IncludeLaunchDescription +from launch.launch_description import LaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource from launch_ros.actions import SetRemap diff --git a/src/pi/realsense/test/test_flake8.py b/src/pi/realsense/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/pi/realsense/test/test_flake8.py +++ b/src/pi/realsense/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/flight_control/flight_control/auto_docking_node.py b/src/surface/flight_control/flight_control/auto_docking_node.py index c2f62ddb..834b84da 100644 --- a/src/surface/flight_control/flight_control/auto_docking_node.py +++ b/src/surface/flight_control/flight_control/auto_docking_node.py @@ -1,12 +1,8 @@ import rclpy -from rclpy.executors import ( - MultiThreadedExecutor, -) +from rclpy.executors import MultiThreadedExecutor from rclpy.node import Node -from rov_msgs.srv import ( - AutonomousFlight, -) +from rov_msgs.srv import AutonomousFlight class AutoDocker(Node): diff --git a/src/surface/flight_control/flight_control/keyboard_control_node.py b/src/surface/flight_control/flight_control/keyboard_control_node.py index 0eedef81..e0f9d824 100644 --- a/src/surface/flight_control/flight_control/keyboard_control_node.py +++ b/src/surface/flight_control/flight_control/keyboard_control_node.py @@ -1,20 +1,12 @@ from typing import Optional import rclpy.utilities -from flight_control.pixhawk_instruction import ( - PixhawkInstruction, -) +from flight_control.pixhawk_instruction import PixhawkInstruction from mavros_msgs.msg import OverrideRCIn -from pynput.keyboard import ( - Key, - KeyCode, - Listener, -) +from pynput.keyboard import Key, KeyCode, Listener from rclpy.node import Node from rclpy.publisher import Publisher -from rclpy.qos import ( - qos_profile_system_default, -) +from rclpy.qos import qos_profile_system_default # key bindings FORWARD = "w" diff --git a/src/surface/flight_control/flight_control/manual_control_node.py b/src/surface/flight_control/flight_control/manual_control_node.py index 1dcacaa1..3275de13 100644 --- a/src/surface/flight_control/flight_control/manual_control_node.py +++ b/src/surface/flight_control/flight_control/manual_control_node.py @@ -1,30 +1,16 @@ -from collections.abc import ( - MutableSequence, -) +from collections.abc import MutableSequence import rclpy -from flight_control.pixhawk_instruction import ( - PixhawkInstruction, -) +from flight_control.pixhawk_instruction import PixhawkInstruction from mavros_msgs.msg import OverrideRCIn -from rclpy.executors import ( - MultiThreadedExecutor, -) +from rclpy.executors import MultiThreadedExecutor from rclpy.node import Node from rclpy.publisher import Publisher -from rclpy.qos import ( - qos_profile_sensor_data, - qos_profile_system_default, -) -from rclpy.subscription import ( - Subscription, -) +from rclpy.qos import qos_profile_sensor_data, qos_profile_system_default +from rclpy.subscription import Subscription from sensor_msgs.msg import Joy -from rov_msgs.msg import ( - CameraControllerSwitch, - Manip, -) +from rov_msgs.msg import CameraControllerSwitch, Manip # Button meanings for PS5 Control might be different for others X_BUTTON: int = 0 # Manipulator 0 diff --git a/src/surface/flight_control/launch/flight_control_launch.py b/src/surface/flight_control/launch/flight_control_launch.py index 7edef4fd..f35b14af 100644 --- a/src/surface/flight_control/launch/flight_control_launch.py +++ b/src/surface/flight_control/launch/flight_control_launch.py @@ -1,6 +1,4 @@ -from launch.launch_description import ( - LaunchDescription, -) +from launch.launch_description import LaunchDescription from launch_ros.actions import Node diff --git a/src/surface/flight_control/launch/keyboard_control_launch.py b/src/surface/flight_control/launch/keyboard_control_launch.py index 65ed5ac3..93d70941 100644 --- a/src/surface/flight_control/launch/keyboard_control_launch.py +++ b/src/surface/flight_control/launch/keyboard_control_launch.py @@ -1,11 +1,6 @@ from launch.actions import GroupAction -from launch.launch_description import ( - LaunchDescription, -) -from launch_ros.actions import ( - Node, - PushRosNamespace, -) +from launch.launch_description import LaunchDescription +from launch_ros.actions import Node, PushRosNamespace def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/flight_control/test/test_flake8.py b/src/surface/flight_control/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/surface/flight_control/test/test_flake8.py +++ b/src/surface/flight_control/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/flight_control/test/test_keyboard_control.py b/src/surface/flight_control/test/test_keyboard_control.py index 4c6d33cc..b286ea70 100644 --- a/src/surface/flight_control/test/test_keyboard_control.py +++ b/src/surface/flight_control/test/test_keyboard_control.py @@ -1,8 +1,6 @@ import pytest import rclpy -from flight_control.keyboard_control_node import ( - KeyboardListenerNode, -) +from flight_control.keyboard_control_node import KeyboardListenerNode @pytest.fixture diff --git a/src/surface/flight_control/test/test_manual_control.py b/src/surface/flight_control/test/test_manual_control.py index 950c03d8..70e8e88f 100644 --- a/src/surface/flight_control/test/test_manual_control.py +++ b/src/surface/flight_control/test/test_manual_control.py @@ -1,7 +1,5 @@ import rclpy -from flight_control.manual_control_node import ( - ManualControlNode, -) +from flight_control.manual_control_node import ManualControlNode from flight_control.pixhawk_instruction import ( FORWARD_CHANNEL, LATERAL_CHANNEL, diff --git a/src/surface/gui/gui/app.py b/src/surface/gui/gui/app.py index 6f111e60..81d45712 100644 --- a/src/surface/gui/gui/app.py +++ b/src/surface/gui/gui/app.py @@ -4,13 +4,8 @@ import qdarktheme import rclpy.utilities -from ament_index_python.packages import ( - get_package_share_directory, -) -from PyQt6.QtWidgets import ( - QApplication, - QWidget, -) +from ament_index_python.packages import get_package_share_directory +from PyQt6.QtWidgets import QApplication, QWidget from rclpy.node import Node diff --git a/src/surface/gui/gui/event_nodes/client.py b/src/surface/gui/gui/event_nodes/client.py index 81181c36..de64580b 100644 --- a/src/surface/gui/gui/event_nodes/client.py +++ b/src/surface/gui/gui/event_nodes/client.py @@ -3,11 +3,7 @@ import rclpy from PyQt6.QtCore import pyqtBoundSignal -from rclpy.client import ( - Client, - SrvType, - SrvTypeRequest, -) +from rclpy.client import Client, SrvType, SrvTypeRequest from rclpy.node import Node diff --git a/src/surface/gui/gui/event_nodes/publisher.py b/src/surface/gui/gui/event_nodes/publisher.py index 1dc28acc..a68968da 100644 --- a/src/surface/gui/gui/event_nodes/publisher.py +++ b/src/surface/gui/gui/event_nodes/publisher.py @@ -2,10 +2,7 @@ from rclpy.node import Node from rclpy.publisher import MsgType -from rclpy.qos import ( - QoSProfile, - qos_profile_system_default, -) +from rclpy.qos import QoSProfile, qos_profile_system_default class GUIEventPublisher(Node): diff --git a/src/surface/gui/gui/event_nodes/server.py b/src/surface/gui/gui/event_nodes/server.py index 3b6ab751..9b20780b 100644 --- a/src/surface/gui/gui/event_nodes/server.py +++ b/src/surface/gui/gui/event_nodes/server.py @@ -3,16 +3,9 @@ from threading import Thread from typing import Callable -from rclpy.executors import ( - SingleThreadedExecutor, -) +from rclpy.executors import SingleThreadedExecutor from rclpy.node import Node -from rclpy.service import ( - Service, - SrvType, - SrvTypeRequest, - SrvTypeResponse, -) +from rclpy.service import Service, SrvType, SrvTypeRequest, SrvTypeResponse class GUIEventServer(Node): diff --git a/src/surface/gui/gui/event_nodes/subscriber.py b/src/surface/gui/gui/event_nodes/subscriber.py index aff45f6a..66efdc84 100644 --- a/src/surface/gui/gui/event_nodes/subscriber.py +++ b/src/surface/gui/gui/event_nodes/subscriber.py @@ -3,14 +3,9 @@ from threading import Thread from PyQt6.QtCore import pyqtBoundSignal -from rclpy.executors import ( - SingleThreadedExecutor, -) +from rclpy.executors import SingleThreadedExecutor from rclpy.node import Node -from rclpy.qos import ( - QoSProfile, - qos_profile_system_default, -) +from rclpy.qos import QoSProfile, qos_profile_system_default from rclpy.subscription import MsgType diff --git a/src/surface/gui/gui/operator_app.py b/src/surface/gui/gui/operator_app.py index a12f1dc8..7f9dc0ff 100644 --- a/src/surface/gui/gui/operator_app.py +++ b/src/surface/gui/gui/operator_app.py @@ -1,18 +1,9 @@ from gui.app import App -from gui.widgets.debug_tab import ( - DebugWidget, -) +from gui.widgets.debug_tab import DebugWidget from gui.widgets.logger import Logger -from gui.widgets.task_selector import ( - TaskSelector, -) +from gui.widgets.task_selector import TaskSelector from gui.widgets.timer import Timer -from PyQt6.QtWidgets import ( - QGridLayout, - QTabWidget, - QVBoxLayout, - QWidget, -) +from PyQt6.QtWidgets import QGridLayout, QTabWidget, QVBoxLayout, QWidget class OperatorApp(App): diff --git a/src/surface/gui/gui/pilot_app.py b/src/surface/gui/gui/pilot_app.py index 6af88616..cad8dcbe 100644 --- a/src/surface/gui/gui/pilot_app.py +++ b/src/surface/gui/gui/pilot_app.py @@ -1,11 +1,7 @@ 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 gui.widgets.flood_warning import FloodWarning +from gui.widgets.video_widget import SwitchableVideoWidget from PyQt6.QtCore import Qt from PyQt6.QtWidgets import QHBoxLayout diff --git a/src/surface/gui/gui/styles/custom_styles.py b/src/surface/gui/gui/styles/custom_styles.py index f914a1fe..9c75d938 100644 --- a/src/surface/gui/gui/styles/custom_styles.py +++ b/src/surface/gui/gui/styles/custom_styles.py @@ -1,8 +1,7 @@ -from PyQt6.QtWidgets import QWidget, QPushButton +from PyQt6.QtWidgets import QPushButton, QWidget class IndicatorMixin(QWidget): - _PROPERTY_NAME = "widgetState" # A component is running, enabled, or armed diff --git a/src/surface/gui/gui/widgets/arm.py b/src/surface/gui/gui/widgets/arm.py index 3df646c9..6b9bc62b 100644 --- a/src/surface/gui/gui/widgets/arm.py +++ b/src/surface/gui/gui/widgets/arm.py @@ -1,21 +1,9 @@ -from gui.event_nodes.client import ( - GUIEventClient, -) -from gui.event_nodes.subscriber import ( - GUIEventSubscriber, -) -from gui.styles.custom_styles import ( - ButtonIndicator -) +from gui.event_nodes.client import GUIEventClient +from gui.event_nodes.subscriber import GUIEventSubscriber +from gui.styles.custom_styles import ButtonIndicator from mavros_msgs.srv import CommandBool -from PyQt6.QtCore import ( - pyqtSignal, - pyqtSlot, -) -from PyQt6.QtWidgets import ( - QHBoxLayout, - QWidget, -) +from PyQt6.QtCore import pyqtSignal, pyqtSlot +from PyQt6.QtWidgets import QHBoxLayout, QWidget from rov_msgs.msg import VehicleState diff --git a/src/surface/gui/gui/widgets/circle.py b/src/surface/gui/gui/widgets/circle.py index 23e6d873..6e02ee53 100644 --- a/src/surface/gui/gui/widgets/circle.py +++ b/src/surface/gui/gui/widgets/circle.py @@ -1,14 +1,18 @@ from typing import Optional + from gui.styles.custom_styles import IndicatorMixin from PyQt6.QtCore import QSize, Qt from PyQt6.QtGui import QColor -from PyQt6.QtWidgets import QWidget, QLabel +from PyQt6.QtWidgets import QLabel, QWidget class Circle(QLabel): - def __init__(self, parent: Optional[QWidget] = None, - radius: int = 50, - color: Optional[QColor | Qt.GlobalColor] = None) -> None: + def __init__( + self, + parent: Optional[QWidget] = None, + radius: int = 50, + color: Optional[QColor | Qt.GlobalColor] = None, + ) -> None: super().__init__(parent) self.setFixedSize(QSize(2 * radius, 2 * radius)) stylesheet = self.styleSheet() @@ -25,7 +29,6 @@ def set_color(self, color: QColor | Qt.GlobalColor) -> None: class CircleIndicator(Circle, IndicatorMixin): - def __init__(self, parent: Optional[QWidget] = None, - radius: int = 50) -> None: + def __init__(self, parent: Optional[QWidget] = None, radius: int = 50) -> None: super().__init__(parent, radius) self.set_inactive() diff --git a/src/surface/gui/gui/widgets/debug_tab.py b/src/surface/gui/gui/widgets/debug_tab.py index 80737363..e6562cd6 100644 --- a/src/surface/gui/gui/widgets/debug_tab.py +++ b/src/surface/gui/gui/widgets/debug_tab.py @@ -1,18 +1,10 @@ from gui.widgets.arm import Arm -from gui.widgets.ip_widget import ( - IPWidget, -) +from gui.widgets.heartbeat import HeartbeatWidget +from gui.widgets.ip_widget import IPWidget from gui.widgets.logger import Logger -from gui.widgets.thruster_tester import ( - ThrusterTester, -) +from gui.widgets.thruster_tester import ThrusterTester from PyQt6.QtCore import Qt -from PyQt6.QtWidgets import ( - QHBoxLayout, - QVBoxLayout, - QWidget, -) -from gui.widgets.heartbeat import HeartbeatWidget +from PyQt6.QtWidgets import QHBoxLayout, QVBoxLayout, QWidget class DebugWidget(QWidget): @@ -25,8 +17,9 @@ def __init__(self) -> None: alignment=Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft, ) - top_bar.addWidget(HeartbeatWidget(), alignment=Qt.AlignmentFlag.AlignTop | - Qt.AlignmentFlag.AlignLeft) + top_bar.addWidget( + HeartbeatWidget(), alignment=Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft + ) right_bar = QVBoxLayout() right_bar.addWidget(ThrusterTester()) diff --git a/src/surface/gui/gui/widgets/flood_warning.py b/src/surface/gui/gui/widgets/flood_warning.py index 30f4a4da..3435c52d 100644 --- a/src/surface/gui/gui/widgets/flood_warning.py +++ b/src/surface/gui/gui/widgets/flood_warning.py @@ -1,25 +1,13 @@ -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, - QHBoxLayout -) - +from gui.event_nodes.subscriber import GUIEventSubscriber from gui.widgets.circle import CircleIndicator +from PyQt6.QtCore import pyqtSignal, pyqtSlot +from PyQt6.QtGui import QFont +from PyQt6.QtWidgets import QHBoxLayout, QLabel, QVBoxLayout, QWidget from rov_msgs.msg import Flooding class FloodWarning(QWidget): - signal = pyqtSignal(Flooding) def __init__(self) -> None: @@ -38,7 +26,7 @@ def __init__(self) -> None: # Create the label that tells us what this is header_layout = QHBoxLayout() - label = QLabel('Flooding Status') + label = QLabel("Flooding Status") font = QFont("Arial", 14) label.setFont(font) header_layout.addWidget(label) @@ -60,7 +48,7 @@ def refresh(self, msg: Flooding) -> None: self.warning_msg_latch = True self.indicator_circle.set_off() else: - self.indicator.setText('No Water present') + self.indicator.setText("No Water present") self.indicator_circle.set_on() if self.warning_msg_latch: self.subscription.get_logger().warning("Robot flooding has reset itself.") diff --git a/src/surface/gui/gui/widgets/heartbeat.py b/src/surface/gui/gui/widgets/heartbeat.py index c9f2392f..3257fdfe 100644 --- a/src/surface/gui/gui/widgets/heartbeat.py +++ b/src/surface/gui/gui/widgets/heartbeat.py @@ -8,14 +8,13 @@ class HeartbeatWidget(QWidget): - signal = pyqtSignal(VehicleState) def __init__(self) -> None: super().__init__() self.signal.connect(self.refresh) - self.subscription = GUIEventSubscriber(VehicleState, 'vehicle_state_event', self.signal) + self.subscription = GUIEventSubscriber(VehicleState, "vehicle_state_event", self.signal) # Create a latch variable self.warning_msg_latch: bool = False @@ -24,7 +23,7 @@ def __init__(self) -> None: font = QFont("Arial", 14) pi_status_layout = QHBoxLayout() - self.pi_indicator = QLabel('No Pi Status') + self.pi_indicator = QLabel("No Pi Status") self.pi_indicator.setFont(font) pi_status_layout.addWidget(self.pi_indicator) self.pi_indicator_circle = CircleIndicator(radius=10) @@ -32,7 +31,7 @@ def __init__(self) -> None: heartbeat_layout.addLayout(pi_status_layout) pixhawk_status_layout = QHBoxLayout() - self.pixhawk_indicator = QLabel('No Pixhawk Status') + self.pixhawk_indicator = QLabel("No Pixhawk Status") self.pixhawk_indicator.setFont(font) pixhawk_status_layout.addWidget(self.pixhawk_indicator) self.pixhawk_indicator_circle = CircleIndicator(radius=10) @@ -44,15 +43,15 @@ def __init__(self) -> None: @pyqtSlot(VehicleState) def refresh(self, msg: VehicleState) -> None: if msg.pi_connected: - self.pi_indicator.setText('Pi Connected') + self.pi_indicator.setText("Pi Connected") self.pi_indicator_circle.set_on() else: - self.pi_indicator.setText('Pi Disconnected') + self.pi_indicator.setText("Pi Disconnected") self.pi_indicator_circle.set_off() if msg.pixhawk_connected: - self.pixhawk_indicator.setText('Pixhawk Connected') + self.pixhawk_indicator.setText("Pixhawk Connected") self.pixhawk_indicator_circle.set_on() else: - self.pixhawk_indicator.setText('Pixhawk Disconnected') + self.pixhawk_indicator.setText("Pixhawk Disconnected") self.pixhawk_indicator_circle.set_off() diff --git a/src/surface/gui/gui/widgets/ip_widget.py b/src/surface/gui/gui/widgets/ip_widget.py index ae8516e0..4bdbed98 100644 --- a/src/surface/gui/gui/widgets/ip_widget.py +++ b/src/surface/gui/gui/widgets/ip_widget.py @@ -1,15 +1,6 @@ -from gui.event_nodes.subscriber import ( - GUIEventSubscriber, -) -from PyQt6.QtCore import ( - pyqtSignal, - pyqtSlot, -) -from PyQt6.QtWidgets import ( - QLabel, - QVBoxLayout, - QWidget, -) +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 diff --git a/src/surface/gui/gui/widgets/logger.py b/src/surface/gui/gui/widgets/logger.py index 45c381b2..09848988 100644 --- a/src/surface/gui/gui/widgets/logger.py +++ b/src/surface/gui/gui/widgets/logger.py @@ -1,26 +1,9 @@ -from gui.event_nodes.subscriber import ( - GUIEventSubscriber, -) -from PyQt6.QtCore import ( - pyqtSignal, - pyqtSlot, -) -from PyQt6.QtGui import ( - QColor, - QFont, - QTextCursor, -) -from PyQt6.QtWidgets import ( - QCheckBox, - QHBoxLayout, - QTextEdit, - QVBoxLayout, - QWidget, -) +from gui.event_nodes.subscriber import GUIEventSubscriber +from PyQt6.QtCore import pyqtSignal, pyqtSlot +from PyQt6.QtGui import QColor, QFont, QTextCursor +from PyQt6.QtWidgets import QCheckBox, QHBoxLayout, QTextEdit, QVBoxLayout, QWidget from rcl_interfaces.msg import Log -from rclpy.impl.logging_severity import ( - LoggingSeverity, -) +from rclpy.impl.logging_severity import LoggingSeverity # Dictionary linking LoggingSeverity to a QColor SEVERITY_LEVELS_DICT = { diff --git a/src/surface/gui/gui/widgets/seagrass.py b/src/surface/gui/gui/widgets/seagrass.py index 6ab13874..e8317ca0 100644 --- a/src/surface/gui/gui/widgets/seagrass.py +++ b/src/surface/gui/gui/widgets/seagrass.py @@ -1,8 +1,6 @@ from typing import Callable, Optional -from gui.widgets.video_widget import ( - PauseableVideoWidget, -) +from gui.widgets.video_widget import PauseableVideoWidget from PyQt6.QtCore import Qt from PyQt6.QtWidgets import ( QFrame, diff --git a/src/surface/gui/gui/widgets/task_selector.py b/src/surface/gui/gui/widgets/task_selector.py index fc80187a..83b6eec6 100644 --- a/src/surface/gui/gui/widgets/task_selector.py +++ b/src/surface/gui/gui/widgets/task_selector.py @@ -1,20 +1,8 @@ -from gui.event_nodes.client import ( - GUIEventClient, -) -from PyQt6.QtCore import ( - pyqtSignal, - pyqtSlot, -) -from PyQt6.QtWidgets import ( - QGridLayout, - QLabel, - QPushButton, - QWidget, -) - -from rov_msgs.srv import ( - AutonomousFlight, -) +from gui.event_nodes.client import GUIEventClient +from PyQt6.QtCore import pyqtSignal, pyqtSlot +from PyQt6.QtWidgets import QGridLayout, QLabel, QPushButton, QWidget + +from rov_msgs.srv import AutonomousFlight WIDTH = 200 diff --git a/src/surface/gui/gui/widgets/thruster_tester.py b/src/surface/gui/gui/widgets/thruster_tester.py index ebd3ade5..bc606709 100644 --- a/src/surface/gui/gui/widgets/thruster_tester.py +++ b/src/surface/gui/gui/widgets/thruster_tester.py @@ -1,23 +1,11 @@ import time from threading import Thread -from gui.event_nodes.client import ( - GUIEventClient, -) +from gui.event_nodes.client import GUIEventClient from mavros_msgs.srv import CommandLong -from PyQt6.QtCore import ( - pyqtSignal, - pyqtSlot, -) +from PyQt6.QtCore import pyqtSignal, pyqtSlot from PyQt6.QtGui import QIntValidator -from PyQt6.QtWidgets import ( - QGridLayout, - QLabel, - QLineEdit, - QPushButton, - QVBoxLayout, - QWidget, -) +from PyQt6.QtWidgets import QGridLayout, QLabel, QLineEdit, QPushButton, QVBoxLayout, QWidget class ThrusterTester(QWidget): diff --git a/src/surface/gui/gui/widgets/timer.py b/src/surface/gui/gui/widgets/timer.py index 1f3fe666..ae7fd9d4 100644 --- a/src/surface/gui/gui/widgets/timer.py +++ b/src/surface/gui/gui/widgets/timer.py @@ -1,11 +1,6 @@ from PyQt6.QtCore import Qt, QTimer from PyQt6.QtGui import QFont -from PyQt6.QtWidgets import ( - QGridLayout, - QLabel, - QPushButton, - QWidget, -) +from PyQt6.QtWidgets import QGridLayout, QLabel, QPushButton, QWidget class Timer(QWidget): diff --git a/src/surface/gui/gui/widgets/video_widget.py b/src/surface/gui/gui/widgets/video_widget.py index 17e75475..c2a832a2 100644 --- a/src/surface/gui/gui/widgets/video_widget.py +++ b/src/surface/gui/gui/widgets/video_widget.py @@ -3,26 +3,13 @@ import cv2 from cv2.typing import MatLike from cv_bridge.core import CvBridge -from gui.event_nodes.subscriber import ( - GUIEventSubscriber, -) -from PyQt6.QtCore import ( - Qt, - pyqtSignal, - pyqtSlot, -) +from gui.event_nodes.subscriber import GUIEventSubscriber +from PyQt6.QtCore import Qt, pyqtSignal, pyqtSlot from PyQt6.QtGui import QImage, QPixmap -from PyQt6.QtWidgets import ( - QLabel, - QPushButton, - QVBoxLayout, - QWidget, -) +from PyQt6.QtWidgets import QLabel, QPushButton, QVBoxLayout, QWidget from sensor_msgs.msg import Image -from rov_msgs.msg import ( - CameraControllerSwitch, -) +from rov_msgs.msg import CameraControllerSwitch WIDTH = 1280 HEIGHT = 720 diff --git a/src/surface/gui/launch/operator_launch.py b/src/surface/gui/launch/operator_launch.py index 626bf561..1f000050 100644 --- a/src/surface/gui/launch/operator_launch.py +++ b/src/surface/gui/launch/operator_launch.py @@ -1,14 +1,7 @@ from launch.actions import GroupAction -from launch.launch_description import ( - LaunchDescription, -) -from launch.substitutions import ( - LaunchConfiguration, -) -from launch_ros.actions import ( - Node, - PushRosNamespace, -) +from launch.launch_description import LaunchDescription +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node, PushRosNamespace def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/gui/launch/pilot_launch.py b/src/surface/gui/launch/pilot_launch.py index 5abd99a4..af385ec3 100644 --- a/src/surface/gui/launch/pilot_launch.py +++ b/src/surface/gui/launch/pilot_launch.py @@ -1,14 +1,7 @@ from launch.actions import GroupAction -from launch.launch_description import ( - LaunchDescription, -) -from launch.substitutions import ( - LaunchConfiguration, -) -from launch_ros.actions import ( - Node, - PushRosNamespace, -) +from launch.launch_description import LaunchDescription +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node, PushRosNamespace def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/gui/test/test_flake8.py b/src/surface/gui/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/surface/gui/test/test_flake8.py +++ b/src/surface/gui/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/ps5_controller/launch/controller_launch.py b/src/surface/ps5_controller/launch/controller_launch.py index d6d3d7d9..d321ceed 100644 --- a/src/surface/ps5_controller/launch/controller_launch.py +++ b/src/surface/ps5_controller/launch/controller_launch.py @@ -1,6 +1,4 @@ -from launch.launch_description import ( - LaunchDescription, -) +from launch.launch_description import LaunchDescription from launch_ros.actions import Node diff --git a/src/surface/ps5_controller/test/test_flake8.py b/src/surface/ps5_controller/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/surface/ps5_controller/test/test_flake8.py +++ b/src/surface/ps5_controller/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/rov_flir/launch/flir_launch.py b/src/surface/rov_flir/launch/flir_launch.py index 7d135f44..6da9f32f 100644 --- a/src/surface/rov_flir/launch/flir_launch.py +++ b/src/surface/rov_flir/launch/flir_launch.py @@ -1,15 +1,9 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.launch_description import ( - LaunchDescription, -) +from ament_index_python.packages import get_package_share_directory +from launch.launch_description import LaunchDescription from launch_ros.actions import Node -from launch_ros.parameter_descriptions import ( - Parameter, -) +from launch_ros.parameter_descriptions import Parameter def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/rov_flir/test/test_flake8.py b/src/surface/rov_flir/test/test_flake8.py index 37a6b188..877a6f7f 100644 --- a/src/surface/rov_flir/test/test_flake8.py +++ b/src/surface/rov_flir/test/test_flake8.py @@ -13,9 +13,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/rov_gazebo/launch/sim_launch.py b/src/surface/rov_gazebo/launch/sim_launch.py index 10bf8ad2..4378fff2 100644 --- a/src/surface/rov_gazebo/launch/sim_launch.py +++ b/src/surface/rov_gazebo/launch/sim_launch.py @@ -1,17 +1,9 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.actions import ( - IncludeLaunchDescription, -) -from launch.launch_description import ( - LaunchDescription, -) -from launch.launch_description_sources import ( - PythonLaunchDescriptionSource, -) +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description import LaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import Command from launch_ros.actions import Node diff --git a/src/surface/rov_gazebo/test/test_flake8.py b/src/surface/rov_gazebo/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/surface/rov_gazebo/test/test_flake8.py +++ b/src/surface/rov_gazebo/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/surface_main/launch/surface_all_nodes_launch.py b/src/surface/surface_main/launch/surface_all_nodes_launch.py index 540e655b..c60e455e 100644 --- a/src/surface/surface_main/launch/surface_all_nodes_launch.py +++ b/src/surface/surface_main/launch/surface_all_nodes_launch.py @@ -1,17 +1,9 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.actions import ( - IncludeLaunchDescription, -) -from launch.launch_description import ( - LaunchDescription, -) -from launch.launch_description_sources import ( - PythonLaunchDescriptionSource, -) +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description import LaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/surface_main/launch/surface_operator_launch.py b/src/surface/surface_main/launch/surface_operator_launch.py index 35d5415a..7a80f592 100644 --- a/src/surface/surface_main/launch/surface_operator_launch.py +++ b/src/surface/surface_main/launch/surface_operator_launch.py @@ -1,21 +1,10 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.actions import ( - GroupAction, - IncludeLaunchDescription, -) -from launch.launch_description import ( - LaunchDescription, -) -from launch.launch_description_sources import ( - PythonLaunchDescriptionSource, -) -from launch_ros.actions import ( - PushRosNamespace, -) +from ament_index_python.packages import get_package_share_directory +from launch.actions import GroupAction, IncludeLaunchDescription +from launch.launch_description import LaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_ros.actions import PushRosNamespace def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/surface_main/launch/surface_pilot_launch.py b/src/surface/surface_main/launch/surface_pilot_launch.py index 97353b3b..2fc5cc71 100644 --- a/src/surface/surface_main/launch/surface_pilot_launch.py +++ b/src/surface/surface_main/launch/surface_pilot_launch.py @@ -1,21 +1,10 @@ import os -from ament_index_python.packages import ( - get_package_share_directory, -) -from launch.actions import ( - GroupAction, - IncludeLaunchDescription, -) -from launch.launch_description import ( - LaunchDescription, -) -from launch.launch_description_sources import ( - PythonLaunchDescriptionSource, -) -from launch_ros.actions import ( - PushRosNamespace, -) +from ament_index_python.packages import get_package_share_directory +from launch.actions import GroupAction, IncludeLaunchDescription +from launch.launch_description import LaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_ros.actions import PushRosNamespace def generate_launch_description() -> LaunchDescription: diff --git a/src/surface/surface_main/test/test_flake8.py b/src/surface/surface_main/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/surface/surface_main/test/test_flake8.py +++ b/src/surface/surface_main/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/vehicle_manager/launch/vehicle_manager_launch.py b/src/surface/vehicle_manager/launch/vehicle_manager_launch.py index 74053c74..e0fa0e40 100644 --- a/src/surface/vehicle_manager/launch/vehicle_manager_launch.py +++ b/src/surface/vehicle_manager/launch/vehicle_manager_launch.py @@ -1,6 +1,4 @@ -from launch.launch_description import ( - LaunchDescription, -) +from launch.launch_description import LaunchDescription from launch_ros.actions import Node diff --git a/src/surface/vehicle_manager/setup.py b/src/surface/vehicle_manager/setup.py index fd84da33..4139a66e 100644 --- a/src/surface/vehicle_manager/setup.py +++ b/src/surface/vehicle_manager/setup.py @@ -1,10 +1,7 @@ import os from glob import glob -from setuptools import ( - find_packages, - setup, -) +from setuptools import find_packages, setup PACKAGE_NAME = "vehicle_manager" diff --git a/src/surface/vehicle_manager/test/test_flake8.py b/src/surface/vehicle_manager/test/test_flake8.py index 57390115..dd9f258c 100644 --- a/src/surface/vehicle_manager/test/test_flake8.py +++ b/src/surface/vehicle_manager/test/test_flake8.py @@ -15,9 +15,7 @@ # limitations under the License. import pytest -from ament_flake8.main import ( - main_with_errors, -) +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/src/surface/vehicle_manager/vehicle_manager/connection_manager_node.py b/src/surface/vehicle_manager/vehicle_manager/connection_manager_node.py index 8d61cbfa..5f326546 100644 --- a/src/surface/vehicle_manager/vehicle_manager/connection_manager_node.py +++ b/src/surface/vehicle_manager/vehicle_manager/connection_manager_node.py @@ -3,18 +3,12 @@ import rclpy from mavros_msgs.msg import State -from rclpy.executors import ( - MultiThreadedExecutor, -) +from rclpy.executors import MultiThreadedExecutor from rclpy.node import Node -from rclpy.qos import ( - qos_profile_system_default, -) +from rclpy.qos import qos_profile_system_default from rov_msgs.msg import Heartbeat -from rov_msgs.msg import ( - VehicleState as VehicleStateMsg, -) +from rov_msgs.msg import VehicleState as VehicleStateMsg PI_TIMEOUT = 1 # Seconds