HLR  0.0.1
ObjectMoveHandler.hpp
1 #ifndef KINEMATICS_OBJECT_MOVE_HANDLER_HPP
2 #define KINEMATICS_OBJECT_MOVE_HANDLER_HPP
3 
4 #include <ros/ros.h>
5 #include "HLR/Error.h"
6 #include "HLR/ObjectMoveAction.h"
7 #include "HLR/ObjectMoveStart.h"
8 #include "HLR/State.h"
9 
10 #include "RobotController.hpp"
11 
12 namespace HLR
13 {
14 namespace Kinematics
15 {
26 {
27 public:
34 
38  virtual ~ObjectMoveHandler() = default;
39 
44  ObjectMoveHandler(const ObjectMoveHandler& omh) = delete;
45 
50  ObjectMoveHandler(ObjectMoveHandler&& omh) = delete;
51 
57  ObjectMoveHandler& operator=(const ObjectMoveHandler& omh) = delete;
58 
65 
74  bool object_move_start(HLR::ObjectMoveStart::Request& req,
75  HLR::ObjectMoveStart::Response& res);
76 
86  bool object_move_cancel(HLR::ObjectMoveAction::Request& req,
87  HLR::ObjectMoveAction::Response& res);
88 
98  bool object_move_continue(HLR::ObjectMoveAction::Request& req,
99  HLR::ObjectMoveAction::Response& res);
100 
110  bool object_move_stop(HLR::ObjectMoveAction::Request& req,
111  HLR::ObjectMoveAction::Response& res);
112 
113 private:
120  std::uint8_t convert_controller_state_to_ros_msg(
121  RobotControllerState state) const noexcept;
122 
129  std::uint8_t convert_error_to_ros_msg(ArmError err) const noexcept;
130 
134  ros::NodeHandle nh;
135 
139  ros::Publisher state_pub;
140 
144  ros::Publisher error_pub;
145 
149  ros::ServiceServer service_move_start;
150 
154  ros::ServiceServer service_move_stop;
155 
159  ros::ServiceServer service_move_continue;
160 
164  ros::ServiceServer service_move_cancel;
165 
170  RobotController& controller;
171 };
172 
173 } // namespace Kinematics
174 } // namespace HLR
175 
176 #endif /* KINEMATICS_OBJECT_MOVE_HANDLER_HPP */
virtual ~ObjectMoveHandler()=default
Destructor.
bool object_move_start(HLR::ObjectMoveStart::Request &req, HLR::ObjectMoveStart::Response &res)
Start moving (grabbing) the specified cup based on ID If already moving ID is added to queue and exec...
bool object_move_stop(HLR::ObjectMoveAction::Request &req, HLR::ObjectMoveAction::Response &res)
Callback that is executed when the movement needs to stop Stop can be used when a movement is perform...
bool object_move_continue(HLR::ObjectMoveAction::Request &req, HLR::ObjectMoveAction::Response &res)
Callback that is executed when the moevement needs to be continue Continue can be used when the movem...
ObjectMoveHandler(RobotController &controller)
Constructor.
RobotControllerState
The current state of the robot controller.
Definition: RobotController.hpp:61
This class contains the main logic of the robotic arm. It handles the calculation of robotic path and...
Definition: RobotController.hpp:123
Interface to send commands to the Kinematics component Executes actions on the robotarm based in the ...
Definition: ObjectMoveHandler.hpp:25
ArmError
Enum containing possible reasons for the robot arm not being able to succesfully execute the specifie...
Definition: RobotController.hpp:98
ObjectMoveHandler & operator=(const ObjectMoveHandler &omh)=delete
Copy assignment operator, deleted.
bool object_move_cancel(HLR::ObjectMoveAction::Request &req, HLR::ObjectMoveAction::Response &res)
Callback that is executed when the movement needs to be canceled Cup will be placed back on original ...