15 #include <boost/test/unit_test.hpp>
16 #include <boost/utility/binary.hpp>
18 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
22 using namespace Eigen;
25 static const int num_tests = 1e2;
30 model.upperPositionLimit.head<3>().
fill(100);
32 model.lowerPositionLimit.head<7>() = -
model.upperPositionLimit.head<7>();
36 VectorXd
v(VectorXd::Random(
model.nv));
37 VectorXd
a(VectorXd::Zero(
model.nv));
41 const std::string RF_joint_name =
"rleg6_joint";
44 for (
int k = 0; k < num_tests; ++k)
47 v = VectorXd::Random(
model.nv);
50 const SE3 RF_world_transf =
SE3(
data.oMi[RF_joint_id].rotation(), SE3::Vector3::Zero());
52 const Motion RF_v_global = RF_world_transf.act(
data.v[RF_joint_id]);
53 const Motion RF_a_global = RF_world_transf.act(
data.a[RF_joint_id]);
58 BOOST_CHECK(classic_acc_other_signature.isApprox(classic_acc));
61 const double eps = 1e-5;
62 const double eps2 =
eps *
eps;
66 VectorXd v_plus =
v +
eps *
a;
69 const SE3::Vector3 pos_plus = data_ref.oMi[RF_joint_id].translation();
71 VectorXd v_minus =
v -
eps *
a;
74 const SE3::Vector3 pos_minus = data_ref.oMi[RF_joint_id].translation();
76 const SE3::Vector3 classic_acc_ref = (pos_plus + pos_minus - 2. *
pos) / eps2;
78 BOOST_CHECK(classic_acc.isApprox(classic_acc_ref, math::sqrt(
eps) * 1e1));
84 using namespace Eigen;
87 static const int num_tests = 1e2;
92 model.upperPositionLimit.head<3>().
fill(1);
94 model.lowerPositionLimit.head<7>() = -
model.upperPositionLimit.head<7>();
98 VectorXd
v(VectorXd::Random(
model.nv));
99 VectorXd
a(VectorXd::Zero(
model.nv));
103 const std::string RF_joint_name =
"rleg6_joint";
106 for (
int k = 0; k < num_tests; ++k)
109 v = VectorXd::Random(
model.nv);
113 const SE3 RF_world_transf =
SE3(
data.oMi[RF_joint_id].rotation(), SE3::Vector3::Zero());
115 const Motion RF_v_global = RF_world_transf.act(
data.v[RF_joint_id]);
116 const Motion RF_a_global = RF_world_transf.act(
data.a[RF_joint_id]);
119 const SE3 identity_placement = SE3::Identity();
123 BOOST_CHECK(RF_classic_acc.isApprox(RF_classic_acc_ref));
125 const SE3 random_placement = SE3::Random();
130 const Motion v_B = random_placement.actInv(
data.v[RF_joint_id]);
131 const Motion a_B = random_placement.actInv(
data.a[RF_joint_id]);
136 BOOST_CHECK(classic_acc_B.isApprox(classic_acc_B_ref));
142 BOOST_CHECK(classic_acc_B_other_signature.isApprox(classic_acc_B));
146 BOOST_AUTO_TEST_SUITE_END()