Go to the documentation of this file.
18 #include <boost/test/unit_test.hpp>
19 #include <boost/utility/binary.hpp>
21 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
25 using namespace Eigen;
32 VectorXd
q = VectorXd::Ones(
model.nq);
34 VectorXd
v = VectorXd::Ones(
model.nv);
35 VectorXd
a = VectorXd::Ones(
model.nv);
46 BOOST_CHECK(
com.isApprox(
data.com[0], 1e-12));
50 BOOST_CHECK(
com.isApprox(
data.com[0], 1e-12));
54 model.gravity.setZero();
59 BOOST_CHECK((
data.liMi[1].rotation() * acom_from_nle).isApprox(
data.acom[0], 1e-12));
80 using namespace Eigen;
90 double mass_check = 0.0;
91 for (
size_t i = 1;
i < (size_t)(
model.njoints); ++
i)
92 mass_check +=
model.inertias[
i].mass();
94 BOOST_CHECK_CLOSE(
mass, mass_check, 1e-12);
100 BOOST_CHECK(mass_data == mass_data);
101 BOOST_CHECK_CLOSE(
mass, mass_data, 1e-12);
102 BOOST_CHECK_CLOSE(data1.
mass[0], mass_data, 1e-12);
105 VectorXd
q = VectorXd::Ones(
model.nq);
109 BOOST_CHECK_CLOSE(data2.
mass[0],
mass, 1e-12);
114 using namespace Eigen;
125 VectorXd
q = VectorXd::Ones(
model.nq);
129 for (
size_t i = 0;
i < (size_t)(
model.njoints); ++
i)
131 BOOST_CHECK_CLOSE(data1.
mass[
i], data2.
mass[
i], 1e-12);
197 using namespace Eigen;
204 model.upperPositionLimit.head<3>().
fill(1000);
205 model.lowerPositionLimit.head<3>() = -
model.upperPositionLimit.head<3>();
207 VectorXd
v = VectorXd::Random(
model.nv);
217 BOOST_CHECK(Jcom1.isApprox(data_ref.
Jcom));
223 const double eps = 1e-8;
242 Jcom_extracted.setZero();
246 Eigen::VectorXd v_plus(
model.nv);
251 for (Eigen::DenseIndex k = 0; k <
model.nv; ++k)
257 Jcom_fd.col(k) = (com_plus -
com) /
eps;
267 BOOST_CHECK(Jcom.isApprox(Jcom_fd, sqrt(
eps)));
268 BOOST_CHECK(Jcom_extracted.isApprox(Jcom_fd, sqrt(
eps)));
269 BOOST_CHECK(Jcom_extracted.isApprox(Jcom));
273 BOOST_CHECK(subtreeComVelocityInWorld.isApprox(subtreeComVelocityInWorld_ref));
282 BOOST_CHECK(Jcom2.isApprox(Jcom1));
289 BOOST_CHECK(Jcom3.isApprox(Jcom1));
292 BOOST_AUTO_TEST_SUITE_END()
traits< SE3Tpl >::Vector3 Vector3
const DataTpl< Scalar, Options, JointCollectionTpl >::Vector3 & getComFromCrba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Extracts the center of mass position from the joint space inertia matrix (also called the mass matrix...
std::vector< Scalar > mass
Vector of subtree mass. In other words, mass[j] is the mass of the subtree supported by joint ....
BOOST_AUTO_TEST_CASE(test_com)
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
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 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.
Scalar computeTotalMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model)
Compute the total mass of the model and return it.
Eigen::Matrix< Scalar, 3, Eigen::Dynamic, Options > Matrix3x
The 3d jacobian type (temporary)
void integrate(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v, const Eigen::MatrixBase< ReturnType > &qout)
Integrate a configuration vector for the specified model for a tangent vector during one unit time.
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix3x & jacobianCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool computeSubtreeComs=true)
Computes both the jacobian and the the center of mass position of a given model according to a partic...
void computeSubtreeMasses(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Compute the mass of each kinematic subtree and store it in data.mass. The element mass[0] corresponds...
Matrix3x Jcom
Jacobian of center of mass.
void getJacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Retrieves the Jacobian of the center of mass of the given subtree according to the current value stor...
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & nonLinearEffects(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes the non-linear effects (Corriolis, centrifual and gravitationnal effects),...
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix3x & getJacobianComFromCrba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Extracts both the jacobian of the center of mass (CoM), the total mass of the system and the CoM posi...
Matrix6x J
Jacobian of joint placements.
void jacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Computes the Jacobian of the center of mass of the given subtree according to a particular joint conf...
void normalize(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &qout)
Normalize a configuration vector.
Main pinocchio namespace.
bool isApprox(const Box &s1, const Box &s2, const FCL_REAL tol)
const DataTpl< Scalar, Options, JointCollectionTpl >::Vector3 & centerOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool computeSubtreeComs=true)
Computes the center of mass position of a given model according to a particular joint configuration....
pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:08