pinocchio  2.4.4
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
liegroup-generic.hpp
1 //
2 // Copyright (c) 2018 CNRS
3 //
4 
5 #ifndef __pinocchio_lie_group_generic_hpp__
6 #define __pinocchio_lie_group_generic_hpp__
7 
8 #include "pinocchio/multibody/liegroup/liegroup-base.hpp"
9 #include "pinocchio/multibody/liegroup/liegroup-variant-visitors.hpp"
10 
11 namespace pinocchio
12 {
13  template<typename LieGroupCollection> struct LieGroupGenericTpl;
14 
15  template<typename LieGroupCollection>
16  struct traits< LieGroupGenericTpl<LieGroupCollection> >
17  {
18  typedef typename LieGroupCollection::Scalar Scalar;
19  enum {
20  Options = LieGroupCollection::Options,
21  NQ = Eigen::Dynamic,
22  NV = Eigen::Dynamic
23  };
24  };
25 
26  template<typename LieGroupCollection>
27  struct LieGroupGenericTpl
28  : LieGroupBase< LieGroupGenericTpl<LieGroupCollection> >, LieGroupCollection::LieGroupVariant
29  {
30  typedef typename LieGroupCollection::LieGroupVariant Base;
31  typedef typename LieGroupCollection::LieGroupVariant LieGroupVariant;
32 
33  typedef typename LieGroupCollection::Scalar Scalar;
34  enum { Options = LieGroupCollection::Options };
35 
36  template<typename LieGroupDerived>
38  : Base(lg_base.derived())
39  {}
40 
41  template<typename LieGroup>
42  LieGroupGenericTpl(const LieGroupVariant & lg_variant)
43  : Base(lg_variant)
44  {}
45 
46  const LieGroupVariant & toVariant() const
47  { return static_cast<const LieGroupVariant &>(*this); }
48 
49  LieGroupVariant & toVariant()
50  { return static_cast<LieGroupVariant &>(*this); }
51 
52  int nq() const { return ::pinocchio::nq(*this); }
53  int nv() const { return ::pinocchio::nv(*this); }
54  };
55 
56 }
57 
58 #endif // ifndef __pinocchio_lie_group_generic_hpp__
59 
int nv(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNvVisitor to get the dimension of the joint tangent space...
int nq(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNqVisitor to get the dimension of the joint configuration space...
Main pinocchio namespace.
Definition: treeview.dox:24
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:35