6 #ifndef __pinocchio_motion_tpl_hpp__ 7 #define __pinocchio_motion_tpl_hpp__ 11 template<
typename _Scalar,
int _Options>
14 typedef _Scalar Scalar;
15 typedef Eigen::Matrix<Scalar,3,1,_Options> Vector3;
16 typedef Eigen::Matrix<Scalar,6,1,_Options> Vector6;
17 typedef Eigen::Matrix<Scalar,6,6,_Options> Matrix6;
18 typedef Matrix6 ActionMatrixType;
19 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6) ToVectorConstReturnType;
20 typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6) ToVectorReturnType;
21 typedef typename Vector6::template FixedSegmentReturnType<3>::Type LinearType;
22 typedef typename Vector6::template FixedSegmentReturnType<3>::Type AngularType;
23 typedef typename Vector6::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
24 typedef typename Vector6::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
35 template<
typename _Scalar,
int _Options>
39 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
42 enum { Options = _Options };
44 using Base::operator=;
49 using Base::__opposite__;
50 using Base::__minus__;
58 template<
typename V1,
typename V2>
59 MotionTpl(
const Eigen::MatrixBase<V1> & v,
const Eigen::MatrixBase<V2> & w)
61 assert(v.size() == 3);
62 assert(w.size() == 3);
63 linear() = v; angular() = w;
67 explicit MotionTpl(
const Eigen::MatrixBase<V6> & v)
70 EIGEN_STATIC_ASSERT_VECTOR_ONLY(V6);
71 assert(v.size() == 6);
76 : m_data(clone.toVector())
81 { linear() = clone.linear(); angular() = clone.angular(); }
88 static MotionTpl Zero() {
return MotionTpl(Vector6::Zero()); }
89 static MotionTpl Random() {
return MotionTpl(Vector6::Random()); }
91 ToVectorConstReturnType toVector_impl()
const {
return m_data; }
92 ToVectorReturnType toVector_impl() {
return m_data; }
95 ConstAngularType angular_impl()
const {
return m_data.template segment<3> (ANGULAR); }
96 ConstLinearType linear_impl()
const {
return m_data.template segment<3> (LINEAR); }
97 AngularType angular_impl() {
return m_data.template segment<3> (ANGULAR); }
98 LinearType linear_impl() {
return m_data.template segment<3> (LINEAR); }
100 template<
typename V3>
101 void angular_impl(
const Eigen::MatrixBase<V3> & w)
103 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
106 template<
typename V3>
107 void linear_impl(
const Eigen::MatrixBase<V3> & v)
109 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
118 template<
typename Vector6ArgType>
126 template<
typename Vector6ArgType>
132 { m_data += v.toVector();
return *
this; }
134 template<
typename Vector6ArgType>
136 { m_data += v.toVector();
return *
this; }
140 { m_data -= v.toVector();
return *
this; }
142 template<
typename Vector6ArgType>
144 { m_data -= v.toVector();
return *
this; }
146 template<
typename OtherScalar>
147 MotionPlain __mult__(
const OtherScalar & alpha)
const 153 template<
typename NewScalar>
157 ReturnType res(linear().
template cast<NewScalar>(),
158 angular().
template cast<NewScalar>());
169 #endif // ifndef __pinocchio_motion_tpl_hpp__
Main pinocchio namespace.
Common traits structure to fully define base classes for CRTP.
MotionTpl< NewScalar, Options > cast() const