constraint-model-base.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2023 INRIA
3 //
4 
5 #ifndef __pinocchio_algorithm_constraint_model_base_hpp__
6 #define __pinocchio_algorithm_constraint_model_base_hpp__
7 
10 
11 namespace pinocchio
12 {
13 
14  template<class Derived>
16  {
17  typedef typename traits<Derived>::Scalar Scalar;
18  enum
19  {
21  };
23 
24  typedef Eigen::Matrix<bool, Eigen::Dynamic, 1, Options> BooleanVector;
25  // typedef Eigen::Matrix<Eigen::DenseIndex,Eigen::Dynamic,1,Options> IndexVector;
26  typedef std::vector<Eigen::DenseIndex> IndexVector;
27 
28  Derived & derived()
29  {
30  return static_cast<Derived &>(*this);
31  }
32  const Derived & derived() const
33  {
34  return static_cast<const Derived &>(*this);
35  }
36 
37  template<typename NewScalar>
39  {
40  return derived().template cast<NewScalar>();
41  }
42 
45  template<int Options, template<typename, int> class JointCollectionTpl>
46  void calc(
49  ConstraintData & cdata) const
50  {
51  derived().calc(model, data, cdata);
52  }
53 
54  template<typename JacobianMatrix, int Options, template<typename, int> class JointCollectionTpl>
55  void jacobian(
58  ConstraintData & cdata,
59  const Eigen::MatrixBase<JacobianMatrix> & jacobian_matrix) const
60  {
61  derived().jacobian(model, data, cdata, jacobian_matrix.const_cast_derived());
62  }
63 
64  // Attributes common to all constraints
65 
67  std::string name;
68 
71 
74 
75  template<typename OtherDerived>
77  {
78  return name == other.name && colwise_sparsity == other.colwise_sparsity
80  }
81 
82  template<typename OtherDerived>
84  {
85  name = other.name;
88 
89  return *this;
90  }
91 
93  {
94  return derived().createData();
95  }
96 
97  protected:
98  template<int Options, template<typename, int> class JointCollectionTpl>
101  {
102  static const bool default_sparsity_value = false;
103  colwise_sparsity.fill(default_sparsity_value);
104  }
105 
108  {
109  }
110 
112  {
113  return *this;
114  }
115  const ConstraintModelBase & base() const
116  {
117  return *this;
118  }
119  };
120 
121 } // namespace pinocchio
122 
123 #endif // ifndef __pinocchio_algorithm_constraint_model_base_hpp__
pinocchio::NumericalBase
Definition: fwd.hpp:89
pinocchio::ConstraintModelBase::Scalar
traits< Derived >::Scalar Scalar
Definition: constraint-model-base.hpp:17
pinocchio::ConstraintModelBase::Options
@ Options
Definition: constraint-model-base.hpp:20
pinocchio::ConstraintModelBase::derived
Derived & derived()
Definition: constraint-model-base.hpp:28
pinocchio::ConstraintModelBase::ConstraintModelBase
ConstraintModelBase(const ModelTpl< Scalar, Options, JointCollectionTpl > &model)
Definition: constraint-model-base.hpp:99
pinocchio::ConstraintModelBase::base
ConstraintModelBase & base()
Definition: constraint-model-base.hpp:111
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::ConstraintModelBase::cast
CastType< NewScalar, Derived >::type cast() const
Definition: constraint-model-base.hpp:38
pinocchio::ConstraintModelBase::derived
const Derived & derived() const
Definition: constraint-model-base.hpp:32
pinocchio::nv
int nv(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNvVisitor to get the dimension of the joint tangent space.
pinocchio::ConstraintModelBase::calc
void calc(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, ConstraintData &cdata) const
Evaluate the constraint values at the current state given by data and store the results in cdata.
Definition: constraint-model-base.hpp:46
model.hpp
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::ConstraintModelBase::colwise_span_indexes
IndexVector colwise_span_indexes
Indexes of the columns spanned by the constraints.
Definition: constraint-model-base.hpp:73
pinocchio::ConstraintModelBase::colwise_sparsity
BooleanVector colwise_sparsity
Sparsity pattern associated to the constraint;.
Definition: constraint-model-base.hpp:70
pinocchio::ConstraintModelBase::operator=
ConstraintModelBase & operator=(const ConstraintModelBase< OtherDerived > &other)
Definition: constraint-model-base.hpp:83
pinocchio::ConstraintModelBase::operator==
bool operator==(const ConstraintModelBase< OtherDerived > &other) const
Definition: constraint-model-base.hpp:76
pinocchio::ConstraintModelBase::IndexVector
std::vector< Eigen::DenseIndex > IndexVector
Definition: constraint-model-base.hpp:26
pinocchio::ConstraintModelBase::createData
ConstraintData createData() const
Definition: constraint-model-base.hpp:92
pinocchio::ConstraintModelBase::name
std::string name
Name of the constraint.
Definition: constraint-model-base.hpp:67
pinocchio::ConstraintModelBase
Definition: constraint-model-base.hpp:15
pinocchio::ConstraintModelBase::base
const ConstraintModelBase & base() const
Definition: constraint-model-base.hpp:115
pinocchio::ConstraintModelBase::ConstraintModelBase
ConstraintModelBase()
Default constructor.
Definition: constraint-model-base.hpp:107
fwd.hpp
pinocchio::traits
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:71
pinocchio::CastType
Type of the cast of a class C templated by Scalar and Options, to a new NewScalar type....
Definition: fwd.hpp:99
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::ConstraintModelBase::ConstraintData
traits< Derived >::ConstraintData ConstraintData
Definition: constraint-model-base.hpp:22
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::ConstraintModelBase::jacobian
void jacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, ConstraintData &cdata, const Eigen::MatrixBase< JacobianMatrix > &jacobian_matrix) const
Definition: constraint-model-base.hpp:55
pinocchio::ConstraintModelBase::BooleanVector
Eigen::Matrix< bool, Eigen::Dynamic, 1, Options > BooleanVector
Definition: constraint-model-base.hpp:24


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:08