force-ref.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017-2019 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_spatial_force_ref_hpp__
6 #define __pinocchio_spatial_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  {
18  LINEAR = 0,
19  ANGULAR = 3,
21  };
22  typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
23  typedef Eigen::Matrix<Scalar, 4, 4, Options> Matrix4;
24  typedef Eigen::Matrix<Scalar, 6, 6, Options> Matrix6;
27  typedef typename Vector6ArgType::template FixedSegmentReturnType<3>::Type LinearType;
28  typedef typename Vector6ArgType::template FixedSegmentReturnType<3>::Type AngularType;
29  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
30  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
32  typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) DataRefType;
33  typedef DataRefType ToVectorReturnType;
34  typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
35  typedef ConstDataRefType ToVectorConstReturnType;
37 
38  }; // traits ForceRef
39 
40  template<typename Vector6ArgType>
41  struct SE3GroupAction<ForceRef<Vector6ArgType>>
42  {
43  typedef typename traits<ForceRef<Vector6ArgType>>::ForcePlain ReturnType;
44  };
45 
46  template<typename Vector6ArgType, typename MotionDerived>
47  struct MotionAlgebraAction<ForceRef<Vector6ArgType>, MotionDerived>
48  {
49  typedef typename traits<ForceRef<Vector6ArgType>>::ForcePlain ReturnType;
50  };
51 
52  template<typename Vector6ArgType>
53  class ForceRef : public ForceDense<ForceRef<Vector6ArgType>>
54  {
55  public:
56  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
60 
61  using Base::operator=;
62  using Base::operator==;
63  using Base::operator!=;
64 
66  ForceRef(typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) f_like)
67  : m_ref(f_like)
68  {
69  EIGEN_STATIC_ASSERT(
70  Vector6ArgType::ColsAtCompileTime == 1, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
71  assert(f_like.size() == 6);
72  }
73 
75  ForceRef(const ForceRef & other)
76  : m_ref(other.m_ref)
77  {
78  }
79 
80  ToVectorConstReturnType toVector_impl() const
81  {
82  return m_ref;
83  }
84  ToVectorReturnType toVector_impl()
85  {
86  return m_ref;
87  }
88 
89  // Getters
90  ConstAngularType angular_impl() const
91  {
92  return ConstAngularType(m_ref.derived(), ANGULAR);
93  }
94  ConstLinearType linear_impl() const
95  {
96  return ConstLinearType(m_ref.derived(), LINEAR);
97  }
98  AngularType angular_impl()
99  {
100  return m_ref.template segment<3>(ANGULAR);
101  }
102  LinearType linear_impl()
103  {
104  return m_ref.template segment<3>(LINEAR);
105  }
106 
107  template<typename V3>
108  void angular_impl(const Eigen::MatrixBase<V3> & w)
109  {
110  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3, 3);
111  angular_impl() = w;
112  }
113 
114  template<typename V3>
115  void linear_impl(const Eigen::MatrixBase<V3> & v)
116  {
117  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3, 3);
118  linear_impl() = v;
119  }
120 
122  {
123  return *this;
124  }
125 
126  protected:
128 
129  }; // class ForceRef<Vector6Like>
130 
131  template<typename Vector6ArgType>
132  struct traits<ForceRef<const Vector6ArgType>>
133  {
134  typedef typename Vector6ArgType::Scalar Scalar;
135  typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
136  enum
137  {
138  LINEAR = 0,
139  ANGULAR = 3,
141  };
142  typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
143  typedef Eigen::Matrix<Scalar, 6, 6, Options> Matrix6;
145  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
146  typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
151  typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
152  typedef ConstDataRefType ToVectorConstReturnType;
153  typedef ConstDataRefType DataRefType;
156 
157  }; // traits ForceRef<const Vector6ArgType>
158 
159  template<typename Vector6ArgType>
160  class ForceRef<const Vector6ArgType> : public ForceDense<ForceRef<const Vector6ArgType>>
161  {
162  public:
163  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
167 
168  ForceRef(typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) f_like)
169  : m_ref(f_like)
170  {
171  EIGEN_STATIC_ASSERT(
172  Vector6ArgType::ColsAtCompileTime == 1, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
173  assert(f_like.size() == 6);
174  }
175 
176  ToVectorConstReturnType toVector_impl() const
177  {
178  return m_ref;
179  }
180 
181  // Getters
182  ConstAngularType angular_impl() const
183  {
184  return ConstAngularType(m_ref.derived(), ANGULAR);
185  }
186  ConstLinearType linear_impl() const
187  {
188  return ConstLinearType(m_ref.derived(), LINEAR);
189  }
190 
191  const ForceRef & ref() const
192  {
193  return *this;
194  }
195 
196  protected:
198 
199  }; // class ForceRef<Vector6Like>
200 
201 } // namespace pinocchio
202 
203 #endif // ifndef __pinocchio_spatial_force_ref_hpp__
pinocchio::SE3GroupAction< ForceRef< Vector6ArgType > >::ReturnType
traits< ForceRef< Vector6ArgType > >::ForcePlain ReturnType
Definition: force-ref.hpp:43
pinocchio::ForceRef::linear_impl
ConstLinearType linear_impl() const
Definition: force-ref.hpp:94
pinocchio::ForceRef< const Vector6ArgType >::linear_impl
ConstLinearType linear_impl() const
Definition: force-ref.hpp:186
pinocchio::traits< ForceRef< Vector6ArgType > >::HomogeneousMatrixType
Matrix4 HomogeneousMatrixType
Definition: force-ref.hpp:26
pinocchio::ForceRef< const Vector6ArgType >::angular_impl
ConstAngularType angular_impl() const
Definition: force-ref.hpp:182
pinocchio::traits< ForceRef< Vector6ArgType > >::Vector3
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Definition: force-ref.hpp:22
pinocchio::traits< ForceRef< Vector6ArgType > >::ConstLinearType
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstLinearType
Definition: force-ref.hpp:29
pinocchio::Options
Options
Definition: joint-configuration.hpp:1082
pinocchio::traits< ForceRef< Vector6ArgType > >::Matrix6
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
Definition: force-ref.hpp:24
pinocchio::traits< ForceRef< const Vector6ArgType > >::Vector3
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Definition: force-ref.hpp:142
pinocchio::ForceRef::FORCE_TYPEDEF_TPL
FORCE_TYPEDEF_TPL(ForceRef)
pinocchio::traits< ForceRef< Vector6ArgType > >::Scalar
Vector6ArgType::Scalar Scalar
Definition: force-ref.hpp:14
pinocchio::PINOCCHIO_EIGEN_REF_CONST_TYPE
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
Definition: joint-free-flyer.hpp:144
pinocchio::ForceRef::linear_impl
void linear_impl(const Eigen::MatrixBase< V3 > &v)
Definition: force-ref.hpp:115
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::traits< ForceRef< const Vector6ArgType > >::ConstLinearType
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstLinearType
Definition: force-ref.hpp:145
pinocchio::ForceRef< const Vector6ArgType >::ref
const ForceRef & ref() const
Definition: force-ref.hpp:191
pinocchio::traits< ForceRef< const Vector6ArgType > >::AngularType
ConstAngularType AngularType
Definition: force-ref.hpp:148
pinocchio::traits< ForceRef< const Vector6ArgType > >::ConstAngularType
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstAngularType
Definition: force-ref.hpp:146
pinocchio::ForceRef::ForceRef
ForceRef(typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) f_like)
Default constructor from a 6 dimensional vector.
Definition: force-ref.hpp:66
pinocchio::MotionAlgebraAction
Return type of the ation of a Motion onto an object of type D.
Definition: spatial/motion.hpp:45
pinocchio::SE3GroupAction
Definition: spatial/se3.hpp:39
pinocchio::traits< ForceRef< Vector6ArgType > >::ToVectorReturnType
DataRefType ToVectorReturnType
Definition: force-ref.hpp:33
pinocchio::python::Options
@ Options
Definition: expose-contact-inverse-dynamics.cpp:22
pinocchio::traits< ForceRef< Vector6ArgType > >::LinearType
Vector6ArgType::template FixedSegmentReturnType< 3 >::Type LinearType
Definition: force-ref.hpp:27
pinocchio::ForceRef< const Vector6ArgType >::Base
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ForceDense< ForceRef > Base
Definition: force-ref.hpp:164
pinocchio::traits< ForceRef< Vector6ArgType > >::Matrix4
Eigen::Matrix< Scalar, 4, 4, Options > Matrix4
Definition: force-ref.hpp:23
pinocchio::traits< ForceRef< const Vector6ArgType > >::ToVectorReturnType
DataRefType ToVectorReturnType
Definition: force-ref.hpp:154
pinocchio::ForceRef< const Vector6ArgType >::ForceRef
ForceRef(typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) f_like)
Definition: force-ref.hpp:168
pinocchio::ForceRef::angular_impl
ConstAngularType angular_impl() const
Definition: force-ref.hpp:90
pinocchio::ForceRef::angular_impl
AngularType angular_impl()
Definition: force-ref.hpp:98
pinocchio::traits< ForceRef< const Vector6ArgType > >::Matrix6
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
Definition: force-ref.hpp:143
pinocchio::traits< ForceRef< Vector6ArgType > >::ForcePlain
ForceTpl< Scalar, Options > ForcePlain
Definition: force-ref.hpp:31
pinocchio::ForceRef::toVector_impl
ToVectorReturnType toVector_impl()
Definition: force-ref.hpp:84
pinocchio::ForceTpl< Scalar, Options >
pinocchio::ForceRef::linear_impl
LinearType linear_impl()
Definition: force-ref.hpp:102
pinocchio::traits< ForceRef< Vector6ArgType > >::ToVectorConstReturnType
ConstDataRefType ToVectorConstReturnType
Definition: force-ref.hpp:35
pinocchio::ForceRef::DataRefType
traits< ForceRef >::DataRefType DataRefType
Definition: force-ref.hpp:58
pinocchio::traits< ForceRef< Vector6ArgType > >::ConstAngularType
Vector6ArgType::template ConstFixedSegmentReturnType< 3 >::Type ConstAngularType
Definition: force-ref.hpp:30
ur5x4.w
w
Definition: ur5x4.py:50
pinocchio::traits< ForceRef< const Vector6ArgType > >::ToVectorConstReturnType
ConstDataRefType ToVectorConstReturnType
Definition: force-ref.hpp:152
pinocchio::ForceRef::ref
ForceRef & ref()
Definition: force-ref.hpp:121
pinocchio::traits< ForceRef< const Vector6ArgType > >::ActionMatrixType
Matrix6 ActionMatrixType
Definition: force-ref.hpp:144
pinocchio::ForceRef::ForceRef
ForceRef(const ForceRef &other)
Copy constructor from another ForceRef.
Definition: force-ref.hpp:75
pinocchio::traits< ForceRef< Vector6ArgType > >::ActionMatrixType
Matrix6 ActionMatrixType
Definition: force-ref.hpp:25
pinocchio::v
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Definition: joint-configuration.hpp:1084
pinocchio::MotionAlgebraAction< ForceRef< Vector6ArgType >, MotionDerived >::ReturnType
traits< ForceRef< Vector6ArgType > >::ForcePlain ReturnType
Definition: force-ref.hpp:49
pinocchio::ForceRef
Definition: force-ref.hpp:53
pinocchio::ForceRef::toVector_impl
ToVectorConstReturnType toVector_impl() const
Definition: force-ref.hpp:80
pinocchio::ForceDense
Definition: context/casadi.hpp:34
pinocchio::ForceRef< const Vector6ArgType >::toVector_impl
ToVectorConstReturnType toVector_impl() const
Definition: force-ref.hpp:176
pinocchio::ForceRef< const Vector6ArgType >
Definition: force-ref.hpp:160
pinocchio::traits
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:71
pinocchio::traits< ForceRef< const Vector6ArgType > >::ForcePlain
ForceTpl< Scalar, Options > ForcePlain
Definition: force-ref.hpp:149
pinocchio::traits< ForceRef< Vector6ArgType > >::AngularType
Vector6ArgType::template FixedSegmentReturnType< 3 >::Type AngularType
Definition: force-ref.hpp:28
pinocchio::traits< ForceRef< const Vector6ArgType > >::LinearType
ConstLinearType LinearType
Definition: force-ref.hpp:147
pinocchio::PINOCCHIO_EIGEN_PLAIN_TYPE
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.
pinocchio::ForceRef::angular_impl
void angular_impl(const Eigen::MatrixBase< V3 > &w)
Definition: force-ref.hpp:108
pinocchio::traits< ForceRef< const Vector6ArgType > >::PlainReturnType
ForcePlain PlainReturnType
Definition: force-ref.hpp:150
PINOCCHIO_EIGEN_REF_TYPE
#define PINOCCHIO_EIGEN_REF_TYPE(D)
Definition: eigen-macros.hpp:32
pinocchio::ForceRef::Base
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ForceDense< ForceRef > Base
Definition: force-ref.hpp:57
pinocchio::ForceRef::m_ref
DataRefType m_ref
Definition: force-ref.hpp:127
pinocchio::traits< ForceRef< Vector6ArgType > >::ForceRefType
ForceRef< Vector6ArgType > ForceRefType
Definition: force-ref.hpp:36
pinocchio::ForceRef< const Vector6ArgType >::m_ref
DataRefType m_ref
Definition: force-ref.hpp:197
pinocchio::traits< ForceRef< const Vector6ArgType > >::DataRefType
ConstDataRefType DataRefType
Definition: force-ref.hpp:153
pinocchio::traits< ForceRef< const Vector6ArgType > >::Scalar
Vector6ArgType::Scalar Scalar
Definition: force-ref.hpp:134
pinocchio::ForceRef< const Vector6ArgType >::DataRefType
traits< ForceRef >::DataRefType DataRefType
Definition: force-ref.hpp:165
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::traits< ForceRef< const Vector6ArgType > >::ForceRefType
ForceRef< const Vector6ArgType > ForceRefType
Definition: force-ref.hpp:155


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