From ffdf261e324aaa91e75685b6c2f124ff4f459cc2 Mon Sep 17 00:00:00 2001 From: Chandima Fernando Date: Wed, 14 Feb 2024 22:32:23 -0500 Subject: [PATCH] fix: lint errors --- src/pdf_beamtime/CMakeLists.txt | 5 +---- .../include/pdf_beamtime/inner_state_machine.hpp | 11 ++++++++--- src/pdf_beamtime/include/pdf_beamtime/state_enum.hpp | 2 ++ src/pdf_beamtime/src/inner_state_machine.cpp | 2 ++ src/pdf_beamtime/src/pdf_beamtime_server.cpp | 12 +++++++----- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/pdf_beamtime/CMakeLists.txt b/src/pdf_beamtime/CMakeLists.txt index cbbb2301..dc38652c 100644 --- a/src/pdf_beamtime/CMakeLists.txt +++ b/src/pdf_beamtime/CMakeLists.txt @@ -25,10 +25,7 @@ set(dependencies include_directories(include) # This makes sure the libraries are visible -add_executable(pdf_beamtime_server - src/pdf_beamtime_server.cpp - src/inner_state_machine.cpp ) - +add_executable(pdf_beamtime_server src/pdf_beamtime_server.cpp src/inner_state_machine.cpp ) ament_target_dependencies(pdf_beamtime_server ${dependencies}) install(TARGETS diff --git a/src/pdf_beamtime/include/pdf_beamtime/inner_state_machine.hpp b/src/pdf_beamtime/include/pdf_beamtime/inner_state_machine.hpp index d2914e75..0c7978d1 100644 --- a/src/pdf_beamtime/include/pdf_beamtime/inner_state_machine.hpp +++ b/src/pdf_beamtime/include/pdf_beamtime/inner_state_machine.hpp @@ -1,13 +1,18 @@ +/*Copyright 2023 Brookhaven National Laboratory +BSD 3 Clause License. See LICENSE.txt for details.*/ #pragma once -#include #include -#include + +#include #include +#include +#include +#include +#include class InnerStateMachine { - private: rclcpp::Node::SharedPtr node_; State external_state_enum_; diff --git a/src/pdf_beamtime/include/pdf_beamtime/state_enum.hpp b/src/pdf_beamtime/include/pdf_beamtime/state_enum.hpp index 3b423210..68b4d21d 100644 --- a/src/pdf_beamtime/include/pdf_beamtime/state_enum.hpp +++ b/src/pdf_beamtime/include/pdf_beamtime/state_enum.hpp @@ -1,3 +1,5 @@ +/*Copyright 2023 Brookhaven National Laboratory +BSD 3 Clause License. See LICENSE.txt for details.*/ #pragma once /// @brief States of the robot transitions diff --git a/src/pdf_beamtime/src/inner_state_machine.cpp b/src/pdf_beamtime/src/inner_state_machine.cpp index be89f637..77d7d87d 100644 --- a/src/pdf_beamtime/src/inner_state_machine.cpp +++ b/src/pdf_beamtime/src/inner_state_machine.cpp @@ -1,3 +1,5 @@ +/*Copyright 2023 Brookhaven National Laboratory +BSD 3 Clause License. See LICENSE.txt for details.*/ #include InnerStateMachine::InnerStateMachine( diff --git a/src/pdf_beamtime/src/pdf_beamtime_server.cpp b/src/pdf_beamtime/src/pdf_beamtime_server.cpp index 94575642..f46b63a7 100644 --- a/src/pdf_beamtime/src/pdf_beamtime_server.cpp +++ b/src/pdf_beamtime/src/pdf_beamtime_server.cpp @@ -304,7 +304,8 @@ moveit::core::MoveItErrorCode PdfBeamtimeServer::run_fsm( moveit::core::MoveItErrorCode motion_results = moveit::core::MoveItErrorCode::FAILURE; switch (current_state_) { case State::HOME: - // Moves the robot to pickup approach. If success: change state, increment progress, reset internel state + // Moves the robot to pickup approach. + // If success: change state, increment progress, reset internel state motion_results = inner_state_machine_->move_robot( move_group_interface_, goal->pickup_approach); @@ -316,7 +317,8 @@ moveit::core::MoveItErrorCode PdfBeamtimeServer::run_fsm( break; case State::PICKUP_APPROACH: - // Moves the robot to pickup. If success: change state, increment progress, reset internel state + // Moves the robot to pickup. + // If success: change state, increment progress, reset internel state motion_results = inner_state_machine_->move_robot( move_group_interface_, goal->pickup); @@ -329,7 +331,7 @@ moveit::core::MoveItErrorCode PdfBeamtimeServer::run_fsm( case State::PICKUP: // Pick up object by closing gripper. If success: move to grasp success with progress. - //if fails, move to grasp_failure + // if fails, move to grasp_failure if (this->gripper_present_) { motion_results = inner_state_machine_->close_gripper(); if (motion_results == moveit::core::MoveItErrorCode::SUCCESS) { @@ -438,7 +440,7 @@ moveit::core::MoveItErrorCode PdfBeamtimeServer::run_fsm( if (motion_results == moveit::core::MoveItErrorCode::SUCCESS) { set_current_state(State::PICKUP_APPROACH); inner_state_machine_->set_internal_state(Internal_State::RESTING); - progress_ = 1.0; // Reset the progress to 1 because this is a retry + progress_ = 1.0; // Reset the progress to 1 because this is a retry } break; @@ -482,7 +484,7 @@ void PdfBeamtimeServer::handle_stop() void PdfBeamtimeServer::execute_stop() { -///@todo @ChandimaFernando This needs testing + // @todo @ChandimaFernando This needs testing switch (current_state_) { case State::GRASP_SUCCESS: // handle the decision to pick up something else after successfully grabing the sample