liegroup-generic.hpp
Go to the documentation of this file.
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  {
19  enum {
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 
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 
47  : Base(lg_generic)
48  {}
49 
51  {
52  static_cast<Base&>(*this) = other.toVariant();
53  return *this;
54  }
55 
56  const LieGroupVariant & toVariant() const
57  { return static_cast<const LieGroupVariant &>(*this); }
58 
59  LieGroupVariant & toVariant()
60  { return static_cast<LieGroupVariant &>(*this); }
61 
62  bool isEqual_impl (const LieGroupGenericTpl& other) const
63  {
64  return boost::apply_visitor(visitor::LieGroupEqual<Scalar, Options>(), toVariant(), other.toVariant());
65  }
66 
67  int nq() const { return ::pinocchio::nq(*this); }
68  int nv() const { return ::pinocchio::nv(*this); }
69 
70  bool operator== (const LieGroupGenericTpl& other) const
71  {
72  return isEqual_impl(other);
73  }
74 
75  bool operator!= (const LieGroupGenericTpl& other) const
76  {
77  return this->isDifferent_impl(other);
78  }
79 
80  std::string name() const
81  {
82  return LieGroupNameVisitor::run(*this);
83  }
84  };
85 
86 }
87 
88 #endif // ifndef __pinocchio_lie_group_generic_hpp__
89 
int nv(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNvVisitor to get the dimension of the joint tangent space...
int NQ
Definition: dpendulum.py:8
int nq(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNqVisitor to get the dimension of the joint configuration space...
LieGroupCollection::Scalar Scalar
LieGroupCollection::LieGroupVariant Base
bool operator==(const JointDataBase< JointDataDerived > &joint_data, const JointDataTpl< Scalar, Options, JointCollectionTpl > &joint_data_generic)
SE3::Scalar Scalar
Definition: conversions.cpp:13
LieGroupGenericTpl & operator=(const LieGroupGenericTpl &other)
bool operator!=(const JointDataBase< JointDataDerived > &joint_data, const JointDataTpl< Scalar, Options, JointCollectionTpl > &joint_data_generic)
LieGroupGenericTpl(const LieGroupBase< LieGroupDerived > &lg_base)
Main pinocchio namespace.
Definition: timings.cpp:28
LieGroupGenericTpl(const LieGroupGenericTpl &lg_generic)
Common traits structure to fully define base classes for CRTP.
Definition: src/fwd.hpp:44
NV
Definition: dcrba.py:444
bool isEqual_impl(const LieGroupGenericTpl &other) const
LieGroupCollection::LieGroupVariant LieGroupVariant
const LieGroupVariant & toVariant() const
LieGroupGenericTpl(const LieGroupVariant &lg_variant)


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:31