From 40181b9cdf12114b9152912d8d811e56a1db4258 Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Thu, 11 Jul 2024 20:47:26 -0400 Subject: [PATCH] Changes for pre-commit --- .../navigator_missions/navigator_missions/navigator.py | 4 +--- .../perception/subjugator_perception/nodes/buoy_finder.py | 5 +---- .../nodes/orange_rectangle_finder.py | 4 +--- .../mil_vision/object_classification/roi_generator.py | 8 +++----- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py b/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py index aafd3cfe2..5bba58fc9 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py @@ -820,9 +820,7 @@ async def valid(self): if not exists: return False value = await self.nh.get_param(self.param) - if not self._valid(value): - return False - return True + return self._valid(value) async def reset(self): if await self.exists(): diff --git a/SubjuGator/perception/subjugator_perception/nodes/buoy_finder.py b/SubjuGator/perception/subjugator_perception/nodes/buoy_finder.py index 21802b82a..24d69ce1c 100755 --- a/SubjuGator/perception/subjugator_perception/nodes/buoy_finder.py +++ b/SubjuGator/perception/subjugator_perception/nodes/buoy_finder.py @@ -417,10 +417,7 @@ def sanity_check(self, coordinate, timestamp): return False linear_velocity = rosmsg_to_numpy(self.last_odom.twist.twist.linear) - if np.linalg.norm(linear_velocity) > self.max_velocity: - return False - - return True + return np.linalg.norm(linear_velocity) > self.max_velocity if __name__ == "__main__": diff --git a/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py b/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py index 237fe94e3..3a8d845d2 100755 --- a/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py +++ b/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py @@ -367,9 +367,7 @@ def _is_valid_contour(self, contour): return False self.last2d = self.rect_model.get_pose_2D(corners) self.last_found_time_2D = self.image_sub.last_image_time - if self.do_3D and not self._get_pose_3D(corners): - return False - return True + return self.do_3D and not self._get_pose_3D(corners) def _get_edges(self): """ diff --git a/mil_common/perception/mil_vision/object_classification/roi_generator.py b/mil_common/perception/mil_vision/object_classification/roi_generator.py index b727c37a5..fb58e7594 100644 --- a/mil_common/perception/mil_vision/object_classification/roi_generator.py +++ b/mil_common/perception/mil_vision/object_classification/roi_generator.py @@ -81,11 +81,9 @@ def seth(x): def out_range(self, bbox): h, w, r = self.image.shape - if bbox[0] < 0 or bbox[0] + bbox[2] > w: - return True - if bbox[1] < 0 or bbox[1] + bbox[3] > h: - return True - return False + return (bbox[0] < 0 or bbox[0] + bbox[2] > w) or ( + bbox[1] < 0 or bbox[1] + bbox[3] > h + ) def go(self): while self.x is None: