AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
missionManagerPeg.cpp
1 #include "header/missionManagerPeg.h"
2 #include <chrono>
3 
4 
17 int main(int argc, char **argv)
18 {
19  if (argc < 3){
20  std::cout << "[MISSION_MANAGER] Please insert the two robots name"<< std::endl;
21  return -1;
22  }
23  std::string robotName = argv[1];
24  std::string otherRobotName = argv[2];
25  std::string pathLog;
26  if (LOG && (argc > 3)){ //if flag log setted to 1 and path log is given
27  pathLog = argv[3];
28  }
29 
30 
32  ros::init(argc, argv, robotName + "_MissionManagerPeg");
33  std::cout << "[" << robotName << "][MISSION_MANAGERPEG] Start" << std::endl;
34  ros::NodeHandle nh;
35 
36 
42  double goalLinearVect[] = {-0.287, -0.090, 8};
44  Eigen::Matrix4d wTgoalVeh_eigen = Eigen::Matrix4d::Identity();
45  //rot part
46  wTgoalVeh_eigen.topLeftCorner(3,3) = Eigen::Matrix3d::Identity();
47  //trasl part
48  wTgoalVeh_eigen(0, 3) = goalLinearVect[0];
49  wTgoalVeh_eigen(1, 3) = goalLinearVect[1];
50  wTgoalVeh_eigen(2, 3) = goalLinearVect[2];
51 
53  double goalLinearVectEE[3];
54  if (robotName.compare("g500_A") == 0){
55  goalLinearVectEE[0] = 2.89;
56  goalLinearVectEE[1] = -0.090;
57  goalLinearVectEE[2] = 9.594;
58 
59  } else {
60  goalLinearVectEE[0] = -1.11;
61  goalLinearVectEE[1] = -0.090;
62  goalLinearVectEE[2] = 9.594;
63  }
64  Eigen::Matrix4d wTgoalEE_eigen = Eigen::Matrix4d::Identity();
65  //rot part
66  //wTgoalEE_eigen.topLeftCorner<3,3>() = Eigen::Matrix3d::Identity();
67  //the ee must rotate of 90 on z axis degree to catch the peg
68  wTgoalEE_eigen.topLeftCorner(3,3) << 0, -1, 0,
69  1, 0, 0,
70  0, 0, 1;
71  //trasl part
72  wTgoalEE_eigen(0, 3) = goalLinearVectEE[0];
73  wTgoalEE_eigen(1, 3) = goalLinearVectEE[1];
74  wTgoalEE_eigen(2, 3) = goalLinearVectEE[2];
75 
77  //double goalLinearVectTool[] = {-0.27, -0.102, 2.124};
78  double goalLinearVectTool[] = {0.9999999999999999, -9.999999999999998, 8.378840300977453};
79  std::vector<double> eulRad = {0, 0, -1.443185307179587}; //true
80  //std::vector<double> eulRad = {0.0, 0.0, -1.303185307179587}; //with error on z: 0.1rad ~ 6deg
81  Eigen::Matrix4d wTgoalTool_eigen = Eigen::Matrix4d::Identity();
82 
83  //rot part
84  //wTgoalTool_eigen.topLeftCorner<3,3>() << 0, 1, 0,
85  // -1, 0, 0,
86  // 0, 0, 1;
87  wTgoalTool_eigen.topLeftCorner<3,3>() = FRM::eul2Rot(eulRad);
88  //to get inside the hole of 0.2m:
89  Eigen::Vector3d v_inside;
90  //v_inside << 0.40, 0.18, 0; //rigth hole + error
91  v_inside << 0.20, 0, 0;
92  Eigen::Vector3d w_inside = FRM::eul2Rot(eulRad) * v_inside;
93 
94  //trasl part
95  wTgoalTool_eigen(0, 3) = goalLinearVectTool[0] + w_inside(0);
96  wTgoalTool_eigen(1, 3) = goalLinearVectTool[1] + w_inside(1);
97  wTgoalTool_eigen(2, 3) = goalLinearVectTool[2] + w_inside(2);
98 
99  std::cout << "GOALLLLL DEGUBE\n" << wTgoalTool_eigen << "\n\n\n";
100 
101 
106  Infos robInfo;
108  //struct transforms to pass them to Controller class
109  robInfo.transforms.wTgoalVeh_eigen = wTgoalVeh_eigen;
110  robInfo.transforms.wTgoalEE_eigen = wTgoalEE_eigen;
111  robInfo.transforms.wTgoalTool_eigen = wTgoalTool_eigen;
112  robInfo.robotState.vehicleVel.resize(VEHICLE_DOF);
113  std::fill(robInfo.robotState.vehicleVel.begin(), robInfo.robotState.vehicleVel.end(), 0);
114 
115 
117  RobotInterface robotInterface(nh, robotName);
118  robotInterface.init();
119 
120  WorldInterface worldInterface(robotName);
121  worldInterface.waitReady("world", otherRobotName);
122 
124  robotInterface.getJointState(&(robInfo.robotState.jState));
125  robotInterface.getwTv(&(robInfo.robotState.wTv_eigen));
126  worldInterface.getwPos(&(robInfo.exchangedInfo.otherRobPos), otherRobotName);
127 
129  std::string filenamePeg; //the model of robot with a "fake joint" in the peg
130  //so, it is ONLY for the already grasped scene
131  if (robotName.compare("g500_A") == 0){
132  filenamePeg = "/home/tori/UWsim/Peg/model/g500ARM5APeg2.urdf";
133  } else {
134  filenamePeg = "/home/tori/UWsim/Peg/model/g500ARM5BPeg.urdf";
135  }
136  std::string vehicle = "base_link";
137  std::string link0 = "part0";
138  std::string endEffector = "end_effector";
139  std::string peg = "peg"; //pass this to kdlHelper costructor to have jacobian of the center of peg
140  std::string pegHead = "pegHead"; //pass this to kdlHelper constructor to have jacobian of the tip
141 
142  KDLHelper kdlHelper(filenamePeg, link0, endEffector, vehicle, pegHead);
143  // KDL parse for fixed things (e.g. vehicle and one of his sensor)
144  //TODO Maybe exist an easier method to parse fixed frame from urdf without needed of kdl solver
145  kdlHelper.getFixedFrame(vehicle, link0, &(robInfo.robotStruct.vTlink0));
146  //kdlHelper.getFixedFrame(endEffector, peg, &(robInfo.robotStruct.eeTtool));
147  kdlHelper.getFixedFrame(endEffector, pegHead, &(robInfo.robotStruct.eeTtoolTip));
148 
149  //get info from sensors
150  robotInterface.getForceTorque(&(robInfo.robotSensor.forcePegTip), &robInfo.robotSensor.torquePegTip);
151 
152  kdlHelper.setEESolvers();
153  //get ee pose RESPECT LINK 0
154  kdlHelper.getEEpose(robInfo.robotState.jState, &(robInfo.robotState.link0Tee_eigen));
155  // useful have vTee: even if it is redunant, everyone use it a lot
156  robInfo.robotState.vTee_eigen = robInfo.robotStruct.vTlink0 * robInfo.robotState.link0Tee_eigen;
157  // get jacobian respect link0
158  kdlHelper.getJacobianEE(robInfo.robotState.jState, &(robInfo.robotState.link0_Jee_man));
159  //get whole jacobian (arm+vehcile and projected on world
160  computeWholeJacobianEE(&robInfo);
161 
162  kdlHelper.setToolSolvers();
163  kdlHelper.getJacobianTool(robInfo.robotState.jState, &(robInfo.robotState.v_Jtool_man));
164  computeWholeJacobianTool(&robInfo);
165 
166 
167  //std::cout << "DEBUG N wTv:\n" << robInfo.robotState.wTv_eigen << "\n";
168  //std::cout << "DEBUG N vTee:\n" << robInfo.robotState.vTee_eigen << "\n";
169 
170  //TODO TRY : for B is not really fixed...
171  robInfo.transforms.wTt_eigen = robInfo.robotState.wTv_eigen *
172  robInfo.robotState.vTee_eigen * robInfo.robotStruct.eeTtoolTip;
173 
174  CoordInterfaceMissMan coordInterface(nh, robotName);
175 
176 
177 
179  Controller controller(robotName);
180 
182  std::vector<Task*> tasksTPIK1; //the first, non coop, one
183  std::vector<Task*> tasksCoop;
184  std::vector<Task*> tasksArmVehCoord; //for arm-vehicle coord
185  setTaskLists(robotName, &tasksTPIK1, &tasksCoop, &tasksArmVehCoord);
186 
187 
191 
194  Logger logger;
195  if (pathLog.size() > 0){
196  logger = Logger(robotName, pathLog);
197 
198  //to for each list... if task was in a previous list, no problem, folder with same name... overwrite?
199  logger.createTasksListDirectories(tasksTPIK1);
200  logger.createTasksListDirectories(tasksCoop);
201 
202  }
203 
212  int ms = MS_CONTROL_LOOP;
213  boost::asio::io_service io;
214  boost::asio::io_service io2;
215 
216  //debug
217  double nLoop = 0.0;
218 
219  while(1){
220 
221  //auto start = std::chrono::steady_clock::now();
222 
223  // this must be inside loop
224  boost::asio::deadline_timer loopRater(io, boost::posix_time::milliseconds(ms));
225 
227  robotInterface.getJointState(&(robInfo.robotState.jState));
228  robotInterface.getwTv(&(robInfo.robotState.wTv_eigen));
229  //worldInterface.getwT(&(robInfo.transforms.wTt_eigen), toolName);
230 
232  robotInterface.getForceTorque(&(robInfo.robotSensor.forcePegTip), &robInfo.robotSensor.torquePegTip);
233  robInfo.robotSensor.forcePegTip = FRM::saturateVectorEigen(robInfo.robotSensor.forcePegTip, 5);
234  robInfo.robotSensor.torquePegTip = FRM::saturateVectorEigen(robInfo.robotSensor.torquePegTip, 5);
235 
236  //to try what hapens with only torque
237  //robInfo.robotSensor.forcePegTip << 0, 0, 0;
238  std::cout << "force torque arrive:\n"
239  << robInfo.robotSensor.forcePegTip << "\n"
240  << robInfo.robotSensor.torquePegTip << "\n\n";
241  worldInterface.getwPos(&(robInfo.exchangedInfo.otherRobPos), otherRobotName);
242 
243 
244  //get ee pose RESPECT LINK 0
245  kdlHelper.getEEpose(robInfo.robotState.jState, &(robInfo.robotState.link0Tee_eigen));
246  // useful have vTee: even if it is redunant, tasks use it a lot
247  robInfo.robotState.vTee_eigen = robInfo.robotStruct.vTlink0 * robInfo.robotState.link0Tee_eigen;
248  robInfo.transforms.wTt_eigen = robInfo.robotState.wTv_eigen *
249  robInfo.robotState.vTee_eigen * robInfo.robotStruct.eeTtoolTip;
250  // get jacobian
251  kdlHelper.getJacobianEE(robInfo.robotState.jState, &(robInfo.robotState.link0_Jee_man));
252  computeWholeJacobianEE(&robInfo);
253 
254  //kdlHelper.setToolSolvers(eeTtool);
255  kdlHelper.getJacobianTool(robInfo.robotState.jState, &(robInfo.robotState.v_Jtool_man));
256  computeWholeJacobianTool(&robInfo);
257 
260  controller.updateMultipleTasksMatrices(tasksTPIK1, &robInfo);
262  std::vector<double> yDotTPIK1 = controller.execAlgorithm(tasksTPIK1);
263 
264  std::vector<double> yDotFinal(TOT_DOF);
265 
266  controller.updateMultipleTasksMatrices(tasksArmVehCoord, &robInfo);
267  std::vector<double> yDotOnlyArm = controller.execAlgorithm(tasksArmVehCoord);
268 
269  for (int i=0; i<ARM_DOF; i++){
270  yDotFinal.at(i) = yDotOnlyArm.at(i);
271  }
272 
273  for (int i = ARM_DOF; i<TOT_DOF; i++) {
274  yDotFinal.at(i) = yDotTPIK1.at(i);
275  //at the moment no error so velocity are exaclty what we are giving
276  robInfo.robotState.vehicleVel.at(i-ARM_DOF) = yDotFinal.at(i);
277  }
278 
280  std::vector<double> deltayDot(ARM_DOF);
281  std::vector<double> deltayDotVeh(VEHICLE_DOF);
282  std::vector<double> deltayDotTot(TOT_DOF);
283  std::vector<double> yDotFinalWithCollision = yDotFinal;
284  if (COLLISION_PROPAGATOR){
285  if (robInfo.robotSensor.forcePegTip.norm() > 0 || robInfo.robotSensor.torquePegTip.norm() > 0){
286  //if active, calculate and modify joint command accordingly
287  //only forces
288 // deltayDot = CollisionPropagator::calculateCollisionDisturb(
289 // robInfo.robotState.w_Jtool_robot.leftCols<4>(), robInfo.transforms.wTt_eigen,
290 // robInfo.robotSensor.forcePegTip);
291 
292  //forces and torques
293  deltayDot = CollisionPropagator::calculateCollisionDisturb(
294  robInfo.robotState.w_Jtool_robot.leftCols<4>(), robInfo.transforms.wTt_eigen,
295  robInfo.robotSensor.forcePegTip, robInfo.robotSensor.torquePegTip);
296 
297  for (int i=0; i<ARM_DOF; i++){
298  yDotFinalWithCollision.at(i) += (0.001*deltayDot.at(i)); //add disturbs to command
299  //this is for logging
300  deltayDotTot.at(i)= 0.001*deltayDot.at(i);
301  //yDotFinalWithCollision.at(i) = deltayDot.at(i); //reset command and only move arm for disturb
302  // but if I reset the force task become useless
303  }
304 
305  deltayDotVeh = CollisionPropagator::calculateCollisionDisturbVeh(
306  robInfo.robotState.w_Jtool_robot.rightCols<6>(), robInfo.transforms.wTt_eigen,
307  robInfo.robotSensor.forcePegTip, robInfo.robotSensor.torquePegTip);
308 
309  for (int i=ARM_DOF; i<TOT_DOF; i++){
310  yDotFinalWithCollision.at(i) += (0.01 * deltayDotVeh.at(i-ARM_DOF));
311  deltayDotTot.at(i)= 0.01 * deltayDotVeh.at(i-ARM_DOF);
312  }
313 
314  //debug try: stop vehilce until collision resolved. zeroing vehicle vel both with and withoud collision prop
315  //withou collision prop is the task force which resolve the collision NOT GOOD MI SA
316 
317  }
318  }
319 
321  //robotInterface.sendyDot(yDotTPIK1);
322  //robotInterface.sendyDot(yDotOnlyVeh);
323  robotInterface.sendyDot(yDotFinal);
324  //yDotFinalWithCollision = FRM::saturateVectorStd(yDotFinalWithCollision, 0.01);
325  //robotInterface.sendyDot(yDotFinalWithCollision);
326 
327 
329  if (pathLog.size() != 0){
330  logger.logAllForTasks(tasksArmVehCoord);
331  //TODO flag LOGGED to not print same thing twice
332  //or maybe another list with ALL task only to log here and create folder for log
333  //for the moment, yDot are exactly how vehicle and arm are moving
334  logger.logNumbers(yDotTPIK1, "yDotTPIK1");
335  logger.logNumbers(yDotFinal, "yDotFinal");
336  logger.logNumbers(yDotFinalWithCollision, "yDotFinalWithCollision");
337  logger.logNumbers(robInfo.robotSensor.forcePegTip, "forces");
338  logger.logNumbers(robInfo.robotSensor.torquePegTip, "torques");
339  logger.logNumbers(robInfo.robotState.w_Jtool_robot *
340  CONV::vector_std2Eigen(deltayDotTot), "toolVel4Collision");
341  //logger.logNumbers(admisVelTool_eigen, "JJsharp");
342 
343  }
344 
347 
348 // std::cout << "JJsharp\n" << admisVelTool_eigen << "\n\n";
349 // std::cout << "SENDED non coop vel:\n" << nonCoopCartVel_eigen <<"\n\n\n";
350 // std::cout << "ARRIVED coop vel:\n" << robInfo.exchangedInfo.coopCartVel << "\n\n\n";
351 
352 
353 // std::cout << "J: \n"
354 // << robInfo.robotState.w_Jtool_robot
355 // << "\n\n";
356 // std::cout << "yDot: \n"
357 // << CONV::vector_std2Eigen(yDotOnlyVeh)
358 // << "\n\n";
359 // std::cout << "The tool velocity non coop are (J*yDot): \n"
360 // << nonCoopCartVel_eigen
361 // << "\n\n";
362 // std::cout << "The tool velocity coop are (J*yDot): \n"
363 // << robInfo.robotState.w_Jtool_robot
364 // * CONV::vector_std2Eigen(yDotFinal)
365 // << "\n\n";
366 
367  std::vector<Task*> tasksDebug = tasksArmVehCoord;
368  for(int i=0; i<tasksDebug.size(); i++){
369  if (tasksDebug[i]->getName().compare("FORCE_INSERTION") == 0){
370  std::cout << "Activation " << tasksDebug[i]->getName() << ": \n";
371  tasksDebug[i]->getActivation().PrintMtx() ;
372  std::cout << "\n";
373  std::cout << "JACOBIAN " << tasksDebug[i]->getName() << ": \n";
374  tasksDebug[i]->getJacobian().PrintMtx();
375  std::cout<< "\n";
376 
377  std::cout << "REFERENCE " << tasksDebug[i]->getName() << ": \n";
378  tasksDebug[i]->getReference().PrintMtx() ;
379  std::cout << "\n";
380  }
381  }
382 
383 
384  controller.resetAllUpdatedFlags(tasksTPIK1);
385  controller.resetAllUpdatedFlags(tasksArmVehCoord);
386  ros::spinOnce();
387 
388 
389  //auto end = std::chrono::steady_clock::now();
390  //auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( end - start ).count();
391  //std::cout << "TEMPOOOOO "<<duration << "\n\n";
392 
393 
394  loopRater.wait();
395  //nLoop += 1;
396 
397 // if (nLoop > 10){
398 // exit(-1);
399 // }
400 
401  } //end controol loop
402 
403 
404 
405 
406  coordInterface.pubIamReadyOrNot(false);
407 
408  //todo lista con all task per cancellarli
409  deleteTasks(&tasksArmVehCoord);
410 
411  return 0;
412 }
413 
414 
424 void setTaskLists(std::string robotName, std::vector<Task*> *tasks1,
425  std::vector<Task*> *tasksCoord, std::vector<Task*> *tasksArmVeh){
426 
427  bool eqType = true;
428  bool ineqType = false;
429 
430 
432  Task* coopTask6dof = new CoopTask(6, eqType, robotName);
433  Task* coopTask5dof = new CoopTask(5, eqType, robotName);
434  Task* constrainVel = new VehicleConstrainVelTask(6, eqType, robotName);
435 
436 
438  Task* jl = new JointLimitTask(4, ineqType, robotName);
439  Task* ha = new HorizontalAttitudeTask(1, ineqType, robotName);
440  Task* eeAvoid = new ObstacleAvoidEETask(1, ineqType, robotName);
441 
442 
444  Task* forceInsert = new ForceInsertTask(2, ineqType, robotName);
445  Task* vehStill = new VehicleNullVelTask(6, eqType, robotName);
446 
447 
449  Task* pr5 = new PipeReachTask(5, eqType, robotName, ONLYVEH, LINANGBOTH);
450  Task* pr6 = new PipeReachTask(6, eqType, robotName, BOTH, LINANGBOTH);
451 
452  Task* eer = new EndEffectorReachTask(6, eqType, robotName);
453  Task* vehR = new VehicleReachTask(3, eqType, robotName, ANGULAR);
454  Task* vehYaxis = new VehicleReachTask(1, eqType, robotName, YAXIS);
455 
457  Task* shape = new ArmShapeTask(4, ineqType, robotName, PEG_GRASPED_PHASE);
458  //The "fake task" with all eye and zero matrices, needed as last one for algo?
459  Task* last = new LastTask(TOT_DOF, eqType, robotName);
460 
462  // note: order of priority at the moment is here
463  //tasks1->push_back(vehStill);
464  tasks1->push_back(jl);
465  tasks1->push_back(ha);
466  //tasks1->push_back(eeAvoid);
467  tasks1->push_back(forceInsert);
468  //tasks1->push_back(pr6);
469  //TODO discutere diff tra pr6 e pr5... il 5 mette più stress sull obj?
470  //tasks1->push_back(vehR);
471  //tasks1->push_back(vehYaxis);
472  //tasks1->push_back(eer);
473  //tasks1->push_back(shape);
474  tasks1->push_back(last);
475 
476  //TODO ASK al momento fatte così le versioni 6dof di pr e coop sono
477  //molto meglio
478  //coop 5 dof assolutamente no
479  //pr5 da un po di stress cmq (linearmente -0.034, -0.008, -0.020),
480  //i due tubi divisi si vedono tanto agli estremi
481  //si dovrebbe abbassare gain e saturaz per usare il pr5
482  //soprattutto se c'è sto shape fatto cosi che fa muovere tantissimo
483  //i bracci, è da cambiare lo shape desiderato
484 // tasksCoord->push_back(coopTask6dof);
485 // tasksCoord->push_back(jl);
486 // tasksCoord->push_back(ha);
487 // //tasksCoord->push_back(pr6);
488 // //tasks1->push_back(eeAvoid);
489 // tasksCoord->push_back(shape);
490 // tasksCoord->push_back(last);
491 
492  //tasksArmVeh->push_back(coopTask6dof);
493  tasksArmVeh->push_back(constrainVel);
494  //tasksArmVeh->push_back(vehStill);
495  tasksArmVeh->push_back(jl);
496  tasksArmVeh->push_back(ha);
497  tasksArmVeh->push_back(forceInsert);
498  tasksArmVeh->push_back(pr6);
499  //tasksArmVeh->push_back(shape);
500  tasksArmVeh->push_back(last);
501 
502 }
503 
504 
509 void deleteTasks(std::vector<Task*> *tasks){
510  for (std::vector< Task* >::iterator it = tasks->begin() ; it != tasks->end(); ++it)
511  {
512  delete (*it);
513  }
514  tasks->clear();
515 }
516 
517 
518 
519 
520 
521 
522 
523 
524 
525 
526 
527 
528 
529 /********* OLD VERSIONS *********************************************************************************
530 
532 //void setTaskLists(std::string robotName, std::vector<Task*> *tasks){
533 
534 // /// PUT HERE NEW TASKS.
535 // // note: order of priority at the moment is here
536 // bool eqType = true;
537 // bool ineqType = false;
538 
539 // //tasks->push_back(new VehicleNullVelTask(6, ineqType));
540 
541 // tasks->push_back(new JointLimitTask(4, ineqType, robotName));
542 // tasks->push_back(new HorizontalAttitudeTask(1, ineqType, robotName));
543 
544 // //tasks->push_back(new ObstacleAvoidEETask(1, ineqType, robotName));
545 // //tasks->push_back(new ObstacleAvoidVehicleTask(1, ineqType, robotName));
546 
547 // //tasks->push_back(new FovEEToToolTask(1, ineqType, robotName));
548 
549 // //tasks->push_back(new EndEffectorReachTask(6, eqType, robotName));
550 // tasks->push_back(new PipeReachTask(5, eqType, robotName));
551 // //tasks->push_back(new VehicleReachTask(6, eqType, robotName));
552 
553 // tasks->push_back(new ArmShapeTask(4, ineqType, robotName, MID_LIMITS));
554 // //The "fake task" with all eye and zero matrices, needed as last one for algo
555 // tasks->push_back(new LastTask(TOT_DOF, eqType, robotName));
556 //}
557 
558 //void setTaskLists(std::string robotName, std::vector<Task*> *tasks1, std::vector<Task*> *tasksFinal){
559 
560 // bool eqType = true;
561 // bool ineqType = false;
562 
563 
564 // /// CONSTRAINT TASKS
565 // Task* coopTask6dof = new CoopTask(6, eqType, robotName);
566 // Task* coopTask5dof = new CoopTask(5, eqType, robotName);
567 
568 
569 // /// SAFETY TASKS
570 // Task* jl = new JointLimitTask(4, ineqType, robotName);
571 // Task* ha = new HorizontalAttitudeTask(1, ineqType, robotName);
572 
573 
574 // /// PREREQUISITE TASKS
575 
576 
577 // ///MISSION TASKS
578 // Task* pr5 = new PipeReachTask(5, eqType, robotName);
579 // Task* pr6 = new PipeReachTask(6, eqType, robotName);
580 
581 // Task* tr = new EndEffectorReachTask(6, eqType, robotName);
582 
583 // /// OPTIMIZATION TASKS
584 // Task* shape = new ArmShapeTask(4, ineqType, robotName, MID_LIMITS);
585 // //The "fake task" with all eye and zero matrices, needed as last one for algo?
586 // Task* last = new LastTask(TOT_DOF, eqType, robotName);
587 
588 // ///Fill tasks list, MID_LIMITS
589 // // note: order of priority at the moment is here
590 // tasks1->push_back(jl);
591 // tasks1->push_back(ha);
592 // tasks1->push_back(pr5);
593 // //tasks1->push_back(tr);
594 // //tasks1->push_back(shape);
595 // tasks1->push_back(last);
596 
597 // tasksFinal->push_back(coopTask5dof);
598 // // tasksFinal->push_back(jl);
599 // //tasksFinal->push_back(ha);
600 // //tasksFinal->push_back(shape);
601 // tasksFinal->push_back(last);
602 //}
603 
604 
605 
606 
607 
608 
610 // std::cout << "JACOBIAN " << i << ": \n";
611 // tasks[i]->getJacobian().PrintMtx();
612 // std::cout<< "\n";
613 // std::cout << "REFERENCE " << i << ": \n";
614 // tasks[i]->getReference().PrintMtx() ;
615 // std::cout << "\n";
616 
617 
618 //std::cout << nonCoopCartVel_eigen << "\n\n";
619 //std::cout << admisVelTool_eigen << "\n\n";
620 
621 
622 //Q.PrintMtx("Q"); ///DEBUG
623 //yDot_cmat.PrintMtx("yDot");
624 
625 
626 
627 //DEBUGGGG
628 //computeJacobianToolNoKdl(&robInfo, robotName);
629 
630 //std::cout << "con KDL:\n" << robInfo.robotState.w_Jtool_robot << "\n\n";
631 //std::cout << "senza KDL:\n" << robInfo.robotState.w_JNoKdltool_robot << "\n\n";
632 
633 /*
634 //debug
635 Eigen::Matrix4d toolPose_eigen;
636 kdlHelper.getToolpose(robInfo.robotState.jState, eeTtool, &toolPose_eigen);
637 Eigen::Matrix4d W_toolPose_eigen = robInfo.robotState.wTv_eigen * robInfo.robotStruct.vTlink0 * toolPose_eigen;
638 
639 std::cout << "ToolPOSE\n" <<
640  W_toolPose_eigen << "\n\n";
641 */
Definition: logger.h:16
The Controller class is responsabile of 1) taking matrices and giving them to Tasks classes...
Definition: controller.h:20
std::vector< double > vehicleVel
vehicle and joint
Definition: infos.h:45
The ForceInsertTask class to help the inserting phase with force torque sensor this task is to genera...
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")
"Fake" Task needed as last to algorithm, it has all fixed matrices of eye and zeros so no setxx are n...
Definition: lastTask.h:9
The ObstacleAvoidEETask class Usage of this task can be for avoiding with the end effector...
The CoopTask class.
Definition: coopTask.h:10
The vehicleConstrainVelTask class This task is a non-reactive one used to to constrain the velocities...
The VehicleNullVel class. It is a non reactive task which is needed in manipulation phases where we w...
The CoordInterface class class to deal with ros comunications (pub/sub) from MissionManager node to C...
Task to make the end effector reach a goal (both linear and angular position)
Task to make the vehicle reach a goal (both linear and angular position)
The WorldInterface class to get position from world to anything else.
Eigen::Matrix< double, 6, ARM_DOF > link0_Jee_man
Jacobians.
Definition: infos.h:52
Definition: infos.h:117
Eigen::Matrix4d wTv_eigen
Transforms.
Definition: infos.h:34
The ArmShapeTask class Preferred arm Shape: an optimization task. It is a non scalar task...
Definition: armShapeTask.h:20
ABSTRACT class task. Each task is a derived class of this class. It contains all the variable that th...
Definition: task.h:17