constraint-variants.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2023 INRIA
3 //
4 
11 
12 #include <iostream>
13 
14 #include <boost/test/unit_test.hpp>
15 #include <boost/utility/binary.hpp>
16 
17 using namespace pinocchio;
18 using namespace Eigen;
19 
20 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
21 
22 BOOST_AUTO_TEST_CASE(contact_variants)
23 {
24  Model model;
26 
27  Data data(model);
28 
29  const SE3 M(SE3::Random());
31  RigidConstraintData rcd(rcm);
32 
33  ConstraintModel::ConstraintModelVariant constraint_model_variant = rcm;
35  ConstraintModel constraint_model_equal = rcm;
36 
37  ConstraintData constraint_data = rcm.createData();
38 }
39 
40 BOOST_AUTO_TEST_CASE(contact_visitors)
41 {
42  Model model;
44 
45  Data data(model);
46 
47  const SE3 M(SE3::Random());
49  RigidConstraintData rcd(rcm);
50  BOOST_CHECK(ConstraintData(rcd) == ConstraintData(rcd));
51  BOOST_CHECK(ConstraintData(rcd) == rcd);
52 
54 
55  // Test create data visitor
57  constraint_data = rcd;
58 
59  // Test calc visitor
61  rcm.calc(model, data, rcd);
62  BOOST_CHECK(rcd == constraint_data);
63 
64  // Test jacobian visitor
65  Data::MatrixXs jacobian_matrix = Data::Matrix6x::Zero(6, model.nv),
66  jacobian_matrix_ref = Data::Matrix6x::Zero(6, model.nv);
67  jacobian(constraint_model, constraint_data, model, data, jacobian_matrix);
68  rcm.jacobian(model, data, rcd, jacobian_matrix_ref);
69  BOOST_CHECK(jacobian_matrix == jacobian_matrix_ref);
70 }
71 
72 BOOST_AUTO_TEST_SUITE_END()
pinocchio::DataTpl::MatrixXs
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options > MatrixXs
Definition: multibody/data.hpp:74
Eigen
simulation-closed-kinematic-chains.constraint_model
constraint_model
Definition: simulation-closed-kinematic-chains.py:98
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::ConstraintModelTpl::ConstraintModelVariant
ConstraintCollection::ConstraintModelVariant ConstraintModelVariant
Definition: constraint-model-generic.hpp:49
pinocchio::SE3Tpl< context::Scalar, context::Options >
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::buildModels::humanoidRandom
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
simulation-closed-kinematic-chains.constraint_data
constraint_data
Definition: simulation-closed-kinematic-chains.py:106
pinocchio::RigidConstraintModelTpl
Definition: algorithm/constraints/fwd.hpp:14
pinocchio::ConstraintDataTpl
Definition: constraint-data-generic.hpp:34
constraints.hpp
pinocchio::createData
ConstraintDataTpl< Scalar, Options, ConstraintCollectionTpl > createData(const ConstraintModelTpl< Scalar, Options, ConstraintCollectionTpl > &cmodel)
Definition: constraint-model-visitor.hpp:239
pinocchio::RigidConstraintDataTpl
Definition: algorithm/constraints/fwd.hpp:16
data.hpp
pinocchio::calc
void calc(const ConstraintModelTpl< Scalar, Options, ConstraintCollectionTpl > &cmodel, ConstraintDataTpl< Scalar, Options, ConstraintCollectionTpl > &cdata, const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data)
Definition: constraint-model-visitor.hpp:155
M
M
pinocchio::jacobian
void jacobian(const ConstraintModelTpl< Scalar, Options, ConstraintCollectionTpl > &cmodel, ConstraintDataTpl< Scalar, Options, ConstraintCollectionTpl > &cdata, const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< JacobianMatrix > &jacobian_matrix)
Definition: constraint-model-visitor.hpp:199
pinocchio::ConstraintModelTpl
Definition: constraint-model-generic.hpp:34
pinocchio::ConstraintData
ConstraintDataTpl< context::Scalar, context::Options, ConstraintCollectionTpl > ConstraintData
Definition: algorithm/constraints/fwd.hpp:42
pinocchio::SE3Tpl::Random
static SE3Tpl Random()
Definition: spatial/se3-tpl.hpp:154
constraint-model-generic.hpp
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(contact_variants)
Definition: constraint-variants.cpp:22
constraint-data-generic.hpp
contact-info.hpp
sample-models.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::CONTACT_3D
@ CONTACT_3D
Definition: algorithm/contact-info.hpp:21
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:28