1 #include "header/obstacleAvoidVehicleTask.h" 3 ObstacleAvoidVehicleTask::ObstacleAvoidVehicleTask(
int dim,
bool eqType, std::string robotName)
4 :
Task(dim, eqType, robotName,
"OBSTACLE_AVOID_VEH"){
7 std::cerr <<
"[" << robotName <<
"][" << taskName <<
"] ERROR, this task is intended to be a scalar one, "<<
8 "you setted "<< dimension <<
" as dimension\n";
16 int ObstacleAvoidVehicleTask::updateMatrices(
struct Infos*
const robInfo){
19 Eigen::Vector3d w_dist = robInfo->exchangedInfo.otherRobPos -
20 robInfo->robotState.
wTv_eigen.topRightCorner<3,1>();
26 double w_distNorm = w_dist.norm();
27 if (w_distNorm < 0.001) {
28 std::cout <<
"[" << robotName <<
"][" << taskName <<
"] WARNING: Norm too little," 29 <<
" I will set it to 0.001" << std::endl;
35 setActivation(w_distNorm);
38 Eigen::Vector3d w_dist_normal = w_dist / w_distNorm;
39 setJacobian(robInfo->robotState.
wTv_eigen, w_dist_normal);
42 setReference(w_distNorm);
49 void ObstacleAvoidVehicleTask::setActivation(
double w_distNorm){
52 A(1) = CMAT::DecreasingBellShapedFunction(VEH_DIM, VEH_DIM + safe_dist, 0, 1, w_distNorm);
56 void ObstacleAvoidVehicleTask::setJacobian(Eigen::Matrix4d wTv, Eigen::Vector3d w_dist_normal){
58 Eigen::Matrix<double, 1, TOT_DOF> jacobian_eigen = Eigen::Matrix<double, 1, TOT_DOF>::Zero();
63 jacobian_eigen.block<1,3>(0,4) =
64 -w_dist_normal.transpose() * wTv.topLeftCorner<3,3>();
69 J = CONV::matrix_eigen2cmat(jacobian_eigen);
73 void ObstacleAvoidVehicleTask::setReference(
double w_distNorm){
80 this->reference(1) = gain * ((VEH_DIM + safe_dist) - w_distNorm);
Eigen::Matrix4d wTv_eigen
Transforms.
ABSTRACT class task. Each task is a derived class of this class. It contains all the variable that th...