AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
robotInterface.h
1 #ifndef ROBOTINTERFACE_H
2 #define ROBOTINTERFACE_H
3 
4 #include <iostream>
5 #include <ros/ros.h>
6 #include <tf/transform_listener.h>
7 #include <geometry_msgs/Twist.h>
8 #include <geometry_msgs/WrenchStamped.h>
9 #include <sensor_msgs/JointState.h>
10 #include <boost/circular_buffer.hpp>
11 
12 #include <Eigen/Core>
13 #include "../../support/header/conversions.h"
14 #include "../../support/header/defines.h"
15 #include "../../support/header/formulas.h"
16 
17 
18 #define NELEMENTQUEUEFOR 10 //number of element in queue for force
19 #define NELEMENTQUEUETOR 10
20 
39 {
40 public:
41  RobotInterface(ros::NodeHandle nh, std::string robotName);
42  int init();
43  int getwTv(Eigen::Matrix4d* wTv_eigen);
44  int getJointState(std::vector<double>* jState);
45  int sendyDot(std::vector<double> yDot);
46 
47  int getForceTorque(Eigen::Vector3d* force, Eigen::Vector3d* torque);
48 
49  //int getwTjoints(std::vector<Eigen::Matrix4d> *wTjoints);
50 
51 
52 private:
53  std::string robotName; //for tf listener (girona500_A,B)
54  std::string topicRoot; //for publishing yDot and subscribing to sensors ("/uwsim/g500_A/")
55  tf::TransformListener tfListener;
56  ros::Publisher pubTwist;
57  ros::Publisher pubJoint;
58  ros::Subscriber subJointState;
59  ros::Subscriber subForceTorque;
60 
61  std::vector<double> jState_priv;
62  //std::vector<double> force_priv; with queues they dont need to be member of class
63  //std::vector<double> torque_priv;
64  void subJointStateCallback(const sensor_msgs::JointState& js);
65  void subForceTorqueCallback(const geometry_msgs::WrenchStamped& msg);
66 
67  std::vector<boost::circular_buffer<double>> vectorForceQueue;
68  std::vector<boost::circular_buffer<double>> vectorTorqueQueue;
69 
70 
71 
72 };
73 
74 
75 #endif // ROBOTINTERFACE_H
int getJointState(std::vector< double > *jState)
robotInterface::getJointState
robotInterface: a ros node responsible of taken info from simulator and robot sensors, and of given commands back. It is the intermiate layer between actual robot and mission manager ("main")
RobotInterface(ros::NodeHandle nh, std::string robotName)
robotInterface::robotInterface Constructor