1 #include "header/obstacleAvoidEETask.h" 4 ObstacleAvoidEETask::ObstacleAvoidEETask(
int dim,
bool eqType, std::string robotName)
5 :
Task(dim, eqType, robotName,
"OBSTACLE_AVOID_EE"){
13 int ObstacleAvoidEETask::updateMatrices(
struct Infos*
const robInfo){
15 double wZseafloor = SEAFLOOR_DEPTH;
16 Eigen::Matrix4d wTee = robInfo->robotState.
wTv_eigen * robInfo->robotState.vTee_eigen;
17 Eigen::Vector3d w_ee_posiz= wTee.topRightCorner<3,1>();
20 double w_dist = wZseafloor - w_ee_posiz(2);
27 std::cout <<
"[" << robotName <<
"][" << taskName <<
"] WARNING: Norm too little," 28 <<
" I will set it to 0.001" << std::endl;
32 setActivation(w_dist);
35 setJacobian(robInfo->robotState.w_Jee_robot);
45 void ObstacleAvoidEETask::setActivation(
double w_dist){
47 A(1) = CMAT::DecreasingBellShapedFunction(0, 0 + safe_dist, 0, 1, w_dist);
51 void ObstacleAvoidEETask::setJacobian(Eigen::Matrix<double, 6, TOT_DOF> w_J_robot){
53 Eigen::MatrixXd jacobian_eigen(dimension, TOT_DOF);
54 jacobian_eigen = Eigen::MatrixXd::Zero(dimension, TOT_DOF);
56 Eigen::Vector3d zComponent;
57 zComponent << 0, 0, 1;
60 jacobian_eigen = - zComponent.transpose() * w_J_robot.topRows(3);
62 J = CONV::matrix_eigen2cmat(jacobian_eigen);
66 void ObstacleAvoidEETask::setReference(
double w_dist){
73 this->reference(1) = gain * (safe_dist - w_dist);
Eigen::Matrix4d wTv_eigen
Transforms.
ABSTRACT class task. Each task is a derived class of this class. It contains all the variable that th...