1 #include "header/vehicleReachTask.h" 11 :
Task(dim, eqType, robotName,
"VEHICLE_REACH_GOAL") {
13 this->linAngType = linAngType;
24 setJacobian(robInfo->robotState.
wTv_eigen);
25 setReference(robInfo->robotState.
wTv_eigen, robInfo->transforms.wTgoalVeh_eigen);
29 int VehicleReachTask::setJacobian(Eigen::Matrix4d wTv_eigen){
31 Eigen::Matrix<double, 3, TOT_DOF> jacobianLIN_eigen = Eigen::Matrix<double, 3, TOT_DOF>::Zero();
32 Eigen::Matrix<double, 3, TOT_DOF> jacobianANG_eigen = Eigen::Matrix<double, 3, TOT_DOF>::Zero();
34 Eigen::Matrix3d wRv_eigen = wTv_eigen.topLeftCorner(3,3);
38 if (linAngType == LINEAR || linAngType == LIN_ANG || linAngType == YAXIS){
39 jacobianLIN_eigen.block<3,3>(0,4) = wRv_eigen;
44 if (linAngType == ANGULAR || linAngType == LIN_ANG){
45 jacobianANG_eigen.bottomRightCorner(3,3) = wRv_eigen;
51 this->J = CMAT::Matrix(dimension, dof, jacobianLIN_eigen.data());
54 this->J = CMAT::Matrix(dimension, dof, jacobianANG_eigen.data());
57 this->J = CONV::matrix_eigen2cmat(jacobianLIN_eigen.row(1));
60 Eigen::Matrix<double, 6, TOT_DOF> jacobian_eigen = Eigen::Matrix<double, 6, TOT_DOF>::Zero();
61 jacobian_eigen.topRows(3) = jacobianLIN_eigen;
62 jacobian_eigen.bottomRows(3) = jacobianANG_eigen;
63 this->J = CONV::matrix_eigen2cmat(jacobian_eigen);
72 int VehicleReachTask::setActivation(){
74 double vectDiag[dimension];
75 std::fill_n(vectDiag, dimension, 1);
76 this->A.SetDiag(vectDiag);
81 int VehicleReachTask::setReference(
82 Eigen::Matrix4d wTv_eigen, Eigen::Matrix4d wTg_eigen){
84 CMAT::TransfMatrix wTv_cmat = CONV::matrix_eigen2cmat(wTv_eigen);
85 CMAT::TransfMatrix wTg_cmat = CONV::matrix_eigen2cmat(wTg_eigen);
86 CMAT::Vect6 errorSwapped = CMAT::CartError(wTg_cmat, wTv_cmat);
92 error(1) = errorSwapped(4);
93 error(2) = errorSwapped(5);
94 error(3) = errorSwapped(6);
97 error(1) = errorSwapped(1);
98 error(2) = errorSwapped(2);
99 error(3) = errorSwapped(3);
102 error(1) = errorSwapped(4);
103 error(2) = errorSwapped(5);
104 error(3) = errorSwapped(6);
105 error(4) = errorSwapped(1);
106 error(5) = errorSwapped(2);
107 error(6) = errorSwapped(3);
109 error(1) = errorSwapped(5);
113 this->reference = this->gain * (this->error);
int updateMatrices(struct Infos *const robInfo)
VehicleReachTask::updateMatrices overriden of the pure virtual method of Task parent class...
VehicleReachTask(int dimension, bool eqType, std::string robotName, LinAngType linAngType)
VehicleReachTask::VehicleReachTask Constructor of specific task simply calls the parent constructor t...
Eigen::Matrix4d wTv_eigen
Transforms.
ABSTRACT class task. Each task is a derived class of this class. It contains all the variable that th...