From 886943bfdf5d1b0458b31bc4bf8ff4ac3b5e0d74 Mon Sep 17 00:00:00 2001 From: MeshvaD Date: Thu, 9 Feb 2023 00:59:47 -0500 Subject: [PATCH] linting --- .../launch/armlaunchbase.py | 43 +++++++++---------- .../uwrt_mars_rover_arm_urdf/launch/launch.py | 37 ++++++++-------- .../motion_plan_client.hpp | 14 +++--- .../motion_plan_server.hpp | 18 ++++---- .../src/motion_plan_client.cpp | 13 +++--- .../src/motion_plan_server.cpp | 19 ++++---- 6 files changed, 74 insertions(+), 70 deletions(-) diff --git a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/armlaunchbase.py b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/armlaunchbase.py index 50d35e9d..636e8122 100644 --- a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/armlaunchbase.py +++ b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/armlaunchbase.py @@ -1,26 +1,23 @@ -""" -MIT License - -Copyright (c) 2019-2021 University of Waterloo Robotics Team - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" +# Licensed under the MIT License (the "License"); +# Copyright (c) 2019-2021 University of Waterloo Robotics Team + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. import os diff --git a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/launch.py b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/launch.py index 7d178c9e..ab766085 100644 --- a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/launch.py +++ b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf/launch/launch.py @@ -1,26 +1,23 @@ -""" -MIT License +# Licensed under the MIT License (the "License"); +# Copyright (c) 2019-2021 University of Waterloo Robotics Team -Copyright (c) 2019-2021 University of Waterloo Robotics Team +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. from launch import LaunchDescription from launch.actions import DeclareLaunchArgument diff --git a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_client.hpp b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_client.hpp index 41b1353e..f432a87a 100644 --- a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_client.hpp +++ b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_client.hpp @@ -5,15 +5,17 @@ #include "uwrt_mars_rover_arm_urdf_moveit/srv/motion_plan.hpp" #include "uwrt_mars_rover_arm_urdf_moveit/visibility_control.hpp" -namespace uwrt_motion_planning { -class MotionPlanClient : public rclcpp::Node { - public: - explicit MotionPlanClient(const rclcpp::NodeOptions& options); +namespace uwrt_motion_planning +{ +class MotionPlanClient : public rclcpp::Node +{ +public: + explicit MotionPlanClient(const rclcpp::NodeOptions & options); - protected: +protected: void execute(); - private: +private: rclcpp::Client::SharedPtr client_; }; diff --git a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_server.hpp b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_server.hpp index 88ec618e..c89f50d3 100644 --- a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_server.hpp +++ b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/include/uwrt_mars_rover_arm_urdf_moveit/motion_plan_server.hpp @@ -10,17 +10,19 @@ #include "uwrt_mars_rover_arm_urdf_moveit/srv/motion_plan.hpp" #include "uwrt_mars_rover_arm_urdf_moveit/visibility_control.hpp" -namespace uwrt_motion_planning { - -class MotionPlanServer : public rclcpp::Node { - public: +namespace uwrt_motion_planning +{ +class MotionPlanServer : public rclcpp::Node +{ +public: UWRT_MOTION_PLANNING_PUBLIC - explicit MotionPlanServer(const rclcpp::NodeOptions& options); + explicit MotionPlanServer(const rclcpp::NodeOptions & options); - private: +private: rclcpp::Service::SharedPtr srv_; - void solve_ik(const std::shared_ptr request, - std::shared_ptr response); + void solve_ik( + const std::shared_ptr request, + std::shared_ptr response); }; } // namespace uwrt_motion_planning diff --git a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_client.cpp b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_client.cpp index ba094a03..2f513ff3 100644 --- a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_client.cpp +++ b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_client.cpp @@ -9,15 +9,17 @@ using namespace std::chrono_literals; -namespace uwrt_motion_planning { - -MotionPlanClient::MotionPlanClient(const rclcpp::NodeOptions& options) : Node("Client", options) { +namespace uwrt_motion_planning +{ +MotionPlanClient::MotionPlanClient(const rclcpp::NodeOptions & options) : Node("Client", options) +{ client_ = create_client("motion_plan"); execute(); } -void MotionPlanClient::execute() { +void MotionPlanClient::execute() +{ if (!client_->wait_for_service(1s)) { if (!rclcpp::ok()) { RCLCPP_ERROR(this->get_logger(), "Interrupted while waiting for the service. Exiting."); @@ -36,7 +38,8 @@ void MotionPlanClient::execute() { auto request = std::make_shared(); request->pose = target; - using ServiceResponseFuture = rclcpp::Client::SharedFuture; + using ServiceResponseFuture = + rclcpp::Client::SharedFuture; auto response_received_callback = [this](ServiceResponseFuture future) { RCLCPP_INFO(this->get_logger(), "Got result: [%d]", future.get()->success); }; diff --git a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_server.cpp b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_server.cpp index 04e3f3fb..9a8785c8 100644 --- a/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_server.cpp +++ b/uwrt_mars_rover_arm/uwrt_mars_rover_arm_description/uwrt_mars_rover_arm_urdf_moveit/src/motion_plan_server.cpp @@ -6,21 +6,24 @@ #include "rclcpp/rclcpp.hpp" -namespace uwrt_motion_planning { - -MotionPlanServer::MotionPlanServer(const rclcpp::NodeOptions& options) : Node("Server", options) { +namespace uwrt_motion_planning +{ +MotionPlanServer::MotionPlanServer(const rclcpp::NodeOptions & options) : Node("Server", options) +{ srv_ = create_service( - "motion_plan", std::bind(&MotionPlanServer::solve_ik, this, std::placeholders::_1, std::placeholders::_2)); + "motion_plan", + std::bind(&MotionPlanServer::solve_ik, this, std::placeholders::_1, std::placeholders::_2)); } void MotionPlanServer::solve_ik( - const std::shared_ptr request, - std::shared_ptr response) { + const std::shared_ptr request, + std::shared_ptr response) +{ RCLCPP_INFO(this->get_logger(), "Incoming request"); - // set move_group that we are planning for static const std::string PLANNING_GROUP = "uwrt_arm"; - moveit::planning_interface::MoveGroupInterface move_group(this->shared_from_this(), PLANNING_GROUP); + moveit::planning_interface::MoveGroupInterface move_group( + this->shared_from_this(), PLANNING_GROUP); move_group.setPoseTarget(request->pose);