AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
vehicleNullVelTask.cpp
1 #include "header/vehicleNullVelTask.h"
2 
3 VehicleNullVelTask::VehicleNullVelTask(int dim, bool eqType, std::string robotName)
4  : Task(dim, eqType, robotName, "VEHICLE_NULL_VEL") {
5  //no Gain: non reactive task
6 }
7 
13 int VehicleNullVelTask::updateMatrices(struct Infos* const robInfo){
14 
15  setActivation();
16  setJacobian(robInfo->robotState.wTv_eigen);
17  setReference();
18  return 0;
19 }
20 
28 int VehicleNullVelTask::setJacobian(Eigen::Matrix4d wTv_eigen){
29 
30  Eigen::MatrixXd jacobian_eigen = Eigen::MatrixXd::Zero(dimension, dof);
31  Eigen::Matrix3d wRv_eigen = wTv_eigen.topLeftCorner(3,3);
32 
33  //matrix([1:6];[1:4]) joint part must be zero
34  //matrix([1:3];[5:7]) linear part
35  jacobian_eigen.block<3,3>(0,4) = wRv_eigen; //block: <dimensions> & (beginning row, beginning column)
36 
37  //matrix([4:6];[8:10]) angular
38  //according to eigen doc, using these kind of specific function (and not
39  //.block) improves performance
40  jacobian_eigen.bottomRightCorner(3,3) = wRv_eigen;
41 
42  //NOTE: other part of the matrices are already zero becase all jacobians
43  //are inizialized as zero
44 
45  //to cmat
46  //eigen unroll to vector for cmat function
47  this->J = CMAT::Matrix(dimension, dof, jacobian_eigen.data());
48 
49  //J.PrintMtx("JACOB"); ///DEBUG
50 
51 }
52 
53 int VehicleNullVelTask::setActivation(){
54 
55  double vectDiag[6];
56  std::fill_n(vectDiag, 6, 1);
57  this->A.SetDiag(vectDiag);
58 
59  return 0;
60 }
61 
62 int VehicleNullVelTask::setReference(){
63 
64  this->reference = CMAT::Matrix::Zeros(dimension, 1);
65 }
66 
int updateMatrices(struct Infos *const robInfo)
VehicleNull::updateMatrices overriden of the pure virtual method of Task parent class.
Definition: infos.h:117
Eigen::Matrix4d wTv_eigen
Transforms.
Definition: infos.h:34
ABSTRACT class task. Each task is a derived class of this class. It contains all the variable that th...
Definition: task.h:17