5 #ifndef __pinocchio_motion_ref_hpp__ 6 #define __pinocchio_motion_ref_hpp__ 11 template<
typename Vector6ArgType>
14 typedef typename Vector6ArgType::Scalar Scalar;
15 typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
19 Options = Vector6::Options
21 typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
22 typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
23 typedef Matrix6 ActionMatrixType;
24 typedef typename Vector6ArgType::template FixedSegmentReturnType<3>::Type LinearType;
25 typedef typename Vector6ArgType::template FixedSegmentReturnType<3>::Type AngularType;
26 typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
27 typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
30 typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) DataRefType;
31 typedef DataRefType ToVectorReturnType;
32 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
33 typedef ConstDataRefType ToVectorConstReturnType;
38 template<
typename Vector6ArgType>
44 template<
typename Vector6ArgType,
typename MotionDerived>
52 template<
typename Vector6ArgType,
typename Scalar>
53 struct RHSScalarMultiplication< MotionRef<Vector6ArgType>, Scalar >
58 template<
typename Vector6ArgType,
typename Scalar>
59 struct LHSScalarMultiplication< MotionRef<Vector6ArgType>, Scalar >
65 template<
typename Vector6ArgType>
69 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
74 using Base::operator=;
79 using Base::__opposite__;
80 using Base::__minus__;
85 MotionRef(
typename PINOCCHIO_EIGEN_REF_TYPE(Vector6ArgType) v_like)
88 EIGEN_STATIC_ASSERT(Vector6ArgType::ColsAtCompileTime == 1,
89 YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
90 assert(v_like.size() == 6);
93 ToVectorConstReturnType toVector_impl()
const {
return m_ref; }
94 ToVectorReturnType toVector_impl() {
return m_ref; }
97 ConstAngularType angular_impl()
const {
return ConstAngularType(m_ref.derived(),ANGULAR); }
98 ConstLinearType linear_impl()
const {
return ConstLinearType(m_ref.derived(),LINEAR); }
99 AngularType angular_impl() {
return m_ref.template segment<3> (ANGULAR); }
100 LinearType linear_impl() {
return m_ref.template segment<3> (LINEAR); }
102 template<
typename V3>
103 void angular_impl(
const Eigen::MatrixBase<V3> & w)
105 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
109 template<
typename V3>
110 void linear_impl(
const Eigen::MatrixBase<V3> & v)
112 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
117 template<
typename S1,
int O1>
119 {
return MotionPlain(m_ref+v.toVector()); }
121 template<
typename Vector6Like>
123 {
return MotionPlain(m_ref+v.toVector()); }
125 template<
typename S1,
int O1>
127 {
return MotionPlain(m_ref-v.toVector()); }
129 template<
typename Vector6Like>
131 {
return MotionPlain(m_ref-v.toVector()); }
133 template<
typename S1,
int O1>
135 { m_ref += v.toVector();
return *
this; }
137 template<
typename Vector6Like>
139 { m_ref += v.toVector();
return *
this; }
141 template<
typename S1,
int O1>
143 { m_ref -= v.toVector();
return *
this; }
145 template<
typename Vector6Like>
147 { m_ref -= v.toVector();
return *
this; }
149 template<
typename OtherScalar>
150 MotionPlain __mult__(
const OtherScalar & alpha)
const 151 {
return MotionPlain(alpha*m_ref); }
155 inline PlainReturnType plain()
const {
return PlainReturnType(m_ref); }
162 template<
typename Vector6ArgType>
165 typedef typename Vector6ArgType::Scalar Scalar;
166 typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6ArgType) Vector6;
170 Options = Vector6::Options
172 typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
173 typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
174 typedef Matrix6 ActionMatrixType;
175 typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
176 typedef typename Vector6ArgType::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
177 typedef ConstLinearType LinearType;
178 typedef ConstAngularType AngularType;
181 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) ConstDataRefType;
182 typedef ConstDataRefType ToVectorConstReturnType;
183 typedef ConstDataRefType DataRefType;
184 typedef DataRefType ToVectorReturnType;
189 template<
typename Vector6ArgType>
191 :
public MotionDense< MotionRef<const Vector6ArgType> >
194 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
199 using Base::operator=;
203 using Base::__plus__;
204 using Base::__opposite__;
205 using Base::__minus__;
206 using Base::__mult__;
208 MotionRef(
typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6ArgType) v_like)
211 EIGEN_STATIC_ASSERT(Vector6ArgType::ColsAtCompileTime == 1,
212 YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
213 assert(v_like.size() == 6);
216 ToVectorConstReturnType toVector_impl()
const {
return m_ref; }
219 ConstAngularType angular_impl()
const {
return ConstAngularType(m_ref.derived(),ANGULAR); }
220 ConstLinearType linear_impl()
const {
return ConstLinearType(m_ref.derived(),LINEAR); }
223 template<
typename S1,
int O1>
225 {
return MotionPlain(m_ref+v.toVector()); }
227 template<
typename Vector6Like>
229 {
return MotionPlain(m_ref+v.toVector()); }
231 template<
typename S1,
int O1>
233 {
return MotionPlain(m_ref-v.toVector()); }
235 template<
typename Vector6Like>
237 {
return MotionPlain(m_ref-v.toVector()); }
239 template<
typename OtherScalar>
240 MotionPlain __mult__(
const OtherScalar & alpha)
const 241 {
return MotionPlain(alpha*m_ref); }
243 const MotionRef & ref()
const {
return *
this; }
245 inline PlainReturnType plain()
const {
return PlainReturnType(m_ref); }
254 #endif // ifndef __pinocchio_motion_ref_hpp__
Return type of the ation of a Motion onto an object of type D.
Main pinocchio namespace.
Common traits structure to fully define base classes for CRTP.