Skip to content

Commit

Permalink
[Unittest] Check consistency of cast models with a mimic joint.
Browse files Browse the repository at this point in the history
  • Loading branch information
abussy-aldebaran committed Dec 12, 2024
1 parent bd466b3 commit 5a8f205
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions unittest/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,4 +950,27 @@ BOOST_AUTO_TEST_CASE(test_has_transform_to_mimic)
}
}

BOOST_AUTO_TEST_CASE(test_cast_mimic)
{
Model humanoid_model, humanoid_mimic;
buildModels::humanoid(humanoid_model);
Data data(humanoid_model);
BOOST_CHECK(humanoid_model.check(data));

JointIndex index_p = humanoid_model.getJointId("rleg_shoulder3_joint");
JointIndex index_s = humanoid_model.getJointId("lleg_shoulder3_joint");

transformJointIntoMimic(humanoid_model, index_p, index_s, 2.0, 0.4, humanoid_mimic);
data = Data(humanoid_mimic);
BOOST_CHECK(humanoid_mimic.check(data));

humanoid_mimic = humanoid_mimic.cast<double>();
data = Data(humanoid_mimic);
BOOST_CHECK(humanoid_mimic.check(data));

ModelTpl<float> humanoid_mimic_f = humanoid_mimic.cast<float>();
DataTpl<float> data_f(humanoid_mimic_f);
BOOST_CHECK(humanoid_mimic_f.check(data_f));
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 5a8f205

Please sign in to comment.