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=;
44 using Base::operator!=;
51 template<
typename V1,
typename V2>
52 ForceTpl(
const Eigen::MatrixBase<V1> & v,
const Eigen::MatrixBase<V2> & w)
54 assert(v.size() == 3);
55 assert(w.size() == 3);
56 linear() = v; angular() = w;
60 explicit ForceTpl(
const Eigen::MatrixBase<V6> & v)
63 EIGEN_STATIC_ASSERT_VECTOR_ONLY(V6);
64 assert(v.size() == 6);
71 ForceTpl& operator=(
const ForceTpl & clone)
87 static ForceTpl Zero() {
return ForceTpl(Vector6::Zero()); }
88 static ForceTpl Random() {
return ForceTpl(Vector6::Random()); }
90 ToVectorConstReturnType toVector_impl()
const {
return m_data; }
91 ToVectorReturnType toVector_impl() {
return m_data; }
94 ConstAngularType angular_impl()
const {
return m_data.template segment<3> (ANGULAR); }
95 ConstLinearType linear_impl()
const {
return m_data.template segment<3> (LINEAR); }
96 AngularType angular_impl() {
return m_data.template segment<3> (ANGULAR); }
97 LinearType linear_impl() {
return m_data.template segment<3> (LINEAR); }
100 void angular_impl(
const Eigen::MatrixBase<V3> & w)
102 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
105 template<
typename V3>
106 void linear_impl(
const Eigen::MatrixBase<V3> & v)
108 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(V3,3);
115 template<
typename NewScalar>
119 ReturnType res(linear().
template cast<NewScalar>(),
120 angular().
template cast<NewScalar>());
131 #endif // ifndef __pinocchio_force_tpl_hpp__ ToVectorConstReturnType toVector() const
Return the force as an Eigen vector.
ConstAngularType angular() const
Return the angular part of the force vector.
Main pinocchio namespace.
Common traits structure to fully define base classes for CRTP.
ForceTpl< NewScalar, Options > cast() const
ConstLinearType linear() const
Return the linear part of the force vector.