Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandimaFernando committed Feb 15, 2024
1 parent 6fc979d commit ffdf261
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
5 changes: 1 addition & 4 deletions src/pdf_beamtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions src/pdf_beamtime/include/pdf_beamtime/inner_state_machine.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/*Copyright 2023 Brookhaven National Laboratory
BSD 3 Clause License. See LICENSE.txt for details.*/
#pragma once

#include <rclcpp/node.hpp>
#include <moveit/move_group_interface/move_group_interface.h>
#include <pdf_beamtime/state_enum.hpp>

#include <rclcpp/node.hpp>
#include <future>
#include <string>
#include <map>
#include <vector>
#include <pdf_beamtime/state_enum.hpp>

class InnerStateMachine
{

private:
rclcpp::Node::SharedPtr node_;
State external_state_enum_;
Expand Down
2 changes: 2 additions & 0 deletions src/pdf_beamtime/include/pdf_beamtime/state_enum.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/pdf_beamtime/src/inner_state_machine.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*Copyright 2023 Brookhaven National Laboratory
BSD 3 Clause License. See LICENSE.txt for details.*/
#include <pdf_beamtime/inner_state_machine.hpp>

InnerStateMachine::InnerStateMachine(
Expand Down
12 changes: 7 additions & 5 deletions src/pdf_beamtime/src/pdf_beamtime_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ffdf261

Please sign in to comment.