force-ref.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017-2019 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_force_ref_hpp__
6 #define __pinocchio_force_ref_hpp__
7 
8 namespace pinocchio
9 {
10 
11  template<typename Vector6ArgType>
12  struct traits< ForceRef<Vector6ArgType> >
13  {
14  typedef typename Vector6ArgType::Scalar Scalar;
15  typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
16  enum {
17  LINEAR = 0,
18  ANGULAR = 3,
20  };
21  typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
22  typedef Eigen::Matrix<Scalar,4,4,Options> Matrix4;
23  typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
24  typedef Matrix6 ActionMatrixType;
25  typedef Matrix4 HomogeneousMatrixType;
26  typedef typename Vector6ArgType::template FixedSegmentReturnType<3>::Type LinearType;
27  typedef typename Vector6ArgType::template FixedSegmentReturnType<3>::Type AngularType;
28  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
29  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
31  typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) DataRefType;
32  typedef DataRefType ToVectorReturnType;
33  typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
34  typedef ConstDataRefType ToVectorConstReturnType;
36 
37  }; // traits ForceRef
38 
39  template<typename Vector6ArgType>
40  struct SE3GroupAction< ForceRef<Vector6ArgType> >
41  {
42  typedef typename traits< ForceRef<Vector6ArgType> >::ForcePlain ReturnType;
43  };
44 
45  template<typename Vector6ArgType, typename MotionDerived>
46  struct MotionAlgebraAction< ForceRef<Vector6ArgType>, MotionDerived >
47  {
48  typedef typename traits< ForceRef<Vector6ArgType> >::ForcePlain ReturnType;
49  };
50 
51  template<typename Vector6ArgType>
52  class ForceRef : public ForceDense< ForceRef<Vector6ArgType> >
53  {
54  public:
55  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
59 
60  using Base::operator=;
61  using Base::operator==;
62  using Base::operator!=;
63 
65  ForceRef(typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) f_like)
66  : m_ref(f_like)
67  {
68  EIGEN_STATIC_ASSERT(Vector6ArgType::ColsAtCompileTime == 1,
69  YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
70  assert(f_like.size() == 6);
71  }
72 
74  ForceRef(const ForceRef & other)
75  : m_ref(other.m_ref)
76  {}
77 
78  ToVectorConstReturnType toVector_impl() const { return m_ref; }
79  ToVectorReturnType toVector_impl() { return m_ref; }
80 
81  // Getters
82  ConstAngularType angular_impl() const { return ConstAngularType(m_ref.derived(),ANGULAR); }
83  ConstLinearType linear_impl() const { return ConstLinearType(m_ref.derived(),LINEAR); }
84  AngularType angular_impl() { return m_ref.template segment<3> (ANGULAR); }
85  LinearType linear_impl() { return m_ref.template segment<3> (LINEAR); }
86 
87  template<typename V3>
88  void angular_impl(const Eigen::MatrixBase<V3> & w)
89  {
90  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
91  angular_impl()=w;
92  }
93 
94  template<typename V3>
95  void linear_impl(const Eigen::MatrixBase<V3> & v)
96  {
97  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
98  linear_impl()=v;
99  }
100 
101  ForceRef & ref() { return *this; }
102 
103  protected:
104  DataRefType m_ref;
105 
106  }; // class ForceRef<Vector6Like>
107 
108  template<typename Vector6ArgType>
109  struct traits< ForceRef<const Vector6ArgType> >
110  {
111  typedef typename Vector6ArgType::Scalar Scalar;
112  typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
113  enum {
114  LINEAR = 0,
115  ANGULAR = 3,
117  };
118  typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
119  typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
120  typedef Matrix6 ActionMatrixType;
121  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
122  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
123  typedef ConstLinearType LinearType;
124  typedef ConstAngularType AngularType;
126  typedef ForcePlain PlainReturnType;
127  typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
128  typedef ConstDataRefType ToVectorConstReturnType;
129  typedef ConstDataRefType DataRefType;
130  typedef DataRefType ToVectorReturnType;
132 
133  }; // traits ForceRef<const Vector6ArgType>
134 
135  template<typename Vector6ArgType>
136  class ForceRef<const Vector6ArgType>
137  : public ForceDense< ForceRef<const Vector6ArgType> >
138  {
139  public:
140  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
144 
145  ForceRef(typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) f_like)
146  : m_ref(f_like)
147  {
148  EIGEN_STATIC_ASSERT(Vector6ArgType::ColsAtCompileTime == 1,
149  YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
150  assert(f_like.size() == 6);
151  }
152 
153  ToVectorConstReturnType toVector_impl() const { return m_ref; }
154 
155  // Getters
156  ConstAngularType angular_impl() const { return ConstAngularType(m_ref.derived(),ANGULAR); }
157  ConstLinearType linear_impl() const { return ConstLinearType(m_ref.derived(),LINEAR); }
158 
159  const ForceRef & ref() const { return *this; }
160 
161  protected:
162  DataRefType m_ref;
163 
164  }; // class ForceRef<Vector6Like>
165 
166 } // namespace pinocchio
167 
168 #endif // ifndef __pinocchio_force_ref_hpp__
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
traits< ForceRef< Vector6ArgType > >::ForcePlain ReturnType
Definition: force-ref.hpp:48
traits< ForceRef >::DataRefType DataRefType
Definition: force-ref.hpp:57
DataRefType m_ref
Definition: force-ref.hpp:104
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstLinearType
Definition: force-ref.hpp:28
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Definition: force-ref.hpp:118
Return type of the ation of a Motion onto an object of type D.
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
Definition: force-ref.hpp:119
ForceRef & ref()
Definition: force-ref.hpp:101
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ForceDense< ForceRef > Base
Definition: force-ref.hpp:141
SE3::Scalar Scalar
Definition: conversions.cpp:13
LinearType linear_impl()
Definition: force-ref.hpp:85
ForceRef(typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) f_like)
Definition: force-ref.hpp:145
ForceRef< const Vector6ArgType > ForceRefType
Definition: force-ref.hpp:131
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
Definition: force-ref.hpp:23
ToVectorConstReturnType toVector_impl() const
Definition: force-ref.hpp:78
ToVectorReturnType toVector_impl()
Definition: force-ref.hpp:79
#define FORCE_TYPEDEF_TPL(Derived)
void linear_impl(const Eigen::MatrixBase< V3 > &v)
Definition: force-ref.hpp:95
ConstAngularType angular_impl() const
Definition: force-ref.hpp:82
ForceTpl< Scalar, Options > ForcePlain
Definition: force-ref.hpp:30
#define PINOCCHIO_EIGEN_REF_TYPE(D)
Main pinocchio namespace.
Definition: timings.cpp:28
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstLinearType
Definition: force-ref.hpp:121
PINOCCHIO_EIGEN_PLAIN_TYPE(ConfigVectorType) integrate(const ModelTpl< Scalar
Integrate a configuration vector for the specified model for a tangent vector during one unit time...
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstAngularType
Definition: force-ref.hpp:122
ConstLinearType linear_impl() const
Definition: force-ref.hpp:83
Common traits structure to fully define base classes for CRTP.
Definition: src/fwd.hpp:44
AngularType angular_impl()
Definition: force-ref.hpp:84
traits< ForceRef >::DataRefType DataRefType
Definition: force-ref.hpp:142
Eigen::Matrix< Scalar, 4, 4, Options > Matrix4
Definition: force-ref.hpp:22
ToVectorConstReturnType toVector_impl() const
Definition: force-ref.hpp:153
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstAngularType
Definition: force-ref.hpp:29
w
Definition: ur5x4.py:45
traits< ForceRef< Vector6ArgType > >::ForcePlain ReturnType
Definition: force-ref.hpp:42
void angular_impl(const Eigen::MatrixBase< V3 > &w)
Definition: force-ref.hpp:88
Vector6ArgType::template FixedSegmentReturnType< 3 >::Type LinearType
Definition: force-ref.hpp:26
ForceRef(typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) f_like)
Default constructor from a 6 dimensional vector.
Definition: force-ref.hpp:65
ForceRef(const ForceRef &other)
Copy constructor from another ForceRef.
Definition: force-ref.hpp:74
Vector6ArgType::template FixedSegmentReturnType< 3 >::Type AngularType
Definition: force-ref.hpp:27
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ForceDense< ForceRef > Base
Definition: force-ref.hpp:56
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Definition: force-ref.hpp:21


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