Skip to content

Commit

Permalink
Added TestqpSWIFT and TestCartesian (here one test is missing, added …
Browse files Browse the repository at this point in the history
…a note in the CMakeLists.txt). Fixed test in TestQPOases
  • Loading branch information
EnricoMingo committed Feb 20, 2024
1 parent 84a468e commit 7c9ee91
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 359 deletions.
20 changes: 10 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ add_test(NAME OpenSoT_task_velocity_Postural COMMAND testPosturalVelocityTask)
add_dependencies(testContactFloatingBaseTask OpenSoT)
add_test(NAME OpenSoT_task_floating_base_Postural COMMAND testContactFloatingBaseTask)

# ADD_EXECUTABLE(testCartesianVelocityTask tasks/velocity/TestCartesian.cpp)
# TARGET_LINK_LIBRARIES(testCartesianVelocityTask ${TestLibs})
# add_dependencies(testCartesianVelocityTask OpenSoT)
# add_test(NAME OpenSoT_task_velocity_Cartesian COMMAND testCartesianVelocityTask)
ADD_EXECUTABLE(testCartesianVelocityTask tasks/velocity/TestCartesian.cpp) #<-- missing testCartesianTask.testActiveJointsMask !
TARGET_LINK_LIBRARIES(testCartesianVelocityTask ${TestLibs})
add_dependencies(testCartesianVelocityTask OpenSoT)
add_test(NAME OpenSoT_task_velocity_Cartesian COMMAND testCartesianVelocityTask)

# ADD_EXECUTABLE(testCartesianAdmittanceVelocityTask tasks/velocity/TestCartesianAdmittance.cpp)
# TARGET_LINK_LIBRARIES(testCartesianAdmittanceVelocityTask ${TestLibs})
Expand Down Expand Up @@ -330,12 +330,12 @@ add_test(NAME OpenSoT_task_velocity_Postural COMMAND testPosturalVelocityTask)
add_dependencies(testCoMForceTask OpenSoT)
add_test(NAME OpenSoT_task_force_CoM COMMAND testCoMForceTask)

# if(${qpSWIFT_FOUND})
# ADD_EXECUTABLE(testqpSWIFTSolver solvers/TestqpSWIFT.cpp)
# TARGET_LINK_LIBRARIES(testqpSWIFTSolver ${TestLibs} qpSWIFT::qpSWIFT-static)
# add_dependencies(testqpSWIFTSolver OpenSoT)
# add_test(NAME OpenSoT_solvers_qpswift COMMAND testqpSWIFTSolver)
# endif()
if(${qpSWIFT_FOUND})
ADD_EXECUTABLE(testqpSWIFTSolver solvers/TestqpSWIFT.cpp)
TARGET_LINK_LIBRARIES(testqpSWIFTSolver ${TestLibs} qpSWIFT::qpSWIFT-static)
add_dependencies(testqpSWIFTSolver OpenSoT)
add_test(NAME OpenSoT_solvers_qpswift COMMAND testqpSWIFTSolver)
endif()

#ADD_EXECUTABLE(testCartesianPositionVelocityConstraint constraints/velocity/TestCartesianPositionConstraint.cpp)
#TARGET_LINK_LIBRARIES(testCartesianPositionVelocityConstraint ${TestLibs})
Expand Down
14 changes: 7 additions & 7 deletions tests/solvers/TestQPOases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ TEST_F(testQPOasesTask, testQPOasesTask)
using namespace OpenSoT::constraints::velocity;
TEST_F(testQPOasesTask, testProblemWithConstraint)
{
Eigen::VectorXd q(_model_ptr->getNq()); q = _model_ptr->getNeutralQ();
Eigen::VectorXd q_ref(q.size()); q_ref.setConstant(q.size(), M_PI);
Eigen::VectorXd q = _model_ptr->getNeutralQ();
Eigen::VectorXd q_ref = _model_ptr->generateRandomQ();
_model_ptr->setJointPosition(q);
_model_ptr->update();

Expand All @@ -498,7 +498,7 @@ TEST_F(testQPOasesTask, testProblemWithConstraint)
JointLimits::Ptr joint_limits(
new JointLimits(*_model_ptr, q_max, q_min));
postural_task->getConstraints().push_back(joint_limits);
postural_task->setLambda(0.1);
postural_task->setLambda(1.);

std::cout<<"postural_task->getXSize(): "<<postural_task->getXSize()<<std::endl;

Expand Down Expand Up @@ -558,7 +558,7 @@ TEST_F(testQPOasesTask, testProblemWithConstraint)
EXPECT_NEAR( q[i], q_min[i-1], 1E-4);
}
else
EXPECT_NEAR( q[i], q_ref[i-1], 1E-4);
EXPECT_NEAR( q[i], q_ref[i], 1E-4);
}
}

Expand Down Expand Up @@ -598,8 +598,8 @@ TEST_F(testQPOasesTask, test_on_eigen)

TEST_F(testiHQP, testContructor1Problem)
{
Eigen::VectorXd q(_model_ptr->getNq()); q = _model_ptr->getNeutralQ();
Eigen::VectorXd q_ref(q.size()); q_ref.setConstant(q.size(), M_PI);
Eigen::VectorXd q = _model_ptr->getNeutralQ();
Eigen::VectorXd q_ref = _model_ptr->generateRandomQ();
_model_ptr->setJointPosition(q);
_model_ptr->update();

Expand Down Expand Up @@ -665,7 +665,7 @@ TEST_F(testiHQP, testContructor1Problem)
EXPECT_NEAR( q[i], q_min[i-1], 1E-4);
}
else
EXPECT_NEAR( q[i], q_ref[i-1], 1E-4);
EXPECT_NEAR( q[i], q_ref[i], 1E-4);

}
}
Expand Down
Loading

0 comments on commit 7c9ee91

Please sign in to comment.