5#ifndef __pinocchio_spatial_motion_ref_hpp__ 6#define __pinocchio_spatial_motion_ref_hpp__ 11 template<
typename Vector6ArgType>
14 typedef typename Vector6ArgType::Scalar Scalar;
15 typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
20 Options = Vector6::Options
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;
25 typedef Matrix6 ActionMatrixType;
26 typedef Matrix4 HomogeneousMatrixType;
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 MotionPlain PlainReturnType;
33 typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType)
DataRefType;
35 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
36 typedef ConstDataRefType ToVectorConstReturnType;
41 template<
typename Vector6ArgType>
47 template<
typename Vector6ArgType,
typename MotionDerived>
55 template<
typename Vector6ArgType,
typename Scalar>
61 template<
typename Vector6ArgType,
typename Scalar>
62 struct LHSScalarMultiplication<MotionRef<Vector6ArgType>, Scalar>
64 typedef typename traits<MotionRef<Vector6ArgType>>::MotionPlain ReturnType;
68 template<
typename Vector6ArgType>
69 class MotionRef :
public MotionDense<MotionRef<Vector6ArgType>>
72 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
73 typedef MotionDense<MotionRef> Base;
77 using Base::operator=;
82 using Base::__minus__;
84 using Base::__opposite__;
89 MotionRef(
typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) v_like)
93 Vector6ArgType::ColsAtCompileTime == 1, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
94 assert(v_like.size() == 6);
103 ToVectorConstReturnType toVector_impl()
const 107 ToVectorReturnType toVector_impl()
113 ConstAngularType angular_impl()
const 115 return ConstAngularType(m_ref.derived(), ANGULAR);
117 ConstLinearType linear_impl()
const 119 return ConstLinearType(m_ref.derived(), LINEAR);
121 AngularType angular_impl()
123 return m_ref.template segment<3>(ANGULAR);
125 LinearType linear_impl()
127 return m_ref.template segment<3>(LINEAR);
130 template<
typename V3>
131 void angular_impl(
const Eigen::MatrixBase<V3> & w)
133 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3, 3);
137 template<
typename V3>
138 void linear_impl(
const Eigen::MatrixBase<V3> & v)
140 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3, 3);
145 template<
typename S1,
int O1>
146 MotionPlain __plus__(
const MotionTpl<S1, O1> & v)
const 148 return MotionPlain(m_ref + v.toVector());
151 template<
typename Vector6Like>
154 return MotionPlain(m_ref + v.toVector());
157 template<
typename S1,
int O1>
158 MotionPlain __minus__(
const MotionTpl<S1, O1> & v)
const 160 return MotionPlain(m_ref - v.toVector());
163 template<
typename Vector6Like>
166 return MotionPlain(m_ref - v.toVector());
169 template<
typename S1,
int O1>
170 MotionRef & __pequ__(
const MotionTpl<S1, O1> & v)
172 m_ref += v.toVector();
176 template<
typename Vector6Like>
179 m_ref += v.toVector();
183 template<
typename S1,
int O1>
184 MotionRef & __mequ__(
const MotionTpl<S1, O1> & v)
186 m_ref -= v.toVector();
190 template<
typename Vector6Like>
193 m_ref -= v.toVector();
197 template<
typename OtherScalar>
198 MotionPlain __mult__(
const OtherScalar & alpha)
const 200 return MotionPlain(alpha * m_ref);
208 inline PlainReturnType plain()
const 210 return PlainReturnType(m_ref);
218 template<
typename Vector6ArgType>
221 typedef typename Vector6ArgType::Scalar Scalar;
222 typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
227 Options = Vector6::Options
229 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
230 typedef Eigen::Matrix<Scalar, 4, 4, Options> Matrix4;
231 typedef Eigen::Matrix<Scalar, 6, 6, Options> Matrix6;
232 typedef Matrix6 ActionMatrixType;
233 typedef Matrix4 HomogeneousMatrixType;
234 typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
235 typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
236 typedef ConstLinearType LinearType;
237 typedef ConstAngularType AngularType;
239 typedef MotionPlain PlainReturnType;
240 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
241 typedef ConstDataRefType ToVectorConstReturnType;
242 typedef ConstDataRefType DataRefType;
243 typedef DataRefType ToVectorReturnType;
248 template<
typename Vector6ArgType>
252 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
257 using Base::operator=;
261 using Base::__minus__;
262 using Base::__mult__;
263 using Base::__opposite__;
264 using Base::__plus__;
266 MotionRef(
typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) v_like)
270 Vector6ArgType::ColsAtCompileTime == 1, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
271 assert(v_like.size() == 6);
280 ToVectorConstReturnType toVector_impl()
const 286 ConstAngularType angular_impl()
const 288 return ConstAngularType(m_ref.derived(), ANGULAR);
290 ConstLinearType linear_impl()
const 292 return ConstLinearType(m_ref.derived(), LINEAR);
296 template<
typename S1,
int O1>
297 MotionPlain __plus__(
const MotionTpl<S1, O1> & v)
const 299 return MotionPlain(m_ref + v.toVector());
302 template<
typename Vector6Like>
305 return MotionPlain(m_ref + v.toVector());
308 template<
typename S1,
int O1>
309 MotionPlain __minus__(
const MotionTpl<S1, O1> & v)
const 311 return MotionPlain(m_ref - v.toVector());
314 template<
typename Vector6Like>
317 return MotionPlain(m_ref - v.toVector());
320 template<
typename OtherScalar>
321 MotionPlain __mult__(
const OtherScalar & alpha)
const 323 return MotionPlain(alpha * m_ref);
331 inline PlainReturnType plain()
const 333 return PlainReturnType(m_ref);
MotionRef(typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) v_like)
Default constructor from a 6 dimensional vector.
MotionRef(const MotionRef &other)
Copy constructor from another MotionRef.
Main pinocchio namespace.
Return type of the ation of a Motion onto an object of type D.
Common traits structure to fully define base classes for CRTP.