Go to the documentation of this file.
16 #include <boost/test/tools/old/interface.hpp>
17 #include <boost/test/unit_test.hpp>
18 #include <boost/utility/binary.hpp>
20 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
44 switch (reference_frame)
50 res.linear() = oa.linear();
51 res.angular() = oa.angular();
65 res.angular() = iMc.rotation().transpose() *
data.a[
joint_id].angular();
76 using namespace Eigen;
83 model.lowerPositionLimit.head<3>().
fill(-1.);
84 model.upperPositionLimit.head<3>().
fill(1.);
87 VectorXd
v = VectorXd::Random(
model.nv);
88 VectorXd
tau = VectorXd::Random(
model.nv);
94 const double mu0 = 0.;
102 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
106 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
110 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
115 using namespace Eigen;
122 model.lowerPositionLimit.head<3>().
fill(-1.);
123 model.upperPositionLimit.head<3>().
fill(1.);
126 VectorXd
v = VectorXd::Random(
model.nv);
127 VectorXd
tau = VectorXd::Random(
model.nv);
129 const std::string RF =
"rleg6_joint";
131 const std::string LF =
"lleg6_joint";
138 ci_RF.joint1_placement.setRandom();
142 ci_LF.joint1_placement.setRandom();
146 const double mu0 = 0.0;
154 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
160 v = VectorXd::Random(
model.nv);
168 data_ref.
osim = data_ref.
contact_chol.getInverseOperationalSpaceInertiaMatrix();
169 data.LA[0].template triangularView<Eigen::StrictlyUpper>() =
170 data.LA[0].template triangularView<Eigen::StrictlyLower>().transpose();
171 BOOST_CHECK(data_ref.
osim.isApprox(
data.LA[0]));
173 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
176 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
182 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
185 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
191 BOOST_CHECK(!
data.ddq.isApprox(data_ref.
ddq));
196 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
201 using namespace Eigen;
208 model.lowerPositionLimit.head<3>().
fill(-1.);
209 model.upperPositionLimit.head<3>().
fill(1.);
212 VectorXd
v = VectorXd::Random(
model.nv);
213 VectorXd
tau = VectorXd::Random(
model.nv);
215 const std::string RF =
"rleg6_joint";
222 ci_RF.joint1_placement.setRandom();
226 const double mu0 = 0.0;
234 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
238 v = VectorXd::Random(
model.nv);
243 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
245 data_ref.
osim = data_ref.
contact_chol.getInverseOperationalSpaceInertiaMatrix();
246 data.LA[0].template triangularView<Eigen::StrictlyUpper>() =
247 data.LA[0].template triangularView<Eigen::StrictlyLower>().transpose();
248 BOOST_CHECK(data_ref.
osim.isApprox(
data.LA[0]));
251 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
257 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
260 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
265 using namespace Eigen;
272 model.lowerPositionLimit.head<3>().
fill(-1.);
273 model.upperPositionLimit.head<3>().
fill(1.);
276 VectorXd
v = VectorXd::Random(
model.nv);
277 VectorXd
tau = VectorXd::Random(
model.nv);
279 const std::string RF =
"rleg6_joint";
286 ci_RF.joint1_placement.setRandom();
287 ci_RF.corrector.Kd.setZero();
288 ci_RF.corrector.Kp.setZero();
292 ci_RF2.joint1_placement.setRandom();
293 ci_RF2.corrector.Kd.setZero();
294 ci_RF2.corrector.Kp.setZero();
298 const double mu0 = 1e-3;
314 J_ref.middleRows<6>(0) = ci_RF.joint1_placement.inverse().toActionMatrix() * Jtmp;
318 J_ref.middleRows<6>(6) = ci_RF2.joint1_placement.inverse().toActionMatrix() * Jtmp;
321 rhs_ref.segment<6>(0) =
323 model, data_ref, ci_RF.joint1_id, ci_RF.reference_frame, ci_RF.type, ci_RF.joint1_placement)
326 model, data_ref, ci_RF2.joint1_id, ci_RF2.reference_frame, ci_RF2.type,
327 ci_RF2.joint1_placement)
330 BOOST_CHECK((J_ref.transpose() * (J_ref * data_ref.
ddq + rhs_ref)).isZero(1e-11));
335 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
336 BOOST_CHECK((J_ref.transpose() * (J_ref *
data.ddq + rhs_ref)).isZero(1e-11));
340 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
341 BOOST_CHECK((J_ref.transpose() * (J_ref *
data.ddq + rhs_ref)).isZero(1e-11));
345 v = VectorXd::Random(
model.nv);
350 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
353 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
357 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
360 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
365 using namespace Eigen;
372 model.lowerPositionLimit.head<3>().
fill(-1.);
373 model.upperPositionLimit.head<3>().
fill(1.);
376 VectorXd
v = VectorXd::Random(
model.nv);
377 VectorXd
tau = VectorXd::Random(
model.nv);
379 const std::string RF =
"rleg6_joint";
386 ci_RF.joint1_placement.setRandom();
387 ci_RF.corrector.Kd.setIdentity();
388 ci_RF.corrector.Kp.setIdentity();
392 ci_RF2.joint1_placement.setRandom();
393 ci_RF2.corrector.Kd.setIdentity();
394 ci_RF2.corrector.Kp.setZero();
398 const double mu0 = 1e-4;
406 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
410 v = VectorXd::Random(
model.nv);
415 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
418 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq));
422 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq, 1e-11));
425 BOOST_CHECK(
data.ddq.isApprox(data_ref.
ddq, 1e-11));
428 BOOST_AUTO_TEST_SUITE_END()
RigidConstraintDataTpl< context::Scalar, context::Options > RigidConstraintData
TangentVectorType ddq
The joint accelerations computed from ABA.
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & constrainedABA(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 > &tau, const std::vector< RigidConstraintModelTpl< Scalar, Options >, ContactModelAllocator > &contact_models, std::vector< RigidConstraintDataTpl< Scalar, Options >, ContactDataAllocator > &contact_datas, ProximalSettingsTpl< Scalar > &settings)
The constrained Articulated Body Algorithm (constrainedABA). It computes constrained forward dynamics...
ReferenceFrame
Various conventions to express the velocity of a moving frame.
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & pv(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 > &tau, const std::vector< RigidConstraintModelTpl< Scalar, Options >, ContactModelAllocator > &contact_models, std::vector< RigidConstraintDataTpl< Scalar, Options >, ContactDataAllocator > &contact_datas, ProximalSettingsTpl< Scalar > &settings)
The Popov-Vereshchagin algorithm. It computes constrained forward dynamics, aka the joint acceleratio...
void classicAcceleration(const MotionDense< Motion1 > &spatial_velocity, const MotionDense< Motion2 > &spatial_acceleration, const Eigen::MatrixBase< Vector3Like > &res)
Computes the classic acceleration from a given spatial velocity and spatial acceleration.
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 >::TangentVectorType & aba(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 > &tau, const Convention convention=Convention::LOCAL)
The Articulated-Body algorithm. It computes the forward dynamics, aka the joint accelerations given t...
void initPvSolver(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const std::vector< RigidConstraintModelTpl< Scalar, Options >, Allocator > &contact_models)
Init the data according to the contact information contained in contact_models.
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.
@ CONTACT_6D
Point contact model.
pinocchio::JointIndex JointIndex
Structure containing all the settings parameters for the proximal algorithms.
const MotionDense< Motion2 > const SE3Tpl< SE3Scalar, SE3Options > & placement
void getJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const ReferenceFrame reference_frame, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in one of the pinocchio::ReferenceFrame opt...
void initConstraintDynamics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const std::vector< RigidConstraintModelTpl< Scalar, Options >, Allocator > &contact_models)
Init the forward dynamics data according to the contact information contained in contact_models.
ConstAngularRef rotation() const
VectorXd constraintDynamics(const Model &model, Data &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &tau, const Model::JointIndex id)
#define PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(T)
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
BOOST_AUTO_TEST_CASE(test_sparse_forward_dynamics_empty)
pinocchio::Motion computeAcceleration(const pinocchio::Model &model, pinocchio::Data &data, const pinocchio::JointIndex &joint_id, pinocchio::ReferenceFrame reference_frame, const pinocchio::ContactType type, const pinocchio::SE3 &placement=pinocchio::SE3::Identity())
Computes motions in the world frame.
void computeAllTerms(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes efficiently all the terms needed for dynamic simulation. It is equivalent to the call at the...
MatrixXs osim
Operational space inertia matrix;.
ContactCholeskyDecomposition contact_chol
Cholesky decomposition of the KKT contact matrix.
Main pinocchio namespace.
#define PINOCCHIO_UNUSED_VARIABLE(var)
Helper to declare that a parameter is unused.
pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:12