Go to the documentation of this file.
13 #ifndef EIGEN_RUNTIME_NO_MALLOC
14 #define EIGEN_RUNTIME_NO_MALLOC
31 #include <boost/test/unit_test.hpp>
32 #include <boost/utility/binary.hpp>
36 template<
typename Jo
intModel>
40 const std::string & parent_name,
41 const std::string &
name,
43 bool setRandomLimits =
true)
46 typedef typename JointModel::ConfigVector_t CV;
47 typedef typename JointModel::TangentVector_t TV;
53 model.getJointId(parent_name), joint, SE3::Random(),
name +
"_joint",
54 TV::Random() + TV::Constant(1), TV::Random() + TV::Constant(1),
55 CV::Random() - CV::Constant(1), CV::Random() + CV::Constant(1));
59 model.addJointFrame(idx);
61 model.appendBodyToJoint(idx, Inertia::Random(), SE3::Identity());
65 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
74 #ifdef _INTENSE_TESTING_
75 const size_t NBT = 1000 * 1000;
77 const size_t NBT = 10;
88 timer.
toc(std::cout, NBT);
92 using namespace Eigen;
96 Eigen::VectorXd
q = Eigen::VectorXd::Ones(
model.nq);
98 Eigen::VectorXd
v = Eigen::VectorXd::Zero(
model.nv);
99 Eigen::VectorXd
a = Eigen::VectorXd::Zero(
model.nv);
102 data.M.triangularView<Eigen::StrictlyLower>() =
103 data.M.transpose().triangularView<Eigen::StrictlyLower>();
114 BOOST_CHECK(
M.isApprox(
data.M, 1e-12));
116 std::cout <<
"(the time score in debug mode is not relevant) ";
126 timer.
toc(std::cout, NBT);
128 #endif // ifndef NDEBUG
138 const Eigen::MatrixXd &
G = mimic_test_case.
G;
142 Eigen::VectorXd as_mimic = Eigen::VectorXd::Random(
model_mimic.nv);
146 Eigen::VectorXd
a_full =
G * as_mimic;
159 BOOST_CHECK(data_ref_mimic.
M.isApprox(
data_mimic.M));
162 data_mimic.M.triangularView<Eigen::StrictlyLower>() =
163 data_mimic.M.transpose().triangularView<Eigen::StrictlyLower>();
164 data_full.M.triangularView<Eigen::StrictlyLower>() =
165 data_full.M.transpose().triangularView<Eigen::StrictlyLower>();
178 model.lowerPositionLimit.head<7>().
fill(-1.);
179 model.upperPositionLimit.head<7>().
fill(1.);
183 Eigen::VectorXd
v(Eigen::VectorXd::Random(
model.nv));
186 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
187 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
190 data.M.triangularView<Eigen::StrictlyLower>() =
191 data.M.transpose().triangularView<Eigen::StrictlyLower>();
193 BOOST_CHECK(
data.M.isApprox(data_ref.
M));
197 BOOST_CHECK(
data.Ag.isApprox(data_ref.
Ag));
198 BOOST_CHECK(
data.J.isApprox(data_ref.
J));
206 BOOST_CHECK(data2.Ycrb[0] ==
data.Ycrb[0]);
216 BOOST_CHECK(
model == model_ref);
220 model.armature = Eigen::VectorXd::Random(
model.nv) + Eigen::VectorXd::Constant(
model.nv, 1.);
224 data_ref.
M.triangularView<Eigen::StrictlyLower>() =
225 data_ref.
M.transpose().triangularView<Eigen::StrictlyLower>();
226 data_ref.
M.diagonal() +=
model.armature;
229 data.M.triangularView<Eigen::StrictlyLower>() =
230 data.M.transpose().triangularView<Eigen::StrictlyLower>();
232 BOOST_CHECK(
data.M.isApprox(data_ref.
M));
245 SE3::Random(),
"revolute_unaligned");
249 Eigen::internal::set_is_malloc_allowed(
false);
252 Eigen::internal::set_is_malloc_allowed(
true);
257 BOOST_AUTO_TEST_SUITE_END()
MatrixXs M
The joint space inertia matrix (a square matrix of dim model.nv).
void toFull(const Eigen::VectorXd &q, Eigen::VectorXd &q_full) const
std::string name(const LieGroupGenericTpl< LieGroupCollection > &lg)
Visit a LieGroupVariant to get the name of it.
const DataTpl< Scalar, Options, JointCollectionTpl >::MatrixXs & crba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Convention convention=Convention::LOCAL)
Computes the upper triangular part of the joint space inertia matrix M by using the Composite Rigid B...
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobians(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Computes the full model Jacobian, i.e. the stack of all motion subspace expressed in the world frame....
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true, bool mimic=false)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
void randomConfiguration(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorIn1 > &lowerLimits, const Eigen::MatrixBase< ConfigVectorIn2 > &upperLimits, const Eigen::MatrixBase< ReturnType > &qout)
Generate a configuration vector uniformly sampled among provided limits.
pinocchio::JointIndex JointIndex
const MotionDense< Motion2 > const SE3Tpl< SE3Scalar, SE3Options > & placement
BOOST_AUTO_TEST_CASE(test_crba)
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & ccrba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes the Centroidal Momentum Matrix, the Composite Ridig Body Inertia as well as the centroidal m...
pinocchio::Model model_mimic
Matrix6x Ag
Centroidal Momentum Matrix.
static void addJointAndBody(pinocchio::Model &model, const pinocchio::JointModelBase< JointModel > &joint, const std::string &parent_name, const std::string &name, const pinocchio::SE3 placement=pinocchio::SE3::Random(), bool setRandomLimits=true)
MotionTpl< Scalar, Options > bias(const JointDataTpl< Scalar, Options, JointCollectionTpl > &jdata)
Visit a JointDataTpl through JointBiasVisitor to get the joint bias as a dense motion.
Matrix6x J
Jacobian of joint placements.
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & rnea(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &a)
The Recursive Newton-Euler algorithm. It computes the inverse dynamics, aka the joint torques accordi...
void neutral(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ReturnType > &qout)
Return the neutral configuration element related to the model configuration space.
pinocchio::Model model_full
void normalize(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &qout)
Normalize a configuration vector.
JointCollectionTpl & model
Main pinocchio namespace.
pinocchio
Author(s):
autogenerated on Wed Apr 16 2025 02:41:46