HLR  0.0.1
RosRobotDriverHandler.hpp
1 #ifndef KINEMATICS_ROSROBOTDRIVERHANDLER_HPP
2 #define KINEMATICS_ROSROBOTDRIVERHANDLER_HPP
3 
4 #include <atomic>
5 #include <unordered_map>
6 
7 #include <ros/ros.h>
8 #include "std_msgs/UInt64.h"
9 #include "RobotDriverHandler.hpp"
10 #include <Kinematics/Matrix.hpp>
11 
12 namespace HLR
13 {
14 namespace Kinematics
15 {
20 {
21 public:
24 
26  virtual ~RosRobotDriverHandler() = default;
27 
32  RosRobotDriverHandler(const RosRobotDriverHandler& rdh) = delete;
33 
39 
46 
53 
54  Matrix<double, 5, 1> get_arm_state() const noexcept override;
55 
56  void move(const std::vector<Matrix<double, 5, 1>>& path,
57  double speed) override;
58 
59  void stop() override;
60 
61 private:
67  void sub_move_complete(const std_msgs::UInt64::ConstPtr& id);
68 
72  std::function<void()> move_complete_handler;
73 
77  ros::NodeHandle nh;
78 
82  ros::Subscriber id_subscriber;
83 
87  ros::ServiceClient driver_stop;
88 
92  ros::ServiceClient driver_add;
93 
97  std::atomic<Matrix<double, 5, 1>> current_arm_state;
98 
102  std::uint64_t id_to_wait = 0;
103 
108  std::unordered_map<std::uint64_t, Matrix<double, 5, 1>> moves_being_handled;
109 };
110 
111 } // namespace Kinematics
112 } // namespace HLR
113 
114 #endif
void stop() override
Stop the robotarm if it is moving/.
RosRobotDriverHandler & operator=(const RosRobotDriverHandler &rdh)=delete
Copy assignment operator, deleted.
Concrete handle on the robot using the ROS interface.
Definition: RosRobotDriverHandler.hpp:19
void move(const std::vector< Matrix< double, 5, 1 >> &path, double speed) override
Move the robot arm along a path.
Interface that exposes the interface to the robotarm.
Definition: RobotDriverHandler.hpp:14
virtual ~RosRobotDriverHandler()=default
Destructor.
Create a matrix with numerical values.
Definition: Matrix.hpp:22
Matrix< double, 5, 1 > get_arm_state() const noexceptoverride
Get the current position of the robot arm.