21 #include <boost/test/unit_test.hpp>
22 #include <boost/utility/binary.hpp>
24 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
28 using namespace Eigen;
35 model.lowerPositionLimit.head<3>().
fill(-1.);
36 model.upperPositionLimit.head<3>().
fill(1.);
39 VectorXd
v = VectorXd::Random(
model.nv);
40 VectorXd
tau = VectorXd::Random(
model.nv);
46 const double mu0 = 0.;
50 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
51 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
56 data.M.triangularView<Eigen::StrictlyLower>() =
57 data.M.transpose().triangularView<Eigen::StrictlyLower>();
66 using namespace Eigen;
73 model.lowerPositionLimit.head<3>().
fill(-1.);
74 model.upperPositionLimit.head<3>().
fill(1.);
77 VectorXd
v = VectorXd::Random(
model.nv);
78 VectorXd
tau = VectorXd::Random(
model.nv);
80 const std::string RF =
"rleg6_joint";
82 const std::string LF =
"lleg6_joint";
99 const double mu0 = 0.;
107 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
108 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
119 Eigen::MatrixXd KKT_matrix_ref =
121 KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv) = data_ref.
M;
130 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
131 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
140 data.M.triangularView<Eigen::StrictlyLower>() =
141 data.M.transpose().triangularView<Eigen::StrictlyLower>();
159 Eigen::MatrixXd KKT_matrix = contact_chol.matrix();
162 .isApprox(KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv)));
169 Eigen::DenseIndex constraint_id = 0;
185 data_ref.
impulse_c.segment<6>(constraint_id));
194 constraint_id +=
cmodel.size();
200 using namespace Eigen;
207 model.lowerPositionLimit.head<3>().
fill(-1.);
208 model.upperPositionLimit.head<3>().
fill(1.);
211 VectorXd
v = VectorXd::Random(
model.nv);
212 VectorXd
tau = VectorXd::Random(
model.nv);
214 const std::string RF =
"rleg6_joint";
216 const std::string LF =
"lleg6_joint";
233 const double mu0 = 0.;
241 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
242 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
253 Eigen::MatrixXd KKT_matrix_ref =
255 KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv) = data_ref.
M;
264 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
265 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
274 data.M.triangularView<Eigen::StrictlyLower>() =
275 data.M.transpose().triangularView<Eigen::StrictlyLower>();
294 Eigen::MatrixXd KKT_matrix = contact_chol.matrix();
297 .isApprox(KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv)));
304 Eigen::DenseIndex constraint_id = 0;
320 data_ref.
impulse_c.segment<6>(constraint_id));
329 constraint_id +=
cmodel.size();
335 using namespace Eigen;
342 model.lowerPositionLimit.head<3>().
fill(-1.);
343 model.upperPositionLimit.head<3>().
fill(1.);
346 VectorXd
v = VectorXd::Random(
model.nv);
347 VectorXd
tau = VectorXd::Random(
model.nv);
349 const std::string RF =
"rleg6_joint";
351 const std::string LF =
"lleg6_joint";
368 const double mu0 = 0.;
376 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
377 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
387 rhs_ref.segment<6>(0) =
389 rhs_ref.segment<6>(6) =
392 Eigen::MatrixXd KKT_matrix_ref =
394 KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv) = data_ref.
M;
403 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
404 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
413 data.M.triangularView<Eigen::StrictlyLower>() =
414 data.M.transpose().triangularView<Eigen::StrictlyLower>();
433 Eigen::MatrixXd KKT_matrix = contact_chol.matrix();
436 .isApprox(KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv)));
443 Eigen::DenseIndex constraint_id = 0;
459 data_ref.
impulse_c.segment<6>(constraint_id));
468 constraint_id +=
cmodel.size();
474 using namespace Eigen;
481 model.lowerPositionLimit.head<3>().
fill(-1.);
482 model.upperPositionLimit.head<3>().
fill(1.);
485 VectorXd
v = VectorXd::Random(
model.nv);
486 VectorXd
tau = VectorXd::Random(
model.nv);
488 const std::string RF =
"rleg6_joint";
490 const std::string LF =
"lleg6_joint";
507 const double mu0 = 0.;
516 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
517 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
522 J_ref.middleRows<3>(6) = Jtmp.middleRows<3>(Motion::LINEAR);
529 Eigen::MatrixXd KKT_matrix_ref =
531 KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv) = data_ref.
M;
540 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
541 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
550 data.M.triangularView<Eigen::StrictlyLower>() =
551 data.M.transpose().triangularView<Eigen::StrictlyLower>();
570 Eigen::MatrixXd KKT_matrix = contact_chol.matrix();
573 .isApprox(KKT_matrix_ref.bottomRightCorner(
model.nv,
model.nv)));
580 Eigen::DenseIndex constraint_id = 0;
596 data_ref.
impulse_c.segment<6>(constraint_id));
605 constraint_id +=
cmodel.size();
609 BOOST_AUTO_TEST_SUITE_END()