From d5d08d922e69b04cbf325b097072fa5f37f9a15f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 19:17:42 +0000 Subject: [PATCH 01/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-clang-format: v14.0.6 → v15.0.7](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.6...v15.0.7) - [github.com/charliermarsh/ruff-pre-commit: v0.0.247 → v0.0.254](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.247...v0.0.254) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c77fef18..121483b39 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v15.0.7 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake @@ -46,7 +46,7 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/charliermarsh/ruff-pre-commit # Ruff version. - rev: 'v0.0.247' + rev: 'v0.0.254' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 79978474439f5515c1e371a9bc9985c3dee8bf2b Mon Sep 17 00:00:00 2001 From: Jarrod Sanders <50600614+kawaiiPlat@users.noreply.github.com> Date: Thu, 9 Mar 2023 12:52:36 -0500 Subject: [PATCH 02/19] Run apt-get update before upgrade (#1001) The package index from the runner image will go out of date and dependencies may be unresolveable. If upgrade is run before update the index can be stale for the upgrade step. --- .github/workflows/gh_pages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh_pages.yaml b/.github/workflows/gh_pages.yaml index a228bba5e..b54342c28 100644 --- a/.github/workflows/gh_pages.yaml +++ b/.github/workflows/gh_pages.yaml @@ -50,7 +50,7 @@ jobs: # We need to install rsync for GitHub Pages deploy action - name: Install rsync run: | - sudo apt-get upgrade && sudo apt-get update && sudo apt-get install -y rsync + sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y rsync - name: Move folders if: github.event.action != 'closed' From 0ddebfcbf237b27e931d0a49207630f1a8a39c0a Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Thu, 9 Mar 2023 13:43:44 -0500 Subject: [PATCH 03/19] Remove clang-format upgrade because of lack of aarch64 wheels for Linux --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 121483b39..d47bfb74c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v15.0.7 + rev: v14.0.6 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake From e31787918e2ebdbb27209e05e88bc5b38a2ed85c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:49:56 +0000 Subject: [PATCH 04/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/adrienverge/yamllint.git: v1.29.0 → v1.30.0](https://github.com/adrienverge/yamllint.git/compare/v1.29.0...v1.30.0) - [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0) - [github.com/pre-commit/mirrors-clang-format: v14.0.6 → v16.0.0](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.6...v16.0.0) - [github.com/PyCQA/autoflake: v2.0.1 → v2.0.2](https://github.com/PyCQA/autoflake/compare/v2.0.1...v2.0.2) - [github.com/scop/pre-commit-shfmt: v3.6.0-1 → v3.6.0-2](https://github.com/scop/pre-commit-shfmt/compare/v3.6.0-1...v3.6.0-2) - [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.260](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.254...v0.0.260) - [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](https://github.com/codespell-project/codespell/compare/v2.2.2...v2.2.4) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba902870d..bd00858d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,19 +11,19 @@ ci: repos: - repo: https://github.com/adrienverge/yamllint.git - rev: v1.29.0 + rev: v1.30.0 hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v16.0.0 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake - rev: v2.0.1 + rev: v2.0.2 hooks: - id: autoflake args: [--remove-all-unused-imports, --ignore-init-module-imports] @@ -34,18 +34,18 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX args: [--severity=warning, --exclude=SC1090] - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.6.0-1 + rev: v3.6.0-2 hooks: - id: shfmt exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/charliermarsh/ruff-pre-commit # Ruff version. - rev: 'v0.0.254' + rev: 'v0.0.260' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.4 hooks: - id: codespell args: From 7135e79facccb54bbb0670d0be3edec77e9c416c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:50:51 +0000 Subject: [PATCH 05/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../sub8_adis16400_imu/include/adis16400_imu/driver.h | 10 +++++----- .../sub8_depth_driver/include/depth_driver/driver.h | 2 +- .../subjugator_perception/nodes/torpedo_board.cpp | 2 +- .../include/subjugator_build_tools/backward.hpp | 8 ++++---- .../include/blueview_ros_driver.hpp | 2 +- .../image_acquisition/camera_frame_sequence.hpp | 4 ++-- .../mil_vision/src/mil_vision_lib/active_contours.cpp | 2 +- .../mil_vision/src/mil_vision_lib/image_filtering.cpp | 2 +- .../src/ogrid_manager.cpp | 2 +- .../ros_alarms/test/roscpp/heartbeat_monitor_test.cpp | 4 ++-- mil_common/ros_alarms/test/roscpp/listener_test.cpp | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h b/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h index c8fd95b78..b62785f36 100644 --- a/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h +++ b/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h @@ -70,7 +70,7 @@ class Device result.header.frame_id = frame_id; result.header.stamp = ros::Time::now(); - result.orientation_covariance[0] = -1; // indicate no orientation data + result.orientation_covariance[0] = -1; // indicate no orientation data static const double GYRO_CONVERSION = 0.05 * (2 * M_PI / 360); // convert to deg/s and then to rad/s result.angular_velocity.x = get16(data + 4 + 2 * 0) * GYRO_CONVERSION; @@ -78,7 +78,7 @@ class Device result.angular_velocity.z = get16(data + 4 + 2 * 2) * GYRO_CONVERSION; result.angular_velocity_covariance[0] = result.angular_velocity_covariance[4] = result.angular_velocity_covariance[8] = - pow(0.9 * (2 * M_PI / 360), 2); // 0.9 deg/sec rms converted to rad/sec and then squared + pow(0.9 * (2 * M_PI / 360), 2); // 0.9 deg/sec rms converted to rad/sec and then squared static const double ACC_CONVERSION = 3.33e-3 * 9.80665; // convert to g's and then to m/s^2 result.linear_acceleration.x = -get16(data + 10 + 2 * 0) * ACC_CONVERSION; @@ -99,9 +99,9 @@ class Device mag_result.magnetic_field_covariance[8] = pow(1.25e-3 * 0.0001, 2); // 1.25 mgauss converted to tesla and then squared - getu16(data + 0); // flags unused - getu16(data + 2) * 2.418e-3; // supply voltage unused - get16(data + 22) * 0.14 + 25; // temperature unused + getu16(data + 0); // flags unused + getu16(data + 2) * 2.418e-3; // supply voltage unused + get16(data + 22) * 0.14 + 25; // temperature unused return true; } diff --git a/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h b/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h index 26cca97c3..e9c287107 100644 --- a/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h +++ b/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h @@ -166,7 +166,7 @@ class Device void send_heartbeat() { - send_packet(ByteVec()); // heartbeat + send_packet(ByteVec()); // heartbeat uint8_t msg[] = { 4, 1, 20 }; send_packet(ByteVec(msg, msg + sizeof(msg) / sizeof(msg[0]))); // StartPublishing 20hz } diff --git a/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp b/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp index 51f57e387..a5f2aa352 100644 --- a/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp +++ b/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp @@ -1494,7 +1494,7 @@ void anisotropic_diffusion(const Mat &src, Mat &dest, int t_max) if (i == 0 || i == x0.rows - 1 || j == 0 || j == x0.cols - 1) // conduction coefficient set to d = 1; // 1 p633 after equation 13 else - d = 1.0 / (1 + (gx * gx + 0 * gy * gy) * K2); // expression of g(gradient(I)) + d = 1.0 / (1 + (gx * gx + 0 * gy * gy) * K2); // expression of g(gradient(I)) // d =-exp(-(gx*gx+gy*gy)*K2); // expression of g(gradient(I)) D.at(i, j) = d; } diff --git a/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp b/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp index 35f85d221..9c6f0316e 100644 --- a/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp +++ b/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp @@ -222,7 +222,7 @@ struct hashtable using std::move; } // namespace details } // namespace backward -#else // NOT BACKWARD_ATLEAST_CXX11 +#else // NOT BACKWARD_ATLEAST_CXX11 #include namespace backward { @@ -752,7 +752,7 @@ class StackTraceImpl : public StackTraceLinuxImplHolder }; }; -#else // BACKWARD_HAS_UNWIND == 0 +#else // BACKWARD_HAS_UNWIND == 0 template <> class StackTraceImpl : public StackTraceLinuxImplHolder @@ -1902,7 +1902,7 @@ class Colorize bool _istty; }; -#else // ndef BACKWARD_SYSTEM_LINUX +#else // ndef BACKWARD_SYSTEM_LINUX namespace Color { @@ -2152,7 +2152,7 @@ class SignalHandling StackTrace st; void* error_addr = 0; -#ifdef REG_RIP // x86_64 +#ifdef REG_RIP // x86_64 error_addr = reinterpret_cast(uctx->uc_mcontext.gregs[REG_RIP]); #elif defined(REG_EIP) // x86_32 error_addr = reinterpret_cast(uctx->uc_mcontext.gregs[REG_EIP]); diff --git a/mil_common/drivers/mil_blueview_driver/include/blueview_ros_driver.hpp b/mil_common/drivers/mil_blueview_driver/include/blueview_ros_driver.hpp index fdd19b4d4..0c9df8090 100644 --- a/mil_common/drivers/mil_blueview_driver/include/blueview_ros_driver.hpp +++ b/mil_common/drivers/mil_blueview_driver/include/blueview_ros_driver.hpp @@ -25,7 +25,7 @@ class BlueViewRosDriver private: ros::NodeHandle nh; BlueViewSonar sonar; - void loop(const ros::TimerEvent&); + void loop(const ros::TimerEvent &); void get_ping(); image_transport::ImageTransport image_transport; diff --git a/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame_sequence.hpp b/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame_sequence.hpp index 577ce5abf..9a9dd9287 100644 --- a/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame_sequence.hpp +++ b/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame_sequence.hpp @@ -38,12 +38,12 @@ class CameraFrameSequence /** * Forbidden copy constructor. Set to the delete operator. */ - CameraFrameSequence(const CameraFrameSequence&) = delete; // Forbid copy construction + CameraFrameSequence(const CameraFrameSequence &) = delete; // Forbid copy construction /** * Forbidden move constructor. Set to the delete operator. */ - CameraFrameSequence(CameraFrameSequence&&) = delete; // Forbid move construction + CameraFrameSequence(CameraFrameSequence &&) = delete; // Forbid move construction virtual ~CameraFrameSequence() = default; diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp index 46d902eee..b6b35bba6 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp @@ -135,7 +135,7 @@ void growRoute(const vector& partial, const vector& occupied, auto next_partial = partial; next_partial.push_back(new_elem); - auto next_tails = getHoodIdxs(new_elem, true); // true --> include border + auto next_tails = getHoodIdxs(new_elem, true); // true --> include border auto find_exit_itr = find(next_tails.begin(), next_tails.end(), exit); if (find_exit_itr != next_tails.end() && *find_exit_itr != tail) // add to cache if exit is a possible next tail { diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp index 6643b6408..bbf89ff63 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp @@ -7,7 +7,7 @@ cv::Mat rotateKernel(const cv::Mat &kernel, float theta, bool deg, bool no_expan theta = deg ? theta : theta * mil_tools::PI / 180.0f; cv::Point2f c_org{ kernel.cols * 0.5f, kernel.rows * 0.5f }; // center of original - if (no_expand) // rotates without expanding the canvas + if (no_expand) // rotates without expanding the canvas { cv::Mat result; cv::Mat rot_mat = cv::getRotationMatrix2D(c_org, theta, 1.0f); diff --git a/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp b/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp index b921ae016..0a8ed2d94 100644 --- a/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp +++ b/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp @@ -104,7 +104,7 @@ void OgridManager::update_config(Config const& config) ogrid_.info.height = height_meters_ / resolution_meters_per_cell_; ogrid_.info.origin.position.x = -1. * width_meters_ / 2.; //-1. * width_meters_ * resolution_meters_per_cell_ / 2.; ogrid_.info.origin.position.y = - -1. * height_meters_ / 2.; // -1. * height_meters_ * resolution_meters_per_cell_ / 2.; + -1. * height_meters_ / 2.; // -1. * height_meters_ * resolution_meters_per_cell_ / 2.; ogrid_.info.origin.orientation.w = 1; ogrid_.data.resize(ogrid_.info.width * ogrid_.info.height); ogrid_mat_ = cv::Mat(cv::Size(ogrid_.info.width, ogrid_.info.height), CV_8UC1, ogrid_.data.data()); diff --git a/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp b/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp index 15e173034..31650c0a7 100644 --- a/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp @@ -28,7 +28,7 @@ TEST(HeartbeatMonitorTest, heartbeatMonitorTest) // Publish heartbeat ros::Publisher heartbeat_pub = nh.advertise(heartbeat_topic, 1000); - auto pub_valid = [&heartbeat_pub](bool valid) { // Can publish a valid or invalid heartbeat + auto pub_valid = [&heartbeat_pub](bool valid) { // Can publish a valid or invalid heartbeat std_msgs::String msg; msg.data = (valid ? "Will pass the predicate" : ""); // second one won't heartbeat_pub.publish(msg); @@ -97,7 +97,7 @@ TEST(HeartbeatMonitorTest, heartbeatMonitorTest) while (ros::Time::now() - hb_monitor.getLastBeatTime() < time_to_clear) // Shouldn't recover here, { // invalid heartbeat sleep_until(time_to_raise * 0.8, ros::Time::now()); - pub_valid(false); // False --> publish invalid heartbeat + pub_valid(false); // False --> publish invalid heartbeat } EXPECT_TRUE(listener.queryRaised()); diff --git a/mil_common/ros_alarms/test/roscpp/listener_test.cpp b/mil_common/ros_alarms/test/roscpp/listener_test.cpp index 2138546e5..a9367fe03 100644 --- a/mil_common/ros_alarms/test/roscpp/listener_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/listener_test.cpp @@ -127,7 +127,7 @@ TEST(ListenerTest, listenerTest) listener.addRaiseCb(raise_cb); // Use this overload for any severity raise listener.addClearCb(clear_cb); // Called for any clear of the alarm - ros::Duration latency(0.01); // Approximate upper bound on publisher latency + ros::Duration latency(0.01); // Approximate upper bound on publisher latency auto update_start = update_count; auto lo_start = lo_priority_raise_count; auto hi_start = hi_priority_raise_count; From 7791f499afdfe8a6f67eefcfc5a963d5f94a1ac9 Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Sat, 8 Apr 2023 19:41:25 -0400 Subject: [PATCH 06/19] Fix spelling mistakes for codespell --- .pre-commit-config.yaml | 2 +- .../navigator_missions/navigator_missions/navigator.py | 2 +- .../subjugator_missions/prequal_mission.py | 4 ++-- .../gnc/subjugator_controller/cfg/AdaptiveController.cfg | 2 +- docs/design/passive_sonar/passive_sonar.rst | 6 +++--- docs/subjugator/simulating.rst | 2 +- .../mil_vision_lib/image_acquisition/camera_frame.hpp | 2 +- .../perception/mil_vision/mil_vision_tools/image_mux.py | 6 +++--- .../utils/mil_tools/include/mil_tools/topic_recorder.hpp | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd00858d3..93b2c6fc4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,7 +49,7 @@ repos: hooks: - id: codespell args: - - --ignore-words-list=fpr,ser,wan,te,wan,ba,ned,ans,hist,nd + - --ignore-words-list=fpr,ser,wan,te,wan,ba,ned,ans,hist,nd,wronly - --skip="./.*,*.csv,*.json" - --quiet-level=2 exclude_types: [csv, json] diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py b/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py index 62c7bf5ec..d54ddf88f 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/navigator.py @@ -694,7 +694,7 @@ def _load_vision_services(cls, fname: str = "vision_services.yaml"): s_switch, ) except Exception as e: - err = f"Error loading vision sevices: {e}" + err = f"Error loading vision services: {e}" fprint("" + err, title="NAVIGATOR", msg_color="red") @classmethod diff --git a/SubjuGator/command/subjugator_missions/subjugator_missions/prequal_mission.py b/SubjuGator/command/subjugator_missions/subjugator_missions/prequal_mission.py index ccc447d56..0d23bff07 100755 --- a/SubjuGator/command/subjugator_missions/subjugator_missions/prequal_mission.py +++ b/SubjuGator/command/subjugator_missions/subjugator_missions/prequal_mission.py @@ -63,7 +63,7 @@ async def find_start_gate(self): upper = np.array([50, 50, 50], dtype="uint8") mask = cv2.inRange(hsv_img, lower, upper) - # publish mask for debuggin purposes + # publish mask for debugging purposes masked_msg = self.bridge.cv2_to_imgmsg(mask, "mono8") self.image_debug_pub.publish(masked_msg) @@ -139,7 +139,7 @@ async def find_marker(self): upper = np.array([50, 50, 50], dtype="uint8") mask = cv2.inRange(hsv_img, lower, upper) - # publish mask for debuggin purposes + # publish mask for debugging purposes masked_msg = self.bridge.cv2_to_imgmsg(mask, "mono8") self.image_debug_pub.publish(masked_msg) diff --git a/SubjuGator/gnc/subjugator_controller/cfg/AdaptiveController.cfg b/SubjuGator/gnc/subjugator_controller/cfg/AdaptiveController.cfg index 68d8a9f6b..498ce87a4 100755 --- a/SubjuGator/gnc/subjugator_controller/cfg/AdaptiveController.cfg +++ b/SubjuGator/gnc/subjugator_controller/cfg/AdaptiveController.cfg @@ -5,7 +5,7 @@ from dynamic_reconfigure.parameter_generator_catkin import * gen = ParameterGenerator() # using strings because there seems to be no vector support (currently) gen.add("kp", str_t, 0, "Proportional component", "500,500,500,1000,1000,1000") -gen.add("kd", str_t, 0, "Dirivitive component", "100,100,100,150,150,150") +gen.add("kd", str_t, 0, "Derivative component", "100,100,100,150,150,150") gen.add("ki", str_t, 0, "Dist regressor coeffs", "5,5,5,5,5,5") gen.add("kg", str_t, 0, "Drag regressor coeffs", "5,5,5,5,5,5") gen.add("use_learned", bool_t, 0, "", True) diff --git a/docs/design/passive_sonar/passive_sonar.rst b/docs/design/passive_sonar/passive_sonar.rst index 31c04d2e5..522368705 100644 --- a/docs/design/passive_sonar/passive_sonar.rst +++ b/docs/design/passive_sonar/passive_sonar.rst @@ -28,10 +28,10 @@ _________________________________ Visualize Data in the Pipeline ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -This pipline makes use of the ``mil_common/utils/mil_tools/mil_ros_tools/plotter.py`` utility to plot batches of data over on ROS Topics as CV2 images at most points in the processiong pipeline. +This pipeline makes use of the ``mil_common/utils/mil_tools/mil_ros_tools/plotter.py`` utility to plot batches of data over on ROS Topics as CV2 images at most points in the processiong pipeline. -To view all points of the triggering pipline -____________________________________________ +To view all points of the triggering pipeline +_____________________________________________ (raw, max convolution, gradient) that caused the most recent trigger (only hydrophone 0), look at ``/hydrophones/triggering/trigger_debug`` It should look something like this (30kHz): diff --git a/docs/subjugator/simulating.rst b/docs/subjugator/simulating.rst index b87e299ba..e386b81ac 100644 --- a/docs/subjugator/simulating.rst +++ b/docs/subjugator/simulating.rst @@ -31,7 +31,7 @@ to run the gazebogui with special parameters: $ gazebogui -This will show you ground truth of the simulated environment. However, when debuggin robot behavior, it is usually more usful to have an idea of exactly what the robot knows, which is why there is also Rviz. +This will show you ground truth of the simulated environment. However, when debugging robot behavior, it is usually more usful to have an idea of exactly what the robot knows, which is why there is also Rviz. Run RVIZ ~~~~~~~~ diff --git a/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame.hpp b/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame.hpp index 2deb7ef25..63f4c4c12 100644 --- a/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame.hpp +++ b/mil_common/perception/mil_vision/include/mil_vision_lib/image_acquisition/camera_frame.hpp @@ -211,7 +211,7 @@ class CameraFrame bool _rectified = false; // Scale of the image compared to that which would be generated by projecting using the camera - // geometry expresed in the associated camera model object + // geometry expressed in the associated camera model object float_t _img_scale = 1.0f; // Stores the pixel data type diff --git a/mil_common/perception/mil_vision/mil_vision_tools/image_mux.py b/mil_common/perception/mil_vision/mil_vision_tools/image_mux.py index 149ac1d55..ffc471a4a 100755 --- a/mil_common/perception/mil_vision/mil_vision_tools/image_mux.py +++ b/mil_common/perception/mil_vision/mil_vision_tools/image_mux.py @@ -236,15 +236,15 @@ def image( """ ImageMux is intended to be used as a class, not an executable. The following is an example of how to use it in a python program. - Creates a 2x2 grid of Racoon images with labels, using some custom parameters. + Creates a 2x2 grid of Raccoon images with labels, using some custom parameters. To run this yourself, download some images, put them in $HOME/Pictures/[1.jpg, 2.jpg, 3.jpg, 4.jpg] """ import os labels = [ - "Chubby Racoon", - "Kiddo Racoons", + "Chubby Raccoon", + "Kiddo Raccoons", "wide", "tall", "big wide", diff --git a/mil_common/utils/mil_tools/include/mil_tools/topic_recorder.hpp b/mil_common/utils/mil_tools/include/mil_tools/topic_recorder.hpp index 0fc12e4fc..12320f29a 100644 --- a/mil_common/utils/mil_tools/include/mil_tools/topic_recorder.hpp +++ b/mil_common/utils/mil_tools/include/mil_tools/topic_recorder.hpp @@ -17,7 +17,7 @@ Default behavior (direct implementation) every message on that topic is recordde Designed to be inherited and the Callback function overloaded so that messages are reorder according to an arbitrary function ie: - time:record every so many seconds(periodic) or location: every 1 m change in location(spacial). + time:record every so many seconds(periodic) or location: every 1 m change in location(spatial). see indyav_path path_recorder.cpp for an implementation example */ From 141e4573d0b85d972cf0968243565ad28716974a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 19:19:59 +0000 Subject: [PATCH 07/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/adrienverge/yamllint.git: v1.30.0 → v1.31.0](https://github.com/adrienverge/yamllint.git/compare/v1.30.0...v1.31.0) - [github.com/pre-commit/mirrors-clang-format: v16.0.0 → v16.0.2](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.0...v16.0.2) - [github.com/PyCQA/autoflake: v2.0.2 → v2.1.1](https://github.com/PyCQA/autoflake/compare/v2.0.2...v2.1.1) - [github.com/charliermarsh/ruff-pre-commit: v0.0.260 → v0.0.263](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.260...v0.0.263) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93b2c6fc4..3819bdf70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ ci: repos: - repo: https://github.com/adrienverge/yamllint.git - rev: v1.30.0 + rev: v1.31.0 hooks: - id: yamllint - repo: https://github.com/psf/black @@ -19,11 +19,11 @@ repos: hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.0 + rev: v16.0.2 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake - rev: v2.0.2 + rev: v2.1.1 hooks: - id: autoflake args: [--remove-all-unused-imports, --ignore-init-module-imports] @@ -40,7 +40,7 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/charliermarsh/ruff-pre-commit # Ruff version. - rev: 'v0.0.260' + rev: 'v0.0.263' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 547fecc913dd3b66906a5d28978d7b56321ac905 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 19:20:53 +0000 Subject: [PATCH 08/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../navigator_alarm/navigator_alarm_handlers/kill.py | 2 +- .../command/subjugator_alarm/alarm_handlers/kill.py | 4 ++-- .../sub8_adis16400_imu/include/adis16400_imu/driver.h | 10 +++++----- .../sub8_depth_driver/include/depth_driver/driver.h | 2 +- .../subjugator_perception/nodes/torpedo_board.cpp | 2 +- .../include/subjugator_build_tools/backward.hpp | 8 ++++---- docs/extensions/attributetable.py | 2 +- mil_common/gnc/rawgps_common/src/rawgps_common/gps.py | 3 +-- .../mil_vision/src/mil_vision_lib/active_contours.cpp | 2 +- .../mil_vision/src/mil_vision_lib/image_filtering.cpp | 2 +- .../src/ogrid_manager.cpp | 2 +- mil_common/ros_alarms/ros_alarms/handler_template.py | 2 +- .../ros_alarms/test/roscpp/heartbeat_monitor_test.cpp | 4 ++-- mil_common/ros_alarms/test/roscpp/listener_test.cpp | 2 +- 14 files changed, 23 insertions(+), 24 deletions(-) diff --git a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py index de42244da..a3f7a612b 100644 --- a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py +++ b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py @@ -54,7 +54,7 @@ def raised(self, alarm): rospy.logwarn("BAG_ALWAYS or BAG_KILL not set. Not making kill bag.") else: goal = BagOnlineGoal(bag_name="kill.bag") - goal.topics = os.environ["BAG_ALWAYS"] + " " + os.environ["bag_kill"] + goal.topics = os.environ["BAG_ALWAYS"] + " " + os.environ["BAG_KILL"] self.bag_client.send_goal(goal, done_cb=self._online_bagger_cb) self.task_client.run_mission("Killed", done_cb=self._kill_task_cb) diff --git a/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py b/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py index d0d751f0a..4781a760a 100644 --- a/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py +++ b/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py @@ -117,7 +117,7 @@ def bagger_dump(self): rospy.logwarn("BAG_ALWAYS or BAG_KILL not set. Not making kill bag.") return goal = BagOnlineGoal(bag_name="kill.bag") - goal.topics = os.environ["BAG_ALWAYS"] + " " + os.environ["bag_kill"] + goal.topics = os.environ["BAG_ALWAYS"] + " " + os.environ["BAG_KILL"] self.bag_client.send_goal(goal, done_cb=self._bag_done_cb) def meta_predicate(self, meta_alarm, sub_alarms): @@ -170,5 +170,5 @@ def meta_predicate(self, meta_alarm, sub_alarms): # Raised if any alarms besides the two above are raised return any( - [alarm.raised for name, alarm in sub_alarms.items() if name not in ignore], + alarm.raised for name, alarm in sub_alarms.items() if name not in ignore ) diff --git a/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h b/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h index b62785f36..c8fd95b78 100644 --- a/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h +++ b/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h @@ -70,7 +70,7 @@ class Device result.header.frame_id = frame_id; result.header.stamp = ros::Time::now(); - result.orientation_covariance[0] = -1; // indicate no orientation data + result.orientation_covariance[0] = -1; // indicate no orientation data static const double GYRO_CONVERSION = 0.05 * (2 * M_PI / 360); // convert to deg/s and then to rad/s result.angular_velocity.x = get16(data + 4 + 2 * 0) * GYRO_CONVERSION; @@ -78,7 +78,7 @@ class Device result.angular_velocity.z = get16(data + 4 + 2 * 2) * GYRO_CONVERSION; result.angular_velocity_covariance[0] = result.angular_velocity_covariance[4] = result.angular_velocity_covariance[8] = - pow(0.9 * (2 * M_PI / 360), 2); // 0.9 deg/sec rms converted to rad/sec and then squared + pow(0.9 * (2 * M_PI / 360), 2); // 0.9 deg/sec rms converted to rad/sec and then squared static const double ACC_CONVERSION = 3.33e-3 * 9.80665; // convert to g's and then to m/s^2 result.linear_acceleration.x = -get16(data + 10 + 2 * 0) * ACC_CONVERSION; @@ -99,9 +99,9 @@ class Device mag_result.magnetic_field_covariance[8] = pow(1.25e-3 * 0.0001, 2); // 1.25 mgauss converted to tesla and then squared - getu16(data + 0); // flags unused - getu16(data + 2) * 2.418e-3; // supply voltage unused - get16(data + 22) * 0.14 + 25; // temperature unused + getu16(data + 0); // flags unused + getu16(data + 2) * 2.418e-3; // supply voltage unused + get16(data + 22) * 0.14 + 25; // temperature unused return true; } diff --git a/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h b/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h index e9c287107..26cca97c3 100644 --- a/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h +++ b/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h @@ -166,7 +166,7 @@ class Device void send_heartbeat() { - send_packet(ByteVec()); // heartbeat + send_packet(ByteVec()); // heartbeat uint8_t msg[] = { 4, 1, 20 }; send_packet(ByteVec(msg, msg + sizeof(msg) / sizeof(msg[0]))); // StartPublishing 20hz } diff --git a/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp b/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp index a5f2aa352..51f57e387 100644 --- a/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp +++ b/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp @@ -1494,7 +1494,7 @@ void anisotropic_diffusion(const Mat &src, Mat &dest, int t_max) if (i == 0 || i == x0.rows - 1 || j == 0 || j == x0.cols - 1) // conduction coefficient set to d = 1; // 1 p633 after equation 13 else - d = 1.0 / (1 + (gx * gx + 0 * gy * gy) * K2); // expression of g(gradient(I)) + d = 1.0 / (1 + (gx * gx + 0 * gy * gy) * K2); // expression of g(gradient(I)) // d =-exp(-(gx*gx+gy*gy)*K2); // expression of g(gradient(I)) D.at(i, j) = d; } diff --git a/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp b/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp index 9c6f0316e..35f85d221 100644 --- a/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp +++ b/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp @@ -222,7 +222,7 @@ struct hashtable using std::move; } // namespace details } // namespace backward -#else // NOT BACKWARD_ATLEAST_CXX11 +#else // NOT BACKWARD_ATLEAST_CXX11 #include namespace backward { @@ -752,7 +752,7 @@ class StackTraceImpl : public StackTraceLinuxImplHolder }; }; -#else // BACKWARD_HAS_UNWIND == 0 +#else // BACKWARD_HAS_UNWIND == 0 template <> class StackTraceImpl : public StackTraceLinuxImplHolder @@ -1902,7 +1902,7 @@ class Colorize bool _istty; }; -#else // ndef BACKWARD_SYSTEM_LINUX +#else // ndef BACKWARD_SYSTEM_LINUX namespace Color { @@ -2152,7 +2152,7 @@ class SignalHandling StackTrace st; void* error_addr = 0; -#ifdef REG_RIP // x86_64 +#ifdef REG_RIP // x86_64 error_addr = reinterpret_cast(uctx->uc_mcontext.gregs[REG_RIP]); #elif defined(REG_EIP) // x86_32 error_addr = reinterpret_cast(uctx->uc_mcontext.gregs[REG_EIP]); diff --git a/docs/extensions/attributetable.py b/docs/extensions/attributetable.py index abc041ace..bfee064d7 100644 --- a/docs/extensions/attributetable.py +++ b/docs/extensions/attributetable.py @@ -340,7 +340,7 @@ def process_cppattributetable(app, doctree: Node, fromdocname): ], ) - elif all([c in node.attributes["classes"] for c in ["cpp", "function"]]): + elif all(c in node.attributes["classes"] for c in ["cpp", "function"]): # Get the signature line of the function, where its name is stored try: descriptions = [ diff --git a/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py b/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py index b6acd67db..81393bb3f 100644 --- a/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py +++ b/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py @@ -354,8 +354,7 @@ def predict_pos_deltat_r(self, t): assert abs(t_k) < week_length / 2 if not (abs(t_k) < 6 * 60 * 60): print( - "ERROR: ephemeris predicting more than 6 hours from now (%f hours)" - % (t_k / 60 / 60,), + f"ERROR: ephemeris predicting more than 6 hours from now ({t_k / 60 / 60:f} hours)", ) n = n_0 + self.Deltan M_k = self.M_0 + n * t_k diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp index b6b35bba6..46d902eee 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp @@ -135,7 +135,7 @@ void growRoute(const vector& partial, const vector& occupied, auto next_partial = partial; next_partial.push_back(new_elem); - auto next_tails = getHoodIdxs(new_elem, true); // true --> include border + auto next_tails = getHoodIdxs(new_elem, true); // true --> include border auto find_exit_itr = find(next_tails.begin(), next_tails.end(), exit); if (find_exit_itr != next_tails.end() && *find_exit_itr != tail) // add to cache if exit is a possible next tail { diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp index bbf89ff63..6643b6408 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp @@ -7,7 +7,7 @@ cv::Mat rotateKernel(const cv::Mat &kernel, float theta, bool deg, bool no_expan theta = deg ? theta : theta * mil_tools::PI / 180.0f; cv::Point2f c_org{ kernel.cols * 0.5f, kernel.rows * 0.5f }; // center of original - if (no_expand) // rotates without expanding the canvas + if (no_expand) // rotates without expanding the canvas { cv::Mat result; cv::Mat rot_mat = cv::getRotationMatrix2D(c_org, theta, 1.0f); diff --git a/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp b/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp index 0a8ed2d94..b921ae016 100644 --- a/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp +++ b/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp @@ -104,7 +104,7 @@ void OgridManager::update_config(Config const& config) ogrid_.info.height = height_meters_ / resolution_meters_per_cell_; ogrid_.info.origin.position.x = -1. * width_meters_ / 2.; //-1. * width_meters_ * resolution_meters_per_cell_ / 2.; ogrid_.info.origin.position.y = - -1. * height_meters_ / 2.; // -1. * height_meters_ * resolution_meters_per_cell_ / 2.; + -1. * height_meters_ / 2.; // -1. * height_meters_ * resolution_meters_per_cell_ / 2.; ogrid_.info.origin.orientation.w = 1; ogrid_.data.resize(ogrid_.info.width * ogrid_.info.height); ogrid_mat_ = cv::Mat(cv::Size(ogrid_.info.width, ogrid_.info.height), CV_8UC1, ogrid_.data.data()); diff --git a/mil_common/ros_alarms/ros_alarms/handler_template.py b/mil_common/ros_alarms/ros_alarms/handler_template.py index 966185a1d..90ae49350 100644 --- a/mil_common/ros_alarms/ros_alarms/handler_template.py +++ b/mil_common/ros_alarms/ros_alarms/handler_template.py @@ -105,4 +105,4 @@ def meta_predicate(self, meta_alarm: Alarm, alarms) -> Union[bool, Alarm]: should be raised, or a new Alarm object which the calling alarm should update itself to. """ - return any([alarm.raised for name, alarm in alarms.items()]) + return any(alarm.raised for name, alarm in alarms.items()) diff --git a/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp b/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp index 31650c0a7..15e173034 100644 --- a/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp @@ -28,7 +28,7 @@ TEST(HeartbeatMonitorTest, heartbeatMonitorTest) // Publish heartbeat ros::Publisher heartbeat_pub = nh.advertise(heartbeat_topic, 1000); - auto pub_valid = [&heartbeat_pub](bool valid) { // Can publish a valid or invalid heartbeat + auto pub_valid = [&heartbeat_pub](bool valid) { // Can publish a valid or invalid heartbeat std_msgs::String msg; msg.data = (valid ? "Will pass the predicate" : ""); // second one won't heartbeat_pub.publish(msg); @@ -97,7 +97,7 @@ TEST(HeartbeatMonitorTest, heartbeatMonitorTest) while (ros::Time::now() - hb_monitor.getLastBeatTime() < time_to_clear) // Shouldn't recover here, { // invalid heartbeat sleep_until(time_to_raise * 0.8, ros::Time::now()); - pub_valid(false); // False --> publish invalid heartbeat + pub_valid(false); // False --> publish invalid heartbeat } EXPECT_TRUE(listener.queryRaised()); diff --git a/mil_common/ros_alarms/test/roscpp/listener_test.cpp b/mil_common/ros_alarms/test/roscpp/listener_test.cpp index a9367fe03..2138546e5 100644 --- a/mil_common/ros_alarms/test/roscpp/listener_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/listener_test.cpp @@ -127,7 +127,7 @@ TEST(ListenerTest, listenerTest) listener.addRaiseCb(raise_cb); // Use this overload for any severity raise listener.addClearCb(clear_cb); // Called for any clear of the alarm - ros::Duration latency(0.01); // Approximate upper bound on publisher latency + ros::Duration latency(0.01); // Approximate upper bound on publisher latency auto update_start = update_count; auto lo_start = lo_priority_raise_count; auto hi_start = hi_priority_raise_count; From 3728f5c33226e327699757f1ca0f344f74a8d62b Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Wed, 31 May 2023 19:08:57 -0700 Subject: [PATCH 09/19] Update files to match new pre-commit updates --- .../navigator_missions/constant_velocity.py | 2 +- .../sub8_adis16400_imu/include/adis16400_imu/driver.h | 10 +++++----- .../sub8_depth_driver/include/depth_driver/driver.h | 2 +- .../subjugator_perception/nodes/torpedo_board.cpp | 2 +- .../include/subjugator_build_tools/backward.hpp | 8 ++++---- .../mil_vision/src/mil_vision_lib/active_contours.cpp | 2 +- .../mil_vision/src/mil_vision_lib/image_filtering.cpp | 2 +- .../src/ogrid_manager.cpp | 2 +- .../ros_alarms/test/roscpp/heartbeat_monitor_test.cpp | 4 ++-- mil_common/ros_alarms/test/roscpp/listener_test.cpp | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py b/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py index c9a5a503b..5ae078c90 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py @@ -61,7 +61,7 @@ def decode_parameters(cls, parameters): if not isinstance(parsed, list) or len(parsed) != 3: raise err for i in range(3): - if not (isinstance(parsed[i], int) or isinstance(parsed[i], float)): + if not (isinstance(parsed[i], (int, float))): raise err return parsed diff --git a/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h b/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h index b62785f36..c8fd95b78 100644 --- a/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h +++ b/SubjuGator/drivers/sub8_adis16400_imu/include/adis16400_imu/driver.h @@ -70,7 +70,7 @@ class Device result.header.frame_id = frame_id; result.header.stamp = ros::Time::now(); - result.orientation_covariance[0] = -1; // indicate no orientation data + result.orientation_covariance[0] = -1; // indicate no orientation data static const double GYRO_CONVERSION = 0.05 * (2 * M_PI / 360); // convert to deg/s and then to rad/s result.angular_velocity.x = get16(data + 4 + 2 * 0) * GYRO_CONVERSION; @@ -78,7 +78,7 @@ class Device result.angular_velocity.z = get16(data + 4 + 2 * 2) * GYRO_CONVERSION; result.angular_velocity_covariance[0] = result.angular_velocity_covariance[4] = result.angular_velocity_covariance[8] = - pow(0.9 * (2 * M_PI / 360), 2); // 0.9 deg/sec rms converted to rad/sec and then squared + pow(0.9 * (2 * M_PI / 360), 2); // 0.9 deg/sec rms converted to rad/sec and then squared static const double ACC_CONVERSION = 3.33e-3 * 9.80665; // convert to g's and then to m/s^2 result.linear_acceleration.x = -get16(data + 10 + 2 * 0) * ACC_CONVERSION; @@ -99,9 +99,9 @@ class Device mag_result.magnetic_field_covariance[8] = pow(1.25e-3 * 0.0001, 2); // 1.25 mgauss converted to tesla and then squared - getu16(data + 0); // flags unused - getu16(data + 2) * 2.418e-3; // supply voltage unused - get16(data + 22) * 0.14 + 25; // temperature unused + getu16(data + 0); // flags unused + getu16(data + 2) * 2.418e-3; // supply voltage unused + get16(data + 22) * 0.14 + 25; // temperature unused return true; } diff --git a/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h b/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h index e9c287107..26cca97c3 100644 --- a/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h +++ b/SubjuGator/drivers/sub8_depth_driver/include/depth_driver/driver.h @@ -166,7 +166,7 @@ class Device void send_heartbeat() { - send_packet(ByteVec()); // heartbeat + send_packet(ByteVec()); // heartbeat uint8_t msg[] = { 4, 1, 20 }; send_packet(ByteVec(msg, msg + sizeof(msg) / sizeof(msg[0]))); // StartPublishing 20hz } diff --git a/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp b/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp index a5f2aa352..51f57e387 100644 --- a/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp +++ b/SubjuGator/perception/subjugator_perception/nodes/torpedo_board.cpp @@ -1494,7 +1494,7 @@ void anisotropic_diffusion(const Mat &src, Mat &dest, int t_max) if (i == 0 || i == x0.rows - 1 || j == 0 || j == x0.cols - 1) // conduction coefficient set to d = 1; // 1 p633 after equation 13 else - d = 1.0 / (1 + (gx * gx + 0 * gy * gy) * K2); // expression of g(gradient(I)) + d = 1.0 / (1 + (gx * gx + 0 * gy * gy) * K2); // expression of g(gradient(I)) // d =-exp(-(gx*gx+gy*gy)*K2); // expression of g(gradient(I)) D.at(i, j) = d; } diff --git a/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp b/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp index 9c6f0316e..35f85d221 100644 --- a/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp +++ b/SubjuGator/utils/subjugator_build_tools/include/subjugator_build_tools/backward.hpp @@ -222,7 +222,7 @@ struct hashtable using std::move; } // namespace details } // namespace backward -#else // NOT BACKWARD_ATLEAST_CXX11 +#else // NOT BACKWARD_ATLEAST_CXX11 #include namespace backward { @@ -752,7 +752,7 @@ class StackTraceImpl : public StackTraceLinuxImplHolder }; }; -#else // BACKWARD_HAS_UNWIND == 0 +#else // BACKWARD_HAS_UNWIND == 0 template <> class StackTraceImpl : public StackTraceLinuxImplHolder @@ -1902,7 +1902,7 @@ class Colorize bool _istty; }; -#else // ndef BACKWARD_SYSTEM_LINUX +#else // ndef BACKWARD_SYSTEM_LINUX namespace Color { @@ -2152,7 +2152,7 @@ class SignalHandling StackTrace st; void* error_addr = 0; -#ifdef REG_RIP // x86_64 +#ifdef REG_RIP // x86_64 error_addr = reinterpret_cast(uctx->uc_mcontext.gregs[REG_RIP]); #elif defined(REG_EIP) // x86_32 error_addr = reinterpret_cast(uctx->uc_mcontext.gregs[REG_EIP]); diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp index b6b35bba6..46d902eee 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/active_contours.cpp @@ -135,7 +135,7 @@ void growRoute(const vector& partial, const vector& occupied, auto next_partial = partial; next_partial.push_back(new_elem); - auto next_tails = getHoodIdxs(new_elem, true); // true --> include border + auto next_tails = getHoodIdxs(new_elem, true); // true --> include border auto find_exit_itr = find(next_tails.begin(), next_tails.end(), exit); if (find_exit_itr != next_tails.end() && *find_exit_itr != tail) // add to cache if exit is a possible next tail { diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp index bbf89ff63..6643b6408 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/image_filtering.cpp @@ -7,7 +7,7 @@ cv::Mat rotateKernel(const cv::Mat &kernel, float theta, bool deg, bool no_expan theta = deg ? theta : theta * mil_tools::PI / 180.0f; cv::Point2f c_org{ kernel.cols * 0.5f, kernel.rows * 0.5f }; // center of original - if (no_expand) // rotates without expanding the canvas + if (no_expand) // rotates without expanding the canvas { cv::Mat result; cv::Mat rot_mat = cv::getRotationMatrix2D(c_org, theta, 1.0f); diff --git a/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp b/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp index 0a8ed2d94..b921ae016 100644 --- a/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp +++ b/mil_common/perception/point_cloud_object_detection_and_recognition/src/ogrid_manager.cpp @@ -104,7 +104,7 @@ void OgridManager::update_config(Config const& config) ogrid_.info.height = height_meters_ / resolution_meters_per_cell_; ogrid_.info.origin.position.x = -1. * width_meters_ / 2.; //-1. * width_meters_ * resolution_meters_per_cell_ / 2.; ogrid_.info.origin.position.y = - -1. * height_meters_ / 2.; // -1. * height_meters_ * resolution_meters_per_cell_ / 2.; + -1. * height_meters_ / 2.; // -1. * height_meters_ * resolution_meters_per_cell_ / 2.; ogrid_.info.origin.orientation.w = 1; ogrid_.data.resize(ogrid_.info.width * ogrid_.info.height); ogrid_mat_ = cv::Mat(cv::Size(ogrid_.info.width, ogrid_.info.height), CV_8UC1, ogrid_.data.data()); diff --git a/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp b/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp index 31650c0a7..15e173034 100644 --- a/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/heartbeat_monitor_test.cpp @@ -28,7 +28,7 @@ TEST(HeartbeatMonitorTest, heartbeatMonitorTest) // Publish heartbeat ros::Publisher heartbeat_pub = nh.advertise(heartbeat_topic, 1000); - auto pub_valid = [&heartbeat_pub](bool valid) { // Can publish a valid or invalid heartbeat + auto pub_valid = [&heartbeat_pub](bool valid) { // Can publish a valid or invalid heartbeat std_msgs::String msg; msg.data = (valid ? "Will pass the predicate" : ""); // second one won't heartbeat_pub.publish(msg); @@ -97,7 +97,7 @@ TEST(HeartbeatMonitorTest, heartbeatMonitorTest) while (ros::Time::now() - hb_monitor.getLastBeatTime() < time_to_clear) // Shouldn't recover here, { // invalid heartbeat sleep_until(time_to_raise * 0.8, ros::Time::now()); - pub_valid(false); // False --> publish invalid heartbeat + pub_valid(false); // False --> publish invalid heartbeat } EXPECT_TRUE(listener.queryRaised()); diff --git a/mil_common/ros_alarms/test/roscpp/listener_test.cpp b/mil_common/ros_alarms/test/roscpp/listener_test.cpp index a9367fe03..2138546e5 100644 --- a/mil_common/ros_alarms/test/roscpp/listener_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/listener_test.cpp @@ -127,7 +127,7 @@ TEST(ListenerTest, listenerTest) listener.addRaiseCb(raise_cb); // Use this overload for any severity raise listener.addClearCb(clear_cb); // Called for any clear of the alarm - ros::Duration latency(0.01); // Approximate upper bound on publisher latency + ros::Duration latency(0.01); // Approximate upper bound on publisher latency auto update_start = update_count; auto lo_start = lo_priority_raise_count; auto hi_start = hi_priority_raise_count; From bb6d831273faad6d46100f90b33a82f7a8bd27df Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:45:20 +0000 Subject: [PATCH 10/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0) - [github.com/pre-commit/mirrors-clang-format: v16.0.4 → v16.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.4...v16.0.6) - [github.com/PyCQA/autoflake: v2.1.1 → v2.2.0](https://github.com/PyCQA/autoflake/compare/v2.1.1...v2.2.0) - [github.com/scop/pre-commit-shfmt: v3.6.0-2 → v3.7.0-1](https://github.com/scop/pre-commit-shfmt/compare/v3.6.0-2...v3.7.0-1) - https://github.com/charliermarsh/ruff-pre-commit → https://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.270 → v0.0.282](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.270...v0.0.282) - [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](https://github.com/codespell-project/codespell/compare/v2.2.4...v2.2.5) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2f0e2009..cb5d978ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,15 +15,15 @@ repos: hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.4 + rev: v16.0.6 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake - rev: v2.1.1 + rev: v2.2.0 hooks: - id: autoflake args: [--remove-all-unused-imports, --ignore-init-module-imports] @@ -34,18 +34,18 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX args: [--severity=warning, --exclude=SC1090] - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.6.0-2 + rev: v3.7.0-1 hooks: - id: shfmt exclude: ^docker|deprecated|NaviGator/simulation/VRX - - repo: https://github.com/charliermarsh/ruff-pre-commit + - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.0.270' + rev: 'v0.0.282' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell args: From 00a075eb4b32df382dfcebc296948dfea4c715e8 Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Mon, 7 Aug 2023 18:10:29 -0700 Subject: [PATCH 11/19] Update with pre-commit changes --- .../nodes/ogrid_arbiter.py | 5 +-- .../navigator_thrust_mapper/thruster_map.py | 16 ++------ .../navigator_alarm_handlers/kill.py | 10 +---- .../thruster_fault.py | 4 +- .../navigator_missions/detect_deliver_2016.py | 18 ++------- .../navigator_missions/identify_dock.py | 5 +-- .../navigator_missions/move.py | 4 +- .../navigator_missions/navigation.py | 4 +- .../vrx_missions/vrx_navigation.py | 4 +- .../vrx_missions/vrx_perception.py | 6 +-- .../test/test_sim_integration.py | 39 +++---------------- .../nodes/robotx_comms_client.py | 5 +-- .../navigator_tools/object_database_helper.py | 2 +- .../subjugator_alarm/alarm_handlers/kill.py | 5 +-- .../alarm_handlers/odom_kill.py | 8 +--- .../teleop_twist_keyboard.py | 4 +- .../subjugator_missions/arm_torpedos.py | 4 +- .../subjugator_missions/start_gate.py | 9 +---- .../subjugator_missions/sub_singleton.py | 2 +- .../scripts/generate_config | 4 +- .../sub8_thrust_and_kill_board/handle.py | 4 +- .../sub8_thrust_and_kill_board/packets.py | 5 +-- .../path_marker/path_localizer.py | 2 +- .../mil_usb_to_can/sub8/sub8_driver.py | 4 +- .../mil_usb_to_can/sub8/utils.py | 5 +-- .../mil_missions_gui/dashboard.py | 13 +++---- mil_common/mil_missions/nodes/mission_client | 4 +- .../mil_missions/test/test_import_missions.py | 5 +-- .../mil_vision/mil_vision_tools/cv_tools.py | 6 +-- .../mil_ros_tools/extract_bag_images.py | 15 ++----- .../mil_tools/mil_ros_tools/label_me_bag.py | 5 +-- .../mil_tools/mil_ros_tools/msg_helpers.py | 5 +-- .../utils/mil_tools/nodes/online_bagger.py | 5 +-- mil_common/utils/mil_tools/nodes/tf_fudger.py | 5 +-- .../utils/mil_tools/nodes/tf_to_gazebo.py | 7 +--- ruff.toml | 1 + 36 files changed, 57 insertions(+), 192 deletions(-) diff --git a/NaviGator/gnc/navigator_msg_multiplexer/nodes/ogrid_arbiter.py b/NaviGator/gnc/navigator_msg_multiplexer/nodes/ogrid_arbiter.py index ac8fffd4f..eb425ec7a 100755 --- a/NaviGator/gnc/navigator_msg_multiplexer/nodes/ogrid_arbiter.py +++ b/NaviGator/gnc/navigator_msg_multiplexer/nodes/ogrid_arbiter.py @@ -493,10 +493,7 @@ def publish(self, timer_event): ) print(e) fprint( - "w: {}, h: {}".format( - global_ogrid.info.width, - global_ogrid.info.height, - ), + f"w: {global_ogrid.info.width}, h: {global_ogrid.info.height}", msg_color="red", ) diff --git a/NaviGator/gnc/navigator_thrust_mapper/navigator_thrust_mapper/thruster_map.py b/NaviGator/gnc/navigator_thrust_mapper/navigator_thrust_mapper/thruster_map.py index 588679455..2fc19700a 100644 --- a/NaviGator/gnc/navigator_thrust_mapper/navigator_thrust_mapper/thruster_map.py +++ b/NaviGator/gnc/navigator_thrust_mapper/navigator_thrust_mapper/thruster_map.py @@ -166,15 +166,11 @@ def from_urdf( if find != -1 and find + len(transmission_suffix) == len(transmission.name): if len(transmission.joints) != 1: raise Exception( - "Transmission {} does not have 1 joint".format( - transmission.name, - ), + f"Transmission {transmission.name} does not have 1 joint", ) if len(transmission.actuators) != 1: raise Exception( - "Transmission {} does not have 1 actuator".format( - transmission.name, - ), + f"Transmission {transmission.name} does not have 1 actuator", ) t_ratio = transmission.actuators[0].mechanicalReduction @@ -195,9 +191,7 @@ def from_urdf( joint = t_joint if joint is None: rospy.logerr( - "Transmission joint {} not found".format( - transmission.joints[0].name, - ), + f"Transmission joint {transmission.joints[0].name} not found", ) try: trans = buff.lookup_transform( @@ -217,9 +211,7 @@ def from_urdf( joints.append(joint.name) if limit != -1 and joint.limit.effort != limit: raise Exception( - "Thruster {} had a different limit, cannot proceed".format( - joint.name, - ), + f"Thruster {joint.name} had a different limit, cannot proceed", ) limit = joint.limit.effort limit_tuple = (limit, -limit) diff --git a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py index a3f7a612b..547c56fa8 100644 --- a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py +++ b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/kill.py @@ -28,10 +28,7 @@ def _online_bagger_cb(self, status, result): rospy.loginfo(f"KILL BAG WRITTEN TO {result.filename}") else: rospy.logwarn( - "KILL BAG {}, status: {}".format( - TerminalState.to_string(status), - result.status, - ), + f"KILL BAG {TerminalState.to_string(status)}, status: {result.status}", ) def _kill_task_cb(self, status, result): @@ -39,10 +36,7 @@ def _kill_task_cb(self, status, result): rospy.loginfo("Killed task success!") return rospy.logwarn( - "Killed task failed ({}): {}".format( - TerminalState.to_string(status), - result.result, - ), + f"Killed task failed ({TerminalState.to_string(status)}): {result.result}", ) def raised(self, alarm): diff --git a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/thruster_fault.py b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/thruster_fault.py index a89612632..ce89ac3a0 100644 --- a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/thruster_fault.py +++ b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/thruster_fault.py @@ -65,9 +65,7 @@ def _check_faults(self, msg, topic): return self.broadcaster.raise_alarm( severity=5, - problem_description="{} thrusters have faults".format( - len(self._raised_alarms), - ), + problem_description=f"{len(self._raised_alarms)} thrusters have faults", parameters={ t: self._get_fault_codes(k) for t, k in self._raised_alarms.items() }, diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py b/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py index bc95612b0..28c3ac4d9 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py @@ -240,10 +240,7 @@ async def search_sides(self, moves): self.shape_pose = found_pose return fprint( - "Saw (Shape={}, Color={}) on this side".format( - shape_color[0], - shape_color[1], - ), + f"Saw (Shape={shape_color[0]}, Color={shape_color[1]}) on this side", title="DETECT DELIVER", msg_color="green", ) @@ -287,10 +284,7 @@ def select_backup_shape(self): self.shape_pose = point_normal if self.Shape == shape or self.Color == color: fprint( - "Correct shape not found, resorting to shape={} color={}".format( - shape, - color, - ), + f"Correct shape not found, resorting to shape={shape} color={color}", title="DETECT DELIVER", msg_color="yellow", ) @@ -430,9 +424,7 @@ async def shoot_and_align_forest(self): move = await self.align_to_target() if move.failure_reason != "": fprint( - "Error Aligning with target = {}. Ending mission :(".format( - move.failure_reason, - ), + f"Error Aligning with target = {move.failure_reason}. Ending mission :(", title="DETECT DELIVER", msg_color="red", ) @@ -479,9 +471,7 @@ async def shoot_and_align(self): move = await self.align_to_target() if move.failure_reason != "": fprint( - "Error Aligning with target = {}. Ending mission :(".format( - move.failure_reason, - ), + f"Error Aligning with target = {move.failure_reason}. Ending mission :(", title="DETECT DELIVER", msg_color="red", ) diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/identify_dock.py b/NaviGator/mission_control/navigator_missions/navigator_missions/identify_dock.py index 28419f6b6..6d2203826 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/identify_dock.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/identify_dock.py @@ -150,10 +150,7 @@ async def check_bays(self): def update_shape(self, shape_res, normal_res, tf): print_good( - "Found (Shape={}, Color={} in a bay".format( - shape_res.Shape, - shape_res.Color, - ), + f"Found (Shape={shape_res.Shape}, Color={shape_res.Color} in a bay", ) self.identified_shapes[(shape_res.Shape, shape_res.Color)] = self.get_shape_pos( normal_res, diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/move.py b/NaviGator/mission_control/navigator_missions/navigator_missions/move.py index 03017c09b..8ae428057 100755 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/move.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/move.py @@ -149,9 +149,7 @@ async def run(self, args): "yl": "yaw_left", "yr": "yaw_right", } - command = ( - command if command not in shorthand.keys() else shorthand[command] - ) + command = command if command not in shorthand else shorthand[command] movement = getattr(self.move, command) trans_move = command[:3] != "yaw" diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/navigation.py b/NaviGator/mission_control/navigator_missions/navigator_missions/navigation.py index 9b977b0bf..7812e5108 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/navigation.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/navigation.py @@ -187,9 +187,7 @@ async def explore_closest_until(self, is_done, filter_and_sort): ) if classification_index != -1: self.send_feedback( - "{} identified. Canceling investigation".format( - move_id_tuple[1], - ), + f"{move_id_tuple[1]} identified. Canceling investigation", ) move_task.cancel() diff --git a/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_navigation.py b/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_navigation.py index 3086e39b5..7ef98c064 100644 --- a/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_navigation.py +++ b/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_navigation.py @@ -151,9 +151,7 @@ async def explore_closest_until(self, is_done, filter_and_sort): ) if classification_index != -1: self.send_feedback( - "{} identified. Canceling investigation".format( - move_id_tuple[1], - ), + f"{move_id_tuple[1]} identified. Canceling investigation", ) move_id_tuple[0].cancel() await self.nh.sleep(1.0) diff --git a/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_perception.py b/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_perception.py index f1483416f..2b1ef6d50 100644 --- a/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_perception.py +++ b/NaviGator/mission_control/navigator_missions/vrx_missions/vrx_perception.py @@ -79,11 +79,7 @@ async def run(self, parameters): ) elif objects[key] != new_objects[key]: self.send_feedback( - "{} changed from {} to {}".format( - key, - objects[key], - new_objects[key], - ), + f"{key} changed from {objects[key]} to {new_objects[key]}", ) await self.announce_object( key, diff --git a/NaviGator/simulation/navigator_gazebo/test/test_sim_integration.py b/NaviGator/simulation/navigator_gazebo/test/test_sim_integration.py index 3cb7ab8a7..46e20b856 100755 --- a/NaviGator/simulation/navigator_gazebo/test/test_sim_integration.py +++ b/NaviGator/simulation/navigator_gazebo/test/test_sim_integration.py @@ -71,10 +71,7 @@ def test_odom(self): rospy.sleep(0.1) self.assertTrue( len(self.odom_pos_msg) == 3 and len(self.odom_ori_msg) == 4, - msg="POS, ORI: {}, {}".format( - len(self.odom_pos_msg), - len(self.odom_ori_msg), - ), + msg=f"POS, ORI: {len(self.odom_pos_msg)}, {len(self.odom_ori_msg)}", ) initial_pos = [-1.2319, 0.0, 0.0] initial_ori = [0.0, 0.0, 0.0, 1.0] @@ -100,10 +97,7 @@ def test_absodom(self): rospy.sleep(0.1) self.assertTrue( len(self.absodom_pos_msg) == 3 and len(self.absodom_ori_msg) == 4, - msg="POS, ORI: {}, {}".format( - len(self.absodom_pos_msg), - len(self.absodom_ori_msg), - ), + msg=f"POS, ORI: {len(self.absodom_pos_msg)}, {len(self.absodom_ori_msg)}", ) initial_pos = [743789.637462, -5503821.36715, 3125622.10477] initial_ori = [0.0, 0.0, 0.0, 1.0] @@ -122,25 +116,13 @@ def verify_pos_ori(self, pos, initial_pos, ori, initial_ori, topic): actual, initial, places=0, - msg=( - "Error: {} position is: {} should be {}".format( - topic, - actual, - initial, - ) - ), + msg=(f"Error: {topic} position is: {actual} should be {initial}"), ) for actual, initial in zip(ori, initial_ori): self.assertEqual( actual, initial, - msg=( - "Error: {} orientation is: {} should be {}".format( - topic, - actual, - initial, - ) - ), + msg=(f"Error: {topic} orientation is: {actual} should be {initial}"), ) def cam_info_right_cb(self, msg): @@ -229,10 +211,7 @@ def verify_not_empty(self, data_lists, num_topics): self.assertEqual( len(data_lists), num_topics, - msg="Number of topics is {}, should be {}".format( - len(data_lists), - num_topics, - ), + msg=f"Number of topics is {len(data_lists)}, should be {num_topics}", ) for data_list in data_lists: self.assertNotEqual(len(data_list), 0, msg="data is empty") @@ -243,13 +222,7 @@ def verify_info(self, res_info, initial_info, topic): self.assertNotEqual( actual_dim, initial_dim, - msg=( - "Error: {} is: {} shouldn't be {}".format( - topic, - actual_dim, - initial_dim, - ) - ), + msg=(f"Error: {topic} is: {actual_dim} shouldn't be {initial_dim}"), ) diff --git a/NaviGator/utils/navigator_robotx_comms/nodes/robotx_comms_client.py b/NaviGator/utils/navigator_robotx_comms/nodes/robotx_comms_client.py index d8583f010..59e6139e3 100755 --- a/NaviGator/utils/navigator_robotx_comms/nodes/robotx_comms_client.py +++ b/NaviGator/utils/navigator_robotx_comms/nodes/robotx_comms_client.py @@ -559,10 +559,7 @@ def connect(self) -> None: """ if not self.connected: rospy.loginfo( - "Attempting Connection to TD Server at {}:{}".format( - self.tcp_ip, - self.tcp_port, - ), + f"Attempting Connection to TD Server at {self.tcp_ip}:{self.tcp_port}", ) while not self.connected and not rospy.is_shutdown(): # recreate socket diff --git a/NaviGator/utils/navigator_tools/navigator_tools/object_database_helper.py b/NaviGator/utils/navigator_tools/navigator_tools/object_database_helper.py index 0798c78e0..7d73fc1aa 100644 --- a/NaviGator/utils/navigator_tools/navigator_tools/object_database_helper.py +++ b/NaviGator/utils/navigator_tools/navigator_tools/object_database_helper.py @@ -50,7 +50,7 @@ async def get_object_by_id(self, my_id): req = ObjectDBQueryRequest() req.name = "all" resp = await self._database(req) - ans = [obj for obj in resp.objects if obj.id == my_id][0] + ans = next(obj for obj in resp.objects if obj.id == my_id) return ans async def begin_observing(self, cb): diff --git a/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py b/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py index 4781a760a..4055694d8 100644 --- a/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py +++ b/SubjuGator/command/subjugator_alarm/alarm_handlers/kill.py @@ -101,10 +101,7 @@ def _bag_done_cb(self, status, result): rospy.loginfo(f"KILL BAG WRITTEN TO {result.filename}") else: rospy.logwarn( - "KILL BAG {}, status: {}".format( - TerminalState.to_string(status), - result.status, - ), + f"KILL BAG {TerminalState.to_string(status)}, status: {result.status}", ) def bagger_dump(self): diff --git a/SubjuGator/command/subjugator_alarm/alarm_handlers/odom_kill.py b/SubjuGator/command/subjugator_alarm/alarm_handlers/odom_kill.py index 4a7638909..90a8e817b 100644 --- a/SubjuGator/command/subjugator_alarm/alarm_handlers/odom_kill.py +++ b/SubjuGator/command/subjugator_alarm/alarm_handlers/odom_kill.py @@ -101,9 +101,7 @@ def check_continuity(self, new_odom_msg: Odometry): # True if 'continuous' if jump > self.MAX_JUMP: rospy.logerr("ODOM DISCONTINUITY DETECTED") self.ab.raise_alarm( - problem_description="ODOM DISCONTINUITY DETECTED JUMPED {} METERS".format( - jump, - ), + problem_description=f"ODOM DISCONTINUITY DETECTED JUMPED {jump} METERS", severity=5, ) self.odom_discontinuity = True @@ -120,9 +118,7 @@ def need_kill(self): if odom_loss: rospy.logerr_throttle( 1, - "LOST ODOM FOR {} SECONDS".format( - (rospy.Time.now() - self.last_time).to_sec(), - ), + f"LOST ODOM FOR {(rospy.Time.now() - self.last_time).to_sec()} SECONDS", ) self.ab.raise_alarm( problem_description="LOST ODOM FOR {} SECONDS".format( diff --git a/SubjuGator/command/subjugator_keyboard_control/teleop_twist_keyboard.py b/SubjuGator/command/subjugator_keyboard_control/teleop_twist_keyboard.py index ea5c7bedb..870df6ac7 100755 --- a/SubjuGator/command/subjugator_keyboard_control/teleop_twist_keyboard.py +++ b/SubjuGator/command/subjugator_keyboard_control/teleop_twist_keyboard.py @@ -141,9 +141,7 @@ def wait_for_subscribers(self): while not rospy.is_shutdown() and self.publisher.get_num_connections() == 0: if i == 4: print( - "Waiting for subscriber to connect to {}".format( - self.publisher.name, - ), + f"Waiting for subscriber to connect to {self.publisher.name}", ) rospy.sleep(0.5) i += 1 diff --git a/SubjuGator/command/subjugator_missions/subjugator_missions/arm_torpedos.py b/SubjuGator/command/subjugator_missions/subjugator_missions/arm_torpedos.py index aad130049..7a88e8908 100644 --- a/SubjuGator/command/subjugator_missions/subjugator_missions/arm_torpedos.py +++ b/SubjuGator/command/subjugator_missions/subjugator_missions/arm_torpedos.py @@ -170,9 +170,7 @@ async def fire(self, target: str): ) self.print_good( - "{} locked. Firing torpedoes. Hit confirmed, good job Commander.".format( - target, - ), + f"{target} locked. Firing torpedoes. Hit confirmed, good job Commander.", ) sub_pos = await self.tx_pose() print("Current Sub Position: ", sub_pos) diff --git a/SubjuGator/command/subjugator_missions/subjugator_missions/start_gate.py b/SubjuGator/command/subjugator_missions/subjugator_missions/start_gate.py index f395bd1e0..0886298e1 100644 --- a/SubjuGator/command/subjugator_missions/subjugator_missions/start_gate.py +++ b/SubjuGator/command/subjugator_missions/subjugator_missions/start_gate.py @@ -160,9 +160,7 @@ def find_gate( p2 = rosmsg_to_numpy(o2.pose.position) if distance.euclidean(p, p2) > max_distance_away: fprint( - "Poles too far away. Distance {}".format( - distance.euclidean(p, p2), - ), + f"Poles too far away. Distance {distance.euclidean(p, p2)}", ) continue if distance.euclidean(p, p2) < min_distance_away: @@ -180,10 +178,7 @@ def find_gate( continue if abs(line[0]) < 1 and abs(line[1]) < 1: fprint( - "Objects on top of one another. x {}, y {}".format( - line[0], - line[1], - ), + f"Objects on top of one another. x {line[0]}, y {line[1]}", ) continue return (p, p2) diff --git a/SubjuGator/command/subjugator_missions/subjugator_missions/sub_singleton.py b/SubjuGator/command/subjugator_missions/subjugator_missions/sub_singleton.py index 693fc3bd7..8e498fc4d 100644 --- a/SubjuGator/command/subjugator_missions/subjugator_missions/sub_singleton.py +++ b/SubjuGator/command/subjugator_missions/subjugator_missions/sub_singleton.py @@ -599,7 +599,7 @@ async def start_search_in_cone( distance_tol: float = 10, speed: float = 0.5, clear: bool = False, - c_func: Callable = None, + c_func: Callable | None = None, ): if clear: print("SONAR_OBJECTS: clearing pointcloud") diff --git a/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config b/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config index 5d12dad06..f818bd613 100755 --- a/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config +++ b/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config @@ -110,9 +110,7 @@ def test(): assert numpy.allclose( shift2, shift, - ), "Magnetic Hardsoft Compenstion self-test failed, shifts: {}".format( - (shift2, shift), - ) + ), f"Magnetic Hardsoft Compenstion self-test failed, shifts: {(shift2, shift)}" assert ( error < 1e-5 ), f"Magnetic Hardsoft Compenstion self-test failed, error: {error}" diff --git a/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/handle.py b/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/handle.py index c62f5732b..19df02c33 100644 --- a/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/handle.py +++ b/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/handle.py @@ -109,9 +109,7 @@ def on_command(self, msg: Thrust) -> None: # If we don't have a mapping for this thruster, ignore it if cmd.name not in self.thrusters: rospy.logwarn( - "Command received for {}, but this is not a thruster.".format( - cmd.name, - ), + f"Command received for {cmd.name}, but this is not a thruster.", ) continue # Map commanded thrust (in newetons) to effort value (-1 to 1) diff --git a/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/packets.py b/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/packets.py index 8cc3a0f27..dcd1aaa0b 100644 --- a/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/packets.py +++ b/SubjuGator/drivers/sub8_thrust_and_kill_board/sub8_thrust_and_kill_board/packets.py @@ -287,7 +287,4 @@ def command(self) -> float: return struct.unpack("f", self.payload[1:])[0] def __str__(self): - return "ThrustPacket(thruster_id={}, command={})".format( - self.thruster_id, - self.command, - ) + return f"ThrustPacket(thruster_id={self.thruster_id}, command={self.command})" diff --git a/SubjuGator/perception/subjugator_perception/ml_classifiers/path_marker/path_localizer.py b/SubjuGator/perception/subjugator_perception/ml_classifiers/path_marker/path_localizer.py index 29665f12a..c70e5e258 100755 --- a/SubjuGator/perception/subjugator_perception/ml_classifiers/path_marker/path_localizer.py +++ b/SubjuGator/perception/subjugator_perception/ml_classifiers/path_marker/path_localizer.py @@ -17,7 +17,7 @@ rospack.get_path("subjugator_perception") + "/ml_classifiers/path_marker/utils", ) -from utils import detector_utils # noqa: manually appending sys.path +from utils import detector_utils # noqa class classifier: diff --git a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/sub8_driver.py b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/sub8_driver.py index 8236940ac..c03b318d2 100755 --- a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/sub8_driver.py +++ b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/sub8_driver.py @@ -85,9 +85,7 @@ def read_packet(self) -> bool: self.handles[packet.device].on_data(packet.data) else: rospy.logwarn( - "Message received for device {}, but no handle registered".format( - packet.device, - ), + f"Message received for device {packet.device}, but no handle registered", ) return True diff --git a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py index 2d2558f57..0ef0cf9a1 100644 --- a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py +++ b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py @@ -26,10 +26,7 @@ class ChecksumException(USB2CANException): def __init__(self, calculated, expected): super().__init__( - "Checksum was calculated as {} but reported as {}".format( - calculated, - expected, - ), + f"Checksum was calculated as {calculated} but reported as {expected}", ) diff --git a/mil_common/mil_missions/mil_missions_gui/dashboard.py b/mil_common/mil_missions/mil_missions_gui/dashboard.py index f3f224243..440dc85b9 100755 --- a/mil_common/mil_missions/mil_missions_gui/dashboard.py +++ b/mil_common/mil_missions/mil_missions_gui/dashboard.py @@ -195,11 +195,10 @@ def ui_log(self, string): """ self.lock.acquire() date_time = datetime.datetime.fromtimestamp(rospy.Time.now().to_time()) - time_str = "{}:{}:{}".format( - date_time.hour, - date_time.minute, - date_time.second, - ).ljust(12, " ") + time_str = f"{date_time.hour}:{date_time.minute}:{date_time.second}".ljust( + 12, + " ", + ) formatted = time_str + string self.feedback_list.addItem(formatted) self.lock.release() @@ -242,9 +241,7 @@ def transition_cb(self, goal, handler): self.current_mission_status = terminal_state self.current_mission_status_label.setText(self.current_mission_status) self.ui_log( - "FINISHED: mission finished ({})".format( - self.current_mission_status, - ), + f"FINISHED: mission finished ({self.current_mission_status})", ) def reload_available_missions(self, _): diff --git a/mil_common/mil_missions/nodes/mission_client b/mil_common/mil_missions/nodes/mission_client index 2ff81d944..230547f8e 100755 --- a/mil_common/mil_missions/nodes/mission_client +++ b/mil_common/mil_missions/nodes/mission_client @@ -30,9 +30,7 @@ class MissionClientCli: missions = MissionClient.available_missions() if not missions: print( - "{} param not set. Is mission runner running?".format( - MissionClient.LIST_PARAM, - ), + f"{MissionClient.LIST_PARAM} param not set. Is mission runner running?", ) return print("Available Missions:") diff --git a/mil_common/mil_missions/test/test_import_missions.py b/mil_common/mil_missions/test/test_import_missions.py index e03fb7e82..c09c8f13b 100755 --- a/mil_common/mil_missions/test/test_import_missions.py +++ b/mil_common/mil_missions/test/test_import_missions.py @@ -21,10 +21,7 @@ def test_import_missions(self): if not hasattr(mission_module, self.base_class): self.fail( - msg="{} doesn't have base mission {}".format( - self.module, - self.base_class, - ), + msg=f"{self.module} doesn't have base mission {self.base_class}", ) base_mission = getattr(mission_module, self.base_class) diff --git a/mil_common/perception/mil_vision/mil_vision_tools/cv_tools.py b/mil_common/perception/mil_vision/mil_vision_tools/cv_tools.py index dcfb694a1..42b6112b2 100644 --- a/mil_common/perception/mil_vision/mil_vision_tools/cv_tools.py +++ b/mil_common/perception/mil_vision/mil_vision_tools/cv_tools.py @@ -79,7 +79,7 @@ def __init__( self.conversion_code = conversion_code @classmethod - def from_dict(cls, d, in_space: str = "BGR", thresh_space: str = None): + def from_dict(cls, d, in_space: str = "BGR", thresh_space: Optional[str] = None): """ Loads thresholds from a dictionary. See examples for valid dictionaries. @@ -114,9 +114,7 @@ def from_dict(cls, d, in_space: str = "BGR", thresh_space: str = None): d.keys(), ), ) - assert thresh_space in d, "{} color space not in dictionary".format( - thresh_space, - ) + assert thresh_space in d, f"{thresh_space} color space not in dictionary" inner = d[thresh_space] if "low" in inner and "high" in inner: return cls( diff --git a/mil_common/utils/mil_tools/mil_ros_tools/extract_bag_images.py b/mil_common/utils/mil_tools/mil_ros_tools/extract_bag_images.py index c243ae950..22e52987c 100755 --- a/mil_common/utils/mil_tools/mil_ros_tools/extract_bag_images.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/extract_bag_images.py @@ -150,17 +150,11 @@ def get_camera_model(bag: str, topic: str): _, msg, _ = next(bag.read_messages(topics=camera_info_topic)) except StopIteration: raise Exception( - "no camera info messages found on topic {} in {}".format( - camera_info_topic, - bag, - ), + f"no camera info messages found on topic {camera_info_topic} in {bag}", ) if msg._type != "sensor_msgs/CameraInfo": raise Exception( - "msg on topic {} are not camera info in bag {}".format( - camera_info_topic, - bag, - ), + f"msg on topic {camera_info_topic} are not camera info in bag {bag}", ) model = PinholeCameraModel() model.fromCameraInfo(msg) @@ -218,10 +212,7 @@ def extract_images(self, source_dir=".", image_dir=".", verbose=False): """ if verbose: print( - "\tExtracting images from topic {} in {}".format( - self.topic, - self.filename, - ), + f"\tExtracting images from topic {self.topic} in {self.filename}", ) filename = os.path.join(source_dir, self.filename) b = rosbag.Bag(filename) diff --git a/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py b/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py index d3a98fa67..4e6c7231c 100755 --- a/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py @@ -263,10 +263,7 @@ def completion_report(self): total_img_count += i if total_img_count == 0: print( - "{}/{} TOTAL images labeled (0%)".format( - total_xml_count, - total_img_count, - ), + f"{total_xml_count}/{total_img_count} TOTAL images labeled (0%)", ) else: print( diff --git a/mil_common/utils/mil_tools/mil_ros_tools/msg_helpers.py b/mil_common/utils/mil_tools/mil_ros_tools/msg_helpers.py index 9ffa9b2d9..8ab315818 100644 --- a/mil_common/utils/mil_tools/mil_ros_tools/msg_helpers.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/msg_helpers.py @@ -58,10 +58,7 @@ def rosmsg_to_numpy(rosmsg, keys=None): break assert ( len(output_array) != 0 - ), "Input type {} has none of these attributes {}.".format( - type(rosmsg).__name__, - keys, - ) + ), f"Input type {type(rosmsg).__name__} has none of these attributes {keys}." return np.array(output_array).astype(np.float32) else: diff --git a/mil_common/utils/mil_tools/nodes/online_bagger.py b/mil_common/utils/mil_tools/nodes/online_bagger.py index 2580f5cf2..5a0c6bb32 100755 --- a/mil_common/utils/mil_tools/nodes/online_bagger.py +++ b/mil_common/utils/mil_tools/nodes/online_bagger.py @@ -71,10 +71,7 @@ def get_subscriber_list(self, status): sub_list = "" for topic in self.subscriber_list: if self.subscriber_list[topic][1] == status: - sub_list = sub_list + "\n{:13}, {}".format( - self.subscriber_list[topic], - topic, - ) + sub_list = sub_list + f"\n{self.subscriber_list[topic]:13}, {topic}" return sub_list def get_params(self): diff --git a/mil_common/utils/mil_tools/nodes/tf_fudger.py b/mil_common/utils/mil_tools/nodes/tf_fudger.py index 58a647757..0ae508c98 100755 --- a/mil_common/utils/mil_tools/nodes/tf_fudger.py +++ b/mil_common/utils/mil_tools/nodes/tf_fudger.py @@ -45,10 +45,7 @@ ang_res = ang_range / ang_max print( - "Distance resolution: {} meters\nAngular resolution: {} radians".format( - x_res, - ang_res, - ), + f"Distance resolution: {x_res} meters\nAngular resolution: {ang_res} radians", ) cv2.createTrackbar("x", "tf", 0, x_max, lambda x: x) diff --git a/mil_common/utils/mil_tools/nodes/tf_to_gazebo.py b/mil_common/utils/mil_tools/nodes/tf_to_gazebo.py index b587dfb88..9363d3c4f 100755 --- a/mil_common/utils/mil_tools/nodes/tf_to_gazebo.py +++ b/mil_common/utils/mil_tools/nodes/tf_to_gazebo.py @@ -25,12 +25,7 @@ def main(): if do_cam_fix: rot = tf.transformations.quaternion_multiply(rot, cam_fix_quat) print( - "(qx={}, qy={} , qz={}, qw={})".format( - rot[0], - rot[1], - rot[2], - rot[3], - ), + f"(qx={rot[0]}, qy={rot[1]} , qz={rot[2]}, qw={rot[3]})", ) print(f"(x={trans[0]}, y={trans[1]}, z={trans[2]})") euler = tf.transformations.euler_from_quaternion(rot) diff --git a/ruff.toml b/ruff.toml index 69b8787be..0ec9c21f1 100644 --- a/ruff.toml +++ b/ruff.toml @@ -35,6 +35,7 @@ ignore = [ "D212", # we use second line! "D200", # one line docstrings are not shortened! "SIM115", # too many for now... + "RUF012", # too many for now, adds obvious ClassVar statements ] [per-file-ignores] From 65d92ee88a19f58b832e0167c9d59547b7864ed0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:09:45 +0000 Subject: [PATCH 12/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) - [github.com/shellcheck-py/shellcheck-py: v0.9.0.5 → v0.9.0.6](https://github.com/shellcheck-py/shellcheck-py/compare/v0.9.0.5...v0.9.0.6) - [github.com/astral-sh/ruff-pre-commit: v0.0.287 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.287...v0.0.292) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5db81ae41..7751457af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format @@ -28,7 +28,7 @@ repos: - id: autoflake args: [--remove-all-unused-imports, --ignore-init-module-imports] - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.9.0.5 + rev: v0.9.0.6 hooks: - id: shellcheck exclude: ^docker|deprecated|NaviGator/simulation/VRX @@ -40,7 +40,7 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.0.287' + rev: 'v0.0.292' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 5fb3ef1a7467626a0e9b001a0494e8246cfe4402 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:20:06 +0000 Subject: [PATCH 13/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.9.1 → 23.10.1](https://github.com/psf/black/compare/23.9.1...23.10.1) - [github.com/pre-commit/mirrors-clang-format: v16.0.6 → v17.0.4](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.6...v17.0.4) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.4) - [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6) - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7751457af..fc36022df 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,11 +15,11 @@ repos: hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.10.1 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.6 + rev: v17.0.4 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake @@ -40,12 +40,12 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.0.292' + rev: 'v0.1.4' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.2.6 hooks: - id: codespell args: @@ -73,7 +73,7 @@ repos: - id: prettier-package-xml - id: sort-package-xml - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-case-conflict From 219d34adf40fded5b3f7940fd05f1cb02957cb4b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:21:17 +0000 Subject: [PATCH 14/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../navigator_alarm/navigator_alarm_handlers/odom_kill.py | 4 +--- .../navigator_missions/detect_deliver_2016.py | 4 +--- .../navigator_missions/navigator_missions/pose_editor.py | 4 +--- mil_common/utils/mil_tools/test/test_ros_tools.py | 5 +---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/odom_kill.py b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/odom_kill.py index 2bc5e6c43..d0fa63afd 100755 --- a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/odom_kill.py +++ b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/odom_kill.py @@ -51,9 +51,7 @@ def check_continuity(self, odom): self._raised = True # Avoid raising multiple times rospy.logwarn("ODOM DISCONTINUITY DETECTED") self.ab.raise_alarm( - problem_description="ODOM DISCONTINUITY DETECTED. JUMPED {} METERS".format( - jump, - ), + problem_description=f"ODOM DISCONTINUITY DETECTED. JUMPED {jump} METERS", severity=5, ) self.last_position = position diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py b/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py index 28c3ac4d9..dee540de0 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/detect_deliver_2016.py @@ -153,9 +153,7 @@ async def do_circle(): await self.nh.sleep(0.25) continue fprint( - "Shape ({}found, using normal to look at other 3 shapes if needed".format( - res[0], - ), + f"Shape ({res[0]}found, using normal to look at other 3 shapes if needed", title="DETECT DELIVER", msg_color="green", ) diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/pose_editor.py b/NaviGator/mission_control/navigator_missions/navigator_missions/pose_editor.py index 5f25f36ab..d2b1855cd 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/pose_editor.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/pose_editor.py @@ -341,9 +341,7 @@ def as_MoveGoal(self, move_type=MoveGoal.DRIVE, **kwargs): for key in kwargs: if not hasattr(MoveGoal, key): fprint( - "MoveGoal msg doesn't have a field called '{}' you tried to set via kwargs.".format( - key, - ), + f"MoveGoal msg doesn't have a field called '{key}' you tried to set via kwargs.", title="POSE_EDITOR", msg_color="red", ) diff --git a/mil_common/utils/mil_tools/test/test_ros_tools.py b/mil_common/utils/mil_tools/test/test_ros_tools.py index bbcc5511b..2c0eeeca5 100644 --- a/mil_common/utils/mil_tools/test/test_ros_tools.py +++ b/mil_common/utils/mil_tools/test/test_ros_tools.py @@ -131,10 +131,7 @@ def test_make_rotation(self): [0.0, 0.0, 0.0], np.cross(p_rotated, q), atol=1e-5, - err_msg="The generated rotation matrix did not align the input vectors, {} to {}".format( - p, - q, - ), + err_msg=f"The generated rotation matrix did not align the input vectors, {p} to {q}", ) self.assertGreater( np.dot(p_rotated, q), From efb9710b404725d6a787a1fabbb3a41a3e37554b Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Mon, 6 Nov 2023 14:15:11 -0500 Subject: [PATCH 15/19] Fix spelling mistakes for codespell --- .../gnc/navigator_path_planner/nodes/path_planner.py | 2 +- .../navigator_missions/launch/mission_params.yaml | 8 ++++---- .../navigator_missions/constant_velocity.py | 2 +- .../navigator_missions/demonstrate_navigation.py | 4 ++-- .../navigator_missions/vrx_missions/dock.py | 2 +- .../satellite/rviz_satellite/src/aerialmap_display.cpp | 2 +- NaviGator/scripts/bash_aliases.sh | 2 +- NaviGator/utils/navigator_msgs/srv/GetDockBays.srv | 2 +- .../utils/navigator_tools/nodes/navigator_status_tui | 2 +- .../nodes/navigator_emergency.py | 2 +- NaviGator/utils/voltage_gui/src/voltage_gui.py | 2 +- .../command/subjugator_launch/config/passive_sonar.yaml | 2 +- .../subjugator_launch/launch/subsystems/nav_box.launch | 8 ++++---- .../perception/subjugator_perception/nodes/dice_detect.py | 2 +- .../nodes/orange_rectangle_finder.py | 2 +- .../subjugator_vision_tools/marker_occ_grid.py | 2 +- docs/design/passive_sonar/passive_sonar.rst | 2 +- docs/electrical/onboarding.md | 2 +- .../software/planning/indyav_path/path_recorder.rst | 2 +- docs/navigator/lessons22.md | 2 +- docs/software/adding_documentation.md | 2 +- docs/software/getting_started.md | 2 +- docs/software/help.md | 2 +- docs/software/noetic_migration.md | 2 +- mil_common/axros | 2 +- mil_common/drivers/mil_passive_sonar/README.md | 2 +- .../drivers/mil_passive_sonar/scripts/triggering.py | 4 ++-- .../mil_vision/include/mil_vision_lib/cv_tools.hpp | 2 +- .../mil_vision/mil_vision_tools/color_classifier.py | 2 +- .../mil_vision/mil_vision_tools/shape_finder.py | 2 +- .../perception/mil_vision/mil_vision_tools/vision_node.py | 2 +- .../src/mil_vision_lib/colorizer/pcd_colorizer.cpp | 2 +- mil_common/ros_alarms/test/roscpp/listener_test.cpp | 2 +- mil_common/ros_alarms/test/rospy/python_tests.py | 4 ++-- mil_common/utils/mil_tools/mil_ros_tools/image_helpers.py | 2 +- 35 files changed, 44 insertions(+), 44 deletions(-) diff --git a/NaviGator/gnc/navigator_path_planner/nodes/path_planner.py b/NaviGator/gnc/navigator_path_planner/nodes/path_planner.py index ba33ca850..1f6ff6793 100755 --- a/NaviGator/gnc/navigator_path_planner/nodes/path_planner.py +++ b/NaviGator/gnc/navigator_path_planner/nodes/path_planner.py @@ -1070,7 +1070,7 @@ def reevaluate_plan(self) -> None: def action_check(self, _: rospy.timer.TimerEvent) -> None: """ Manages action preempting. Serves as the callback to a Timer operating - opereating every self.revisit_period seconds. + operating every self.revisit_period seconds. """ if self.preempted or not self.move_server.is_active(): return diff --git a/NaviGator/mission_control/navigator_missions/launch/mission_params.yaml b/NaviGator/mission_control/navigator_missions/launch/mission_params.yaml index 7b44edc7e..c4ee5940c 100644 --- a/NaviGator/mission_control/navigator_missions/launch/mission_params.yaml +++ b/NaviGator/mission_control/navigator_missions/launch/mission_params.yaml @@ -157,14 +157,14 @@ dock_shape_1: param: /mission/identify_dock/shape_1 options: [CIRCLE, TRIANGLE, CROSS, ANY] description: > - The shape of the first bay to dock in during the dentify + The shape of the first bay to dock in during the identify Symbols and Dock mission. If set to ANY, mission should dock based on the color parameter and set this parameter during the mission dock_color_1: param: /mission/identify_dock/color_1 options: [RED, GREEN, BLUE, ANY] description: > - The color of the first bay to dock in during the dentify Symbols and Dock + The color of the first bay to dock in during the identify Symbols and Dock mission. If set to ANY, mission should dock based on the shape parameter and set this parameter during the mission @@ -174,7 +174,7 @@ dock_shape_2: description: > # yamllint disable-line rule:line-length The shape of the second bay to dock in during the - dentify Symbols and Dock mission. If set to ANY, + identify Symbols and Dock mission. If set to ANY, mission should dock based on the color parameter and set this parameter during the mission dock_color_2: @@ -183,6 +183,6 @@ dock_color_2: description: > # yamllint disable-line rule:line-length The color of the second bay to dock in during the - dentify Symbols and Dock mission. + identify Symbols and Dock mission. If set to ANY, mission should dock based on the shape parameter and set this parameter during the mission diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py b/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py index 5ae078c90..a0ce42a26 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/constant_velocity.py @@ -66,7 +66,7 @@ def decode_parameters(cls, parameters): return parsed async def run(self, args): - # Publish a velocity of zero for a while to stabalize navigator + # Publish a velocity of zero for a while to stabilize navigator self.send_feedback("Switching trajectory to constant") await self.change_trajectory("constant") await self.nh.sleep(0.1) diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/demonstrate_navigation.py b/NaviGator/mission_control/navigator_missions/navigator_missions/demonstrate_navigation.py index 6c53d35a4..599a388cc 100644 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/demonstrate_navigation.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/demonstrate_navigation.py @@ -68,7 +68,7 @@ async def run(self, parameters): _, closest_reds = await self.get_sorted_objects("red_cylinder", 1) _, closest_greens = await self.get_sorted_objects("green_cylinder", 1) - # Rename the totems for their symantic name + # Rename the totems for their semantic name green_close = closest_greens[0] red_close = closest_reds[0] @@ -83,7 +83,7 @@ async def run(self, parameters): _, closest_reds = await self.get_sorted_objects("red_cylinder", 2) _, closest_greens = await self.get_sorted_objects("green_cylinder", 2) - # Rename the totems for their symantic name + # Rename the totems for their semantic name green_far = closest_greens[1] red_far = closest_reds[1] diff --git a/NaviGator/mission_control/navigator_missions/vrx_missions/dock.py b/NaviGator/mission_control/navigator_missions/vrx_missions/dock.py index 23d7cdfb3..44a3cacae 100644 --- a/NaviGator/mission_control/navigator_missions/vrx_missions/dock.py +++ b/NaviGator/mission_control/navigator_missions/vrx_missions/dock.py @@ -607,7 +607,7 @@ async def prepare_for_docking(self): # This function looks at the two squares in front of the boat # and it gets the middle pixel between the two squares. # If the middle pixel is for some reason not in the middle of our camera... - # adjust the boat postiion before docking + # adjust the boat position before docking print("prepare for landing!") img = await self.front_left_camera_sub.get_next_message() diff --git a/NaviGator/satellite/rviz_satellite/src/aerialmap_display.cpp b/NaviGator/satellite/rviz_satellite/src/aerialmap_display.cpp index 22a307f76..bf5ec8b20 100644 --- a/NaviGator/satellite/rviz_satellite/src/aerialmap_display.cpp +++ b/NaviGator/satellite/rviz_satellite/src/aerialmap_display.cpp @@ -416,7 +416,7 @@ void AerialMapDisplay::assembleScene() // determine location of this tile, flipping y in the process const double x = (tile.x() - loader_->centerTileX()) * tile_w + origin_x; const double y = -(tile.y() - loader_->centerTileY()) * tile_h + origin_y; - // don't re-use any ids + // don't reuse any ids const std::string name_suffix = std::to_string(tile.x()) + "_" + std::to_string(tile.y()) + "_" + std::to_string(map_id_) + "_" + std::to_string(scene_id_); diff --git a/NaviGator/scripts/bash_aliases.sh b/NaviGator/scripts/bash_aliases.sh index 216b1ff80..de6da5f4b 100755 --- a/NaviGator/scripts/bash_aliases.sh +++ b/NaviGator/scripts/bash_aliases.sh @@ -18,7 +18,7 @@ nthrust() { topic="/$1_motor/cmd" publishers=$(rostopic info "$topic" | grep Publishers) if [ "$publishers" != "Publishers: None" ]; then - echo "Somone is already publishing to $topic. Perhaps you need to kill thrust mapper?" + echo "Someone is already publishing to $topic. Perhaps you need to kill thrust mapper?" return 1 fi rostopic pub "$topic" "roboteq_msgs/Command" "setpoint: $2" -r100 diff --git a/NaviGator/utils/navigator_msgs/srv/GetDockBays.srv b/NaviGator/utils/navigator_msgs/srv/GetDockBays.srv index 9a39764bd..7081b1b07 100644 --- a/NaviGator/utils/navigator_msgs/srv/GetDockBays.srv +++ b/NaviGator/utils/navigator_msgs/srv/GetDockBays.srv @@ -2,4 +2,4 @@ geometry_msgs/Point[3] bays #The positions in ENU frame of the center of the three bays 0=left, 1=center, 2=right geometry_msgs/Vector3 normal #Vector or normal pointing away from plane of dock back bool success #False if an error occurred getting dock bays -string error #Descripion of error if success=false +string error #Description of error if success=false diff --git a/NaviGator/utils/navigator_tools/nodes/navigator_status_tui b/NaviGator/utils/navigator_tools/nodes/navigator_status_tui index 3efa0a5d1..55645a95e 100755 --- a/NaviGator/utils/navigator_tools/nodes/navigator_status_tui +++ b/NaviGator/utils/navigator_tools/nodes/navigator_status_tui @@ -35,7 +35,7 @@ class nav_tui: self.panel.hide() panel.update_panels() self.rate = rospy.Rate(2) # Fixed rate for while loop to update at: 2 hz - # The following are default field initalizations for various values that that will be overwritten + # The following are default field initializations for various values that that will be overwritten self.voltage = 0 self.wrench = None self.LAT = None diff --git a/NaviGator/utils/remote_control/navigator_emergency_control/nodes/navigator_emergency.py b/NaviGator/utils/remote_control/navigator_emergency_control/nodes/navigator_emergency.py index 8077b4601..0bd27c291 100755 --- a/NaviGator/utils/remote_control/navigator_emergency_control/nodes/navigator_emergency.py +++ b/NaviGator/utils/remote_control/navigator_emergency_control/nodes/navigator_emergency.py @@ -95,7 +95,7 @@ def check_for_timeout(self, joy: Joy): def joy_recieved(self, joy: Joy) -> None: """ - Button elements are being assigned and simplied to readable names. The + Button elements are being assigned and simplified to readable names. The number of deployments or retractions for thrusters are being updated based on several conditions. Moreover, additional settings are changed based on the state of the controller and the activation of potential alarms or switches. diff --git a/NaviGator/utils/voltage_gui/src/voltage_gui.py b/NaviGator/utils/voltage_gui/src/voltage_gui.py index 932dbc22b..79e6a0e85 100644 --- a/NaviGator/utils/voltage_gui/src/voltage_gui.py +++ b/NaviGator/utils/voltage_gui/src/voltage_gui.py @@ -184,7 +184,7 @@ def resizeFont(self) -> None: # done threshFont = QtGui.QFont("Times", (self.fontSize) / 3, QtGui.QFont.Bold) self.labelThresh.setFont(threshFont) - # Sets the text of the thrshold info box + # Sets the text of the threshold info box def initThresh(self) -> None: """ Sets the text of the threshold info box diff --git a/SubjuGator/command/subjugator_launch/config/passive_sonar.yaml b/SubjuGator/command/subjugator_launch/config/passive_sonar.yaml index 9901f9703..e55aec3da 100644 --- a/SubjuGator/command/subjugator_launch/config/passive_sonar.yaml +++ b/SubjuGator/command/subjugator_launch/config/passive_sonar.yaml @@ -3,7 +3,7 @@ dist_h: 2.286e-02 # speed of sound in water v_sound: 1482 -# target Frquency in Hz +# target Frequency in Hz triggering/target_frequency: 30000 # tolerance around target frequerncy in Hz triggering/frequency_tolerance: 100 diff --git a/SubjuGator/command/subjugator_launch/launch/subsystems/nav_box.launch b/SubjuGator/command/subjugator_launch/launch/subsystems/nav_box.launch index eb5e1bc31..3dee6ee81 100644 --- a/SubjuGator/command/subjugator_launch/launch/subsystems/nav_box.launch +++ b/SubjuGator/command/subjugator_launch/launch/subsystems/nav_box.launch @@ -42,10 +42,10 @@ scale: - - [0.993770963897068, 0.00105871125374563, 7.659410525291767e-05] - - [0.00105871125374563, 0.9996814868251349, -0.0011040738267441828] - - [7.659410525291767e-05, -0.001104073826744163, 1.0065910531028952] - shift: [1.2551999807772446e-06, -1.1666595150804588e-06, 6.895773090438596e-08] + - [0.9991765357958566, 0.006242798579443988, -0.008472478269327878] + - [0.006242798579443957, 1.0016179705091928, 0.0059841151097914345] + - [-0.008472478269327836, 0.0059841151097913, 0.999354597532967] + shift: [7.889247409445414e-06, 4.879179471165382e-06, 7.46017199298374e-06] diff --git a/SubjuGator/perception/subjugator_perception/nodes/dice_detect.py b/SubjuGator/perception/subjugator_perception/nodes/dice_detect.py index 55d1dd5e2..312123597 100755 --- a/SubjuGator/perception/subjugator_perception/nodes/dice_detect.py +++ b/SubjuGator/perception/subjugator_perception/nodes/dice_detect.py @@ -93,7 +93,7 @@ def detect(self, dice_img): params.minConvexity = 0.8 # 1 = perfect convex hull # Filter by Inertia params.filterByInertia = True - params.minInertiaRatio = 0.4 # Defines the ellipsoid 1= detects only cirlces + params.minInertiaRatio = 0.4 # Defines the ellipsoid 1= detects only circles # 0 = Detects even lines # Create a detector with the parameters diff --git a/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py b/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py index 0701c3b05..237fe94e3 100755 --- a/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py +++ b/SubjuGator/perception/subjugator_perception/nodes/orange_rectangle_finder.py @@ -52,7 +52,7 @@ class OrangeRectangleFinder: * Transform this frames pose into /map frame * Plug this frames pose in /map into a kalman filter to reduce noise - TODO: Allow for two objects to be identifed at once, both filtered through its own KF + TODO: Allow for two objects to be identified at once, both filtered through its own KF """ # Coordinate axes for debugging image diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py index 9261de0ac..2a278a4f4 100644 --- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py +++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py @@ -174,7 +174,7 @@ def return_pose(self, srv): self.poly_generator = self.polygon_generator() return [0, False, srv.intial_position] - # We search at 1.5 * r so that there is some overlay in the search feilds. + # We search at 1.5 * r so that there is some overlay in the search fields. np_pose = msg_helpers.pose_to_numpy(srv.intial_position) rot_mat = make_2D_rotation( tf.transformations.euler_from_quaternion(np_pose[1])[2], diff --git a/docs/design/passive_sonar/passive_sonar.rst b/docs/design/passive_sonar/passive_sonar.rst index 522368705..590a7010c 100644 --- a/docs/design/passive_sonar/passive_sonar.rst +++ b/docs/design/passive_sonar/passive_sonar.rst @@ -78,7 +78,7 @@ Configuration ************* All parameters that are expected to be changed in tuining are ROS Params initialized in ``passive_sonar.yaml`` -To make a custom configation +To make a custom configuration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * ``roscd subjugator_launch`` diff --git a/docs/electrical/onboarding.md b/docs/electrical/onboarding.md index c48026aaa..45d73e7a7 100644 --- a/docs/electrical/onboarding.md +++ b/docs/electrical/onboarding.md @@ -20,7 +20,7 @@ including meeting times. ## Join the electrical GitHub Unlike the software and mechanical teams (who share a GitHub repository), we use -a separate repository for the electrical team. As a resut, you will need to be added +a separate repository for the electrical team. As a result, you will need to be added to this organization. Once you're in Slack (or you've come to the lab), ask an electrical leader to add you to the GitHub organization. The organization can be found [here](https://github.com/uf-mil-electrical). diff --git a/docs/indyav/software/planning/indyav_path/path_recorder.rst b/docs/indyav/software/planning/indyav_path/path_recorder.rst index 77c3d4ee3..d1b5f1a47 100644 --- a/docs/indyav/software/planning/indyav_path/path_recorder.rst +++ b/docs/indyav/software/planning/indyav_path/path_recorder.rst @@ -33,7 +33,7 @@ Basic Usage Example - Visualize this new topic in rviz by clicking `Add` and then `/odom2 -> Odometry` -- Watch the red arrow advance from where the sub started to where the sub stopped updting approximately 10 times a second. +- Watch the red arrow advance from where the sub started to where the sub stopped updating approximately 10 times a second. Source Files ^^^^^^^^^^^^ diff --git a/docs/navigator/lessons22.md b/docs/navigator/lessons22.md index 1c92fc298..25607540e 100644 --- a/docs/navigator/lessons22.md +++ b/docs/navigator/lessons22.md @@ -62,7 +62,7 @@ future teams to learn from! It is quicker to tell when tools have gone missing (as each tool now has a dedicated spot in the organizer), and which tool is missing. Furthermore, it becomes easier for software members, electrical members, and mentors to find - tools, even if they maybe are not acquianted with a deep knowledge of the + tools, even if they maybe are not acquainted with a deep knowledge of the mechanical team. * **Focus on bringing less and staying more organized.** - At RobotX 2022, we were one of the teams who had brought the most equipment, yet we had a hard diff --git a/docs/software/adding_documentation.md b/docs/software/adding_documentation.md index cc1a1fd46..d91bf76e3 100644 --- a/docs/software/adding_documentation.md +++ b/docs/software/adding_documentation.md @@ -100,5 +100,5 @@ $ ./scripts/build_docs --scratch ``` ## Contributing changes -Now that you have made and verifed your changes, follow the [contributing guide](contributing) +Now that you have made and verified your changes, follow the [contributing guide](contributing) to add your changes to the repository. diff --git a/docs/software/getting_started.md b/docs/software/getting_started.md index 1215b276e..a40845665 100644 --- a/docs/software/getting_started.md +++ b/docs/software/getting_started.md @@ -420,7 +420,7 @@ launches the Gazebo GUI - aka, the thing you will actually interact with! If all goes according to plan, you should see our robot in its own little world! ## Installing developer tools -After you have verified that your Git setup is working appopriately, take a look +After you have verified that your Git setup is working appropriately, take a look at installing some developer tools on the [Developer Tools](/software/devtools) page. diff --git a/docs/software/help.md b/docs/software/help.md index 060f8376b..f8250fa70 100644 --- a/docs/software/help.md +++ b/docs/software/help.md @@ -63,7 +63,7 @@ for examples of it being used. ## Search the internet If your problem is not MIL-specific (issue with Linux, ROS, C++, etc), -somone has most likely had the same problem and written about it on the internet. +someone has most likely had the same problem and written about it on the internet. You'll be surprised how often you can fix your issue by Googling the error. ## Search Slack diff --git a/docs/software/noetic_migration.md b/docs/software/noetic_migration.md index 6a79ec10a..6a93a86cd 100644 --- a/docs/software/noetic_migration.md +++ b/docs/software/noetic_migration.md @@ -45,7 +45,7 @@ before you commit. Great, the code is now pretty! :D -If you ran `python-modernize`, it will have suggested some changes to you, indcated +If you ran `python-modernize`, it will have suggested some changes to you, indicated by `+` and `-` signs. It may look something like this: ```diff diff --git a/mil_common/axros b/mil_common/axros index a4951d333..1b0399935 160000 --- a/mil_common/axros +++ b/mil_common/axros @@ -1 +1 @@ -Subproject commit a4951d33356c349856532ddef5c97c6ec6810c28 +Subproject commit 1b03999351fb5a61b202ff125f493229c2a1676b diff --git a/mil_common/drivers/mil_passive_sonar/README.md b/mil_common/drivers/mil_passive_sonar/README.md index 572ad4069..7010a3ae0 100644 --- a/mil_common/drivers/mil_passive_sonar/README.md +++ b/mil_common/drivers/mil_passive_sonar/README.md @@ -4,7 +4,7 @@ This package includes the main algorithm to find the direction of a pinger. It a # Running: Ensure that hydrophones -> ros is running and publishing a `mil_passive_sonar/Ping` msg. -Then run `roslaunch mil_passive_sonar mil_passive_sonar.lauch` +Then run `roslaunch mil_passive_sonar mil_passive_sonar.launch` `mil_passive_sonar/FindPinger` diff --git a/mil_common/drivers/mil_passive_sonar/scripts/triggering.py b/mil_common/drivers/mil_passive_sonar/scripts/triggering.py index 897a76949..321a20411 100755 --- a/mil_common/drivers/mil_passive_sonar/scripts/triggering.py +++ b/mil_common/drivers/mil_passive_sonar/scripts/triggering.py @@ -96,7 +96,7 @@ def get_params(self): self.enabled = rospy.get_param("~enable_on_launch") # Attributes about our target frequency range - # target Frquency in Hz + # target Frequency in Hz self.target = rospy.get_param("~target_frequency") # tolerance around that frequerncy in Hz tolerance = rospy.get_param("~frequency_tolerance") @@ -121,7 +121,7 @@ def get_params(self): self.v_sound = rospy.get_param("v_sound") # Misc attributes - # minimum gradient of the max convolution wrt time to trigger a time of arivals calculation + # minimum gradient of the max convolution wrt time to trigger a time of arrivals calculation self.threshold = rospy.get_param("~threshold") self.trigger_offset = rospy.get_param("~trigger_offset") # how far after the triggering time to make upper bound of samples at triggering in sec diff --git a/mil_common/perception/mil_vision/include/mil_vision_lib/cv_tools.hpp b/mil_common/perception/mil_vision/include/mil_vision_lib/cv_tools.hpp index 4709fa85f..af6f30853 100644 --- a/mil_common/perception/mil_vision/include/mil_vision_lib/cv_tools.hpp +++ b/mil_common/perception/mil_vision/include/mil_vision_lib/cv_tools.hpp @@ -76,7 +76,7 @@ unsigned int select_hist_mode(std::vector &histogram_modes, unsigned // Takes in a grayscale image and segments out a semi-homogenous foreground // object with pixel intensities close to . Tuning of last three -// parameters may imrove results but default values should work well in +// parameters may improve results but default values should work well in // most cases. void statistical_image_segmentation(const cv::Mat &src, cv::Mat &dest, cv::Mat &debug_img, const int hist_size, const float **ranges, const int target, std::string image_name = "Unnamed Image", diff --git a/mil_common/perception/mil_vision/mil_vision_tools/color_classifier.py b/mil_common/perception/mil_vision/mil_vision_tools/color_classifier.py index df48a5881..c19e09c5e 100755 --- a/mil_common/perception/mil_vision/mil_vision_tools/color_classifier.py +++ b/mil_common/perception/mil_vision/mil_vision_tools/color_classifier.py @@ -94,7 +94,7 @@ def classify_features(self, features: np.ndarray) -> int: def feature_probabilities(self, features: np.ndarray) -> List[float]: """ - Allows child classes to give probabilties for each possible class given + Allows child classes to give probabilities for each possible class given a features vector, instead of just one classification. By default, gives 1.0 to classified class and 0.0 to others. diff --git a/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py b/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py index 5ba5f78cb..05d50cc8f 100644 --- a/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py +++ b/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py @@ -213,7 +213,7 @@ def get_pose_3D( cam (Optional[PinholeCameraModel]): The camera model. rectified (bool): If ``cam`` is set, set True if corners were found in an already rectified image (image_rect_color topic). - instrinsics (np.ndarray): Camera intrinisic matrix. + intrinsics (np.ndarray): Camera intrinisic matrix. dist_coeffs (np.ndarray): Camera distortion coefficients. Returns: diff --git a/mil_common/perception/mil_vision/mil_vision_tools/vision_node.py b/mil_common/perception/mil_vision/mil_vision_tools/vision_node.py index d1c8d37e9..caaaf7fd6 100755 --- a/mil_common/perception/mil_vision/mil_vision_tools/vision_node.py +++ b/mil_common/perception/mil_vision/mil_vision_tools/vision_node.py @@ -27,7 +27,7 @@ def create_object_msg( is needed/available in your application. Args: - name (str): Name of the identifed object. + name (str): Name of the identified object. attributes (str): Attributes to attach to message, the purpose and value of this attribute will vary by application. Defaults to an empty string. confidence (Optional[float]): Float between 0 and 1 describing the confidence diff --git a/mil_common/perception/mil_vision/src/mil_vision_lib/colorizer/pcd_colorizer.cpp b/mil_common/perception/mil_vision/src/mil_vision_lib/colorizer/pcd_colorizer.cpp index a0bd83adb..14333e5e3 100644 --- a/mil_common/perception/mil_vision/src/mil_vision_lib/colorizer/pcd_colorizer.cpp +++ b/mil_common/perception/mil_vision/src/mil_vision_lib/colorizer/pcd_colorizer.cpp @@ -24,7 +24,7 @@ PcdColorizer::PcdColorizer(ros::NodeHandle nh, string input_pcd_topic) } catch (std::exception &e) { - _err_msg = "COLORIZER: Suscriber or publisher error caught: "_s + e.what(); + _err_msg = "COLORIZER: Subscriber or publisher error caught: "_s + e.what(); ROS_ERROR(_err_msg.c_str()); return; } diff --git a/mil_common/ros_alarms/test/roscpp/listener_test.cpp b/mil_common/ros_alarms/test/roscpp/listener_test.cpp index 2138546e5..f365a1305 100644 --- a/mil_common/ros_alarms/test/roscpp/listener_test.cpp +++ b/mil_common/ros_alarms/test/roscpp/listener_test.cpp @@ -51,7 +51,7 @@ TEST(ListenerTest, listenerTest) ab.getAlarm() = pxy; ab.clear(); // alarm starts off cleared - // Last update time happened wehen we called ab.clear() + // Last update time happened when we called ab.clear() auto first_query = listener.getLastUpdateTime(); ab.updateSeverity(5); // This is an update to the alarm diff --git a/mil_common/ros_alarms/test/rospy/python_tests.py b/mil_common/ros_alarms/test/rospy/python_tests.py index 9c29a7305..c11b0f061 100755 --- a/mil_common/ros_alarms/test/rospy/python_tests.py +++ b/mil_common/ros_alarms/test/rospy/python_tests.py @@ -17,7 +17,7 @@ def __init__(self, *args): super().__init__(*args) """ Tests alarm client operations - Creates some listeners and some broadcasters and tests various raising and clearing conditoins + Creates some listeners and some broadcasters and tests various raising and clearing conditions Also tests various combination of parameters """ @@ -142,7 +142,7 @@ def test_callbacks(self): self.cleared = False self.both = False - # Make sure callbacks run when they're suppsed to + # Make sure callbacks run when they're supposed to ab_a.raise_alarm() rospy.sleep(0.5) diff --git a/mil_common/utils/mil_tools/mil_ros_tools/image_helpers.py b/mil_common/utils/mil_tools/mil_ros_tools/image_helpers.py index 22f8eac56..45e12b931 100644 --- a/mil_common/utils/mil_tools/mil_ros_tools/image_helpers.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/image_helpers.py @@ -98,7 +98,7 @@ class Image_Subscriber: last_image_time (genpy.Time): The time of the last image received. im_sub (rospy.Subscriber): The subscriber to the image topic. The topic name and queue size are received through the constructor. - info_sub (rospy.Susbcriber): The subscriber to the camera info topic. + info_sub (rospy.Subscriber): The subscriber to the camera info topic. The topic name is derived from the root of the supplied topic and the queue size is derived from the constructor. bridge (CvBridge): The bridge between OpenCV and ROS. From 740f752ac2b36452bfefe084bbf06dc8c9fdc895 Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Mon, 6 Nov 2023 14:31:32 -0500 Subject: [PATCH 16/19] Fix too short underline --- docs/design/passive_sonar/passive_sonar.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design/passive_sonar/passive_sonar.rst b/docs/design/passive_sonar/passive_sonar.rst index 590a7010c..6f23f38ab 100644 --- a/docs/design/passive_sonar/passive_sonar.rst +++ b/docs/design/passive_sonar/passive_sonar.rst @@ -79,7 +79,7 @@ Configuration All parameters that are expected to be changed in tuining are ROS Params initialized in ``passive_sonar.yaml`` To make a custom configuration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * ``roscd subjugator_launch`` From 97e7f7f18e52088fe61157eb48eeb2268c9f844b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 17:18:24 +0000 Subject: [PATCH 17/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/adrienverge/yamllint.git: v1.32.0 → v1.33.0](https://github.com/adrienverge/yamllint.git/compare/v1.32.0...v1.33.0) - [github.com/psf/black: 23.9.1 → 23.12.1](https://github.com/psf/black/compare/23.9.1...23.12.1) - [github.com/pre-commit/mirrors-clang-format: v16.0.6 → v17.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.6...v17.0.6) - [github.com/scop/pre-commit-shfmt: v3.7.0-1 → v3.7.0-4](https://github.com/scop/pre-commit-shfmt/compare/v3.7.0-1...v3.7.0-4) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.9) - [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6) - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7751457af..694da46a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,15 +11,15 @@ ci: repos: - repo: https://github.com/adrienverge/yamllint.git - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.12.1 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.6 + rev: v17.0.6 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake @@ -34,18 +34,18 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX args: [--severity=warning, --exclude=SC1090] - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.7.0-1 + rev: v3.7.0-4 hooks: - id: shfmt exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.0.292' + rev: 'v0.1.9' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.2.6 hooks: - id: codespell args: @@ -73,7 +73,7 @@ repos: - id: prettier-package-xml - id: sort-package-xml - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-case-conflict From 962fc9c3c1f6ee063562114cf599adee619161da Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Sat, 27 Jan 2024 16:55:24 -0500 Subject: [PATCH 18/19] Update wait-on-check-action action for dependency updates --- .github/workflows/gh_pages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh_pages.yaml b/.github/workflows/gh_pages.yaml index b54342c28..39b70c62a 100644 --- a/.github/workflows/gh_pages.yaml +++ b/.github/workflows/gh_pages.yaml @@ -20,7 +20,7 @@ jobs: # Wait for the CI to finish so we can download the docs artifact - name: Wait for CI - uses: lewagon/wait-on-check-action@v1.0.0 + uses: lewagon/wait-on-check-action@v1.3.3 if: github.event.action != 'closed' with: ref: ${{ github.event.pull_request.head.ref }} From 64cd4cb543fc23ea90b9698824ab842d8116abe1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:20:03 +0000 Subject: [PATCH 19/19] Update pre-commit hooks to latest versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/adrienverge/yamllint.git: v1.32.0 → v1.33.0](https://github.com/adrienverge/yamllint.git/compare/v1.32.0...v1.33.0) - [github.com/psf/black: 23.9.1 → 24.1.1](https://github.com/psf/black/compare/23.9.1...24.1.1) - [github.com/pre-commit/mirrors-clang-format: v16.0.6 → v17.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.6...v17.0.6) - [github.com/scop/pre-commit-shfmt: v3.7.0-1 → v3.7.0-4](https://github.com/scop/pre-commit-shfmt/compare/v3.7.0-1...v3.7.0-4) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.2.0) - [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6) - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7751457af..daeabceb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,15 +11,15 @@ ci: repos: - repo: https://github.com/adrienverge/yamllint.git - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.1.1 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.6 + rev: v17.0.6 hooks: - id: clang-format - repo: https://github.com/PyCQA/autoflake @@ -34,18 +34,18 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX args: [--severity=warning, --exclude=SC1090] - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.7.0-1 + rev: v3.7.0-4 hooks: - id: shfmt exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.0.292' + rev: 'v0.2.0' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.2.6 hooks: - id: codespell args: @@ -73,7 +73,7 @@ repos: - id: prettier-package-xml - id: sort-package-xml - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-case-conflict