Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
meshvaD committed Feb 9, 2023
1 parent 09c49b4 commit a8f9d7a
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
"""
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.
"""
# 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.

import os

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
"""
MIT License
# 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:

Copyright (c) 2019-2021 University of Waterloo Robotics Team
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

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.
"""
# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan>::SharedPtr client_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan>::SharedPtr srv_;
void solve_ik(const std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Request> request,
std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Response> response);
void solve_ik(
const std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Request> request,
std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Response> response);
};

} // namespace uwrt_motion_planning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan>("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.");
Expand All @@ -36,7 +38,8 @@ void MotionPlanClient::execute() {
auto request = std::make_shared<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Request>();
request->pose = target;

using ServiceResponseFuture = rclcpp::Client<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan>::SharedFuture;
using ServiceResponseFuture =
rclcpp::Client<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan>::SharedFuture;
auto response_received_callback = [this](ServiceResponseFuture future) {
RCLCPP_INFO(this->get_logger(), "Got result: [%d]", future.get()->success);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan>(
"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<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Request> request,
std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Response> response) {
const std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Request> request,
std::shared_ptr<uwrt_mars_rover_arm_urdf_moveit::srv::MotionPlan::Response> 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);

Expand Down

0 comments on commit a8f9d7a

Please sign in to comment.