Skip to content

Commit

Permalink
Port to new API
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMingo committed Mar 27, 2024
1 parent cacd702 commit 0fab3fd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ find_package(catkin REQUIRED COMPONENTS cartesian_interface
message_generation)
find_package(OpenSoT REQUIRED)
find_package(VISP REQUIRED)
find_package(cartesian_interface REQUIRED)
find_package(matlogger2 REQUIRED)

catkin_python_setup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace OpenSoT {
* @brief _update
* @param x
*/
void _update(const Eigen::VectorXd& x);
void _update();

/**
* @brief compute_b
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/velocity/VisualServoing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ VisualServoing::VisualServoing(std::string task_id,
}

_hessianType = HST_SEMIDEF;
update(Eigen::VectorXd(0));
update();
}

void VisualServoing::_update(const Eigen::VectorXd &x)
void VisualServoing::_update()
{

//1) computes Cartesian quantities from Cartesian task
_cartesian_task->update(Eigen::VectorXd(0));
_cartesian_task->update();
_J = _cartesian_task->getA(); //body jacobian

//2) computes new Jacobian using the interaction matrix from VISP
Expand Down
30 changes: 15 additions & 15 deletions tests/tasks/velocity/TestVisualServoing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ TEST_F(testVisualServoingTask, testBasics)
std::cout<<"b: \n"<<this->vs_task->getb()<<std::endl;
std::list<vpBasicFeature *> generic_desired_features(std::begin(this->desired_features), std::end(this->desired_features));
this->vs_task->setDesiredFeatures(generic_desired_features);
this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();

this->vs_task->log(logger);

Expand All @@ -283,7 +283,7 @@ TEST_F(testVisualServoingTask, testBasics)
point_feature->set_Z(2*(3*i+2));
i++;
}
this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();
expected_b.setZero(expected_b.size());
std::cout<<"expected_b: \n"<<expected_b<<std::endl;
std::cout<<"b: \n"<<this->vs_task->getb()<<std::endl;
Expand All @@ -294,7 +294,7 @@ TEST_F(testVisualServoingTask, testBasics)

TEST_F(testVisualServoingTask, testJacobians)
{
this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();
Eigen::MatrixXd A = this->vs_task->getA();
Eigen::MatrixXd b = this->vs_task->getb();

Expand All @@ -305,7 +305,7 @@ TEST_F(testVisualServoingTask, testJacobians)

std::list<unsigned int> id = {0,2,3};
OpenSoT::tasks::Aggregated::TaskPtr vs = this->vs_task%id;
vs->update(Eigen::VectorXd(0));
vs->update();

std::cout<<"vs->getA(): \n"<<vs->getA()<<std::endl;

Expand Down Expand Up @@ -348,7 +348,7 @@ TEST_F(testVisualServoingTask, testProjection)
this->vs_task->addFeature(p[i], pd[i]);
}

this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();

//vpMatrix L_visp;
Eigen::MatrixXd L, Lpinv;
Expand Down Expand Up @@ -402,7 +402,7 @@ TEST_F(testVisualServoingTask, testProjection)
vpFeatureBuilder::create(p[i], point[i]);
this->vs_task->addFeature(p[i], pd[i]);
}
this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();

}

Expand Down Expand Up @@ -483,7 +483,7 @@ TEST_F(testVisualServoingTask, testStandardVS)
feature_selection
);

this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();

Eigen::MatrixXd A = this->vs_task->getA();
Eigen::MatrixXd b = this->vs_task->getb();
Expand Down Expand Up @@ -564,7 +564,7 @@ TEST_F(testVisualServoingTask, testStandardVS)
EXPECT_TRUE(this->vs_task->setFeatures(generic_curr_features));

// not sure I need this
this->vs_task->update(Eigen::VectorXd(0));
this->vs_task->update();

A = this->vs_task->getA();
b = this->vs_task->getb();
Expand Down Expand Up @@ -731,7 +731,7 @@ TEST_F(testVisualServoingTask, testOpenSoTTask)
this->_model->setJointPosition(q);
this->_model->update();

stack->update(Eigen::VectorXd(0));
stack->update();

EXPECT_TRUE(solver->solve(dq));

Expand Down Expand Up @@ -902,7 +902,7 @@ TEST_F(testVisualServoingTask, testWholeBodyVisualServoing)
}

// Not sure I need this
this->vs_task->update(this->q);
this->vs_task->update();

/*
this->desired_features.clear();
Expand All @@ -917,7 +917,7 @@ TEST_F(testVisualServoingTask, testWholeBodyVisualServoing)
EXPECT_TRUE(this->vs_task->setDesiredFeatures(feature_list));
*/

stack->update(this->q);
stack->update();

Eigen::VectorXd q, dq, ds;
q = this->q;
Expand Down Expand Up @@ -948,7 +948,7 @@ TEST_F(testVisualServoingTask, testWholeBodyVisualServoing)
vpFeatureBuilder::create(p[i], point[i]);
this->vs_task->addFeature(p[i], pd[i]);
}
this->vs_task->update(this->q);
this->vs_task->update();


/*
Expand Down Expand Up @@ -983,7 +983,7 @@ TEST_F(testVisualServoingTask, testWholeBodyVisualServoing)
Eigen::MatrixXd B = this->_model->computeInertiaMatrix();
postural->setWeight(B);

stack->update(Eigen::VectorXd(0));
stack->update();

//3. solve
EXPECT_TRUE(solver->solve(dq));
Expand Down Expand Up @@ -1137,7 +1137,7 @@ TEST_F(testVisualServoingTask, testVSAM)
this->vs_task->addFeature(p[i], pd[i]);
}

stack->update(this->q);
stack->update();

Eigen::VectorXd q, dq;
q = this->q;
Expand Down Expand Up @@ -1171,7 +1171,7 @@ TEST_F(testVisualServoingTask, testVSAM)
publishRobotModel(robot_state_publisher_.get(), world_broadcaster.get(), this->_model.get());

//2. stack update
stack->update(Eigen::VectorXd(0));
stack->update();

//3. solve
bool solved = solver->solve(dq);
Expand Down

0 comments on commit 0fab3fd

Please sign in to comment.