6 #ifndef __pinocchio_force_tpl_hpp__ 7 #define __pinocchio_force_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 typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6) ToVectorConstReturnType;
19 typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6) ToVectorReturnType;
20 typedef typename Vector6::template FixedSegmentReturnType<3>::Type LinearType;
21 typedef typename Vector6::template FixedSegmentReturnType<3>::Type AngularType;
22 typedef typename Vector6::template ConstFixedSegmentReturnType<3>::Type ConstLinearType;
23 typedef typename Vector6::template ConstFixedSegmentReturnType<3>::Type ConstAngularType;
34 template<
typename _Scalar,
int _Options>
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 enum { Options = _Options };
43 using Base::operator=;
50 template<
typename V1,
typename V2>
51 ForceTpl(
const Eigen::MatrixBase<V1> & v,
const Eigen::MatrixBase<V2> & w)
53 assert(v.size() == 3);
54 assert(w.size() == 3);
55 linear() = v; angular() = w;
59 explicit ForceTpl(
const Eigen::MatrixBase<V6> & v)
62 EIGEN_STATIC_ASSERT_VECTOR_ONLY(V6);
63 assert(v.size() == 6);
76 static ForceTpl Zero() {
return ForceTpl(Vector6::Zero()); }
77 static ForceTpl Random() {
return ForceTpl(Vector6::Random()); }
79 ToVectorConstReturnType toVector_impl()
const {
return m_data; }
80 ToVectorReturnType toVector_impl() {
return m_data; }
83 ConstAngularType angular_impl()
const {
return m_data.template segment<3> (ANGULAR); }
84 ConstLinearType linear_impl()
const {
return m_data.template segment<3> (LINEAR); }
85 AngularType angular_impl() {
return m_data.template segment<3> (ANGULAR); }
86 LinearType linear_impl() {
return m_data.template segment<3> (LINEAR); }
89 void angular_impl(
const Eigen::MatrixBase<V3> & w)
91 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
95 void linear_impl(
const Eigen::MatrixBase<V3> & v)
97 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
104 template<
typename NewScalar>
108 ReturnType res(linear().
template cast<NewScalar>(),
109 angular().
template cast<NewScalar>());
120 #endif // ifndef __pinocchio_force_tpl_hpp__
ConstAngularType angular() const
Return the angular part of the force vector.
ToVectorConstReturnType toVector() const
Return the force as an Eigen vector.
Main pinocchio namespace.
Common traits structure to fully define base classes for CRTP.
ConstLinearType linear() const
Return the linear part of the force vector.
ForceTpl< NewScalar, Options > cast() const