ROS-UVS  1.0.0
A Minimalistic ROS Library for Visual Constraint Minimization through Uncalibrated Visual Servoing
 All Classes Files Functions Variables
matlab_controller.h
Go to the documentation of this file.
1 #ifndef MATLAB_CONTROLLER_H
2 #define MATLAB_CONTROLLER_H
3 
4 #include <ros/ros.h>
5 #include <Eigen/Core>
6 #include "sensor_msgs/JointState.h"
7 #include "geometry_msgs/PoseStamped.h"
8 
9 #include "visual_servoing/JointMove.h"
11 
13  public:
14  double max_rate = 0.01;
15  MatlabController(std::string robot_ns, ros::NodeHandle nh);
16 
17  bool delta_move(const Eigen::VectorXd& delta);
18  bool rt_delta_move(const Eigen::VectorXd& delta);
19  bool joint_move(const Eigen::VectorXd& target_jnt_state);
20 
21  geometry_msgs::PoseStamped get_pose() {
22  return last_pose;
23  }
24 
25  Eigen::VectorXd get_jnt_state();
26  Eigen::VectorXd get_used_jnt_state();
27 
28  size_t get_dof() {
29  return last_jnt_state.position.size();
30  }
31 
32  std::vector<int> get_used_joints() {
33  return mapping;
34  }
35 
36  void set_used_joints(std::string);
37  void set_used_joints(std::vector<int> new_joints);
38 
39  void set_target_joint_pose(Eigen::VectorXd target);
40  Eigen::VectorXd map_joints(const Eigen::VectorXd& delta);
41 
42  private:
43  // Arm Services
44  ros::ServiceClient joint_move_srvs;
45 
46  ros::Subscriber pose_sub;
47  ros::Subscriber jnt_sub;
48 
49  geometry_msgs::PoseStamped last_pose;
50  sensor_msgs::JointState last_jnt_state;
51 
52  std::vector<int> mapping{0,1,3,4};
53 
54  template <size_t DOF>
55  Eigen::VectorXd _map_joints(const Eigen::VectorXd& delta);
56 
57  void pose_cb(geometry_msgs::PoseStampedConstPtr pose) {
58  last_pose = *pose;
59  }
60 
61  void jnt_state_cb(sensor_msgs::JointStateConstPtr state) {
62  last_jnt_state = *state;
63  }
64 };
65 
66 #endif // MATLAB_CONTROLLER_H
size_t get_dof()
Definition: matlab_controller.h:28
double max_rate
Definition: matlab_controller.h:14
Definition: robot_controller.h:6
bool rt_delta_move(const Eigen::VectorXd &delta)
Definition: matlab_controller.cpp:34
geometry_msgs::PoseStamped get_pose()
Definition: matlab_controller.h:21
Eigen::VectorXd get_jnt_state()
Definition: matlab_controller.cpp:38
bool delta_move(const Eigen::VectorXd &delta)
Definition: matlab_controller.cpp:25
void set_used_joints(std::string)
Definition: matlab_controller.cpp:59
bool joint_move(const Eigen::VectorXd &target_jnt_state)
Definition: matlab_controller.cpp:16
void set_target_joint_pose(Eigen::VectorXd target)
Definition: matlab_controller.cpp:75
Definition: matlab_controller.h:12
MatlabController(std::string robot_ns, ros::NodeHandle nh)
Definition: matlab_controller.cpp:6
Eigen::VectorXd get_used_jnt_state()
Definition: matlab_controller.cpp:78
Eigen::VectorXd map_joints(const Eigen::VectorXd &delta)
Definition: matlab_controller.cpp:46
std::vector< int > get_used_joints()
Definition: matlab_controller.h:32