AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
coordInterfaceCoord.h
1 #ifndef COORDINTERFACECOORD_H
2 #define COORDINTERFACECOORD_H
3 
4 #include <iostream>
5 #include <vector>
6 #include <ros/ros.h>
7 #include <std_msgs/Bool.h>
8 #include <peg_msgs/toCoord.h>
9 #include <peg_msgs/transformMat.h>
10 #include <geometry_msgs/WrenchStamped.h>
11 #include <geometry_msgs/Vector3Stamped.h>
12 #include <Eigen/Core>
13 #include "../../support/header/defines.h"
14 #include "../../support/header/conversions.h"
15 
16 
22 {
23 public:
24  CoordInterfaceCoord(ros::NodeHandle nh, std::string robotNameA,
25  std::string robotNameB);
26  bool getReadyBothRob();
27 
28  int getMatricesFromRobs(Eigen::Matrix<double, VEHICLE_DOF, 1> *nonCoopCartVelA,
29  Eigen::Matrix<double, VEHICLE_DOF, 1> *nonCoopCartVelB,
30  Eigen::Matrix<double, VEHICLE_DOF, VEHICLE_DOF> *admisVelToolA,
31  Eigen::Matrix<double, VEHICLE_DOF, VEHICLE_DOF> *admisVelToolB);
32 
33  void publishCoopVel(Eigen::Matrix<double, VEHICLE_DOF, 1> coopVel);
34  void publishStartBoth(bool start);
35 
36  //change goal things
37  int getForceTorque(Eigen::Vector3d* force, Eigen::Vector3d* torque);
38  void publishUpdatedGoal(Eigen::Matrix4d wTgoal);
39 
40 
41 private:
42  bool getReadyRobA();
43  bool getReadyRobB();
44  int getNonCoopCartVel(Eigen::Matrix<double, VEHICLE_DOF, 1> *nonCoopCartVel_eigen,
45  std::string robotName);
46  int getJJsharp(Eigen::Matrix<double, VEHICLE_DOF, VEHICLE_DOF> *admisVelTool_eigen,
47  std::string robotName);
48 
49 
50  std::string robotNameA;
51  std::string robotNameB;
52  bool readyRobA;
53  bool readyRobB;
54  ros::Subscriber readyRobASub;
55  ros::Subscriber readyRobBSub;
56  ros::Subscriber subCoordFromMMA;
57  ros::Subscriber subCoordFromMMB;
58 
59  ros::Publisher startBothPub;
60  ros::Publisher coopVelPub;
61 
62 
63  std::vector<double> tempXdotA;
64  std::vector<double> tempJJsharpA;
65  std::vector<double> tempXdotB;
66  std::vector<double> tempJJsharpB;
67 
68  bool readxDotA;
69  bool readxDotB;
70  bool readJJsharpA;
71  bool readJJsharpB;
72 
73  void readyRobASubCallback(const std_msgs::Bool::ConstPtr& start);
74  void subCoordFromMMACallBack(const peg_msgs::toCoord::ConstPtr& msg);
75  void readyRobBSubCallback(const std_msgs::Bool::ConstPtr& start);
76  void subCoordFromMMBCallBack(const peg_msgs::toCoord::ConstPtr& msg);
77 
78  //change goal things
79  ros::Subscriber subForceTorque;
80  std::vector<double> vectorForce;
81  std::vector<double> vectorTorque;
82  void subForceTorqueCallback(const geometry_msgs::WrenchStamped& msg);
83  ros::Publisher pubUpdateGoal;
84 
85 
86 };
87 
88 #endif // COORDINTERFACECOORD_H
The CoordInterfaceCoord class.
int getMatricesFromRobs(Eigen::Matrix< double, VEHICLE_DOF, 1 > *nonCoopCartVelA, Eigen::Matrix< double, VEHICLE_DOF, 1 > *nonCoopCartVelB, Eigen::Matrix< double, VEHICLE_DOF, VEHICLE_DOF > *admisVelToolA, Eigen::Matrix< double, VEHICLE_DOF, VEHICLE_DOF > *admisVelToolB)
CoordInterfaceCoord::getMatricesFromRobs get all matrices needed to algorithm The function call each ...