5 #ifndef __pinocchio_spatial_axis_hpp__ 6 #define __pinocchio_spatial_axis_hpp__ 8 #include "pinocchio/spatial/fwd.hpp" 9 #include "pinocchio/spatial/cartesian-axis.hpp" 10 #include "pinocchio/spatial/motion.hpp" 11 #include "pinocchio/spatial/force.hpp" 17 template<
int axis,
typename MotionDerived>
19 {
typedef typename MotionDerived::MotionPlain ReturnType; };
24 enum { axis = _axis, dim = 6 };
27 enum { LINEAR = 0, ANGULAR = 3 };
29 template<
typename Derived1,
typename Derived2>
33 template<
typename Derived>
41 template<
typename Derived1,
typename Derived2>
45 template<
typename Derived>
53 template<
typename Scalar>
58 for(Eigen::DenseIndex i = 0; i < dim; ++i)
59 res.toVector()[i] = i == axis ? s : Scalar(0);
64 template<
typename Scalar>
71 template<
typename Derived>
72 friend Derived & operator<<(MotionDense<Derived> & min,
77 min.toVector()[axis] = Scalar(1);
81 template<
typename MotionDerived>
82 typename MotionDerived::MotionPlain
85 typename MotionDerived::MotionPlain res;
86 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
88 res.angular().setZero();
89 CartesianAxis3::cross(-m.angular(),res.linear());
93 CartesianAxis3::cross(-m.linear(),res.linear());
94 CartesianAxis3::cross(-m.angular(),res.angular());
103 template<
typename Derived1,
typename Derived2>
107 Derived2 & mout_ = PINOCCHIO_EIGEN_CONST_CAST(Derived2,mout);
109 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
111 mout_.angular().setZero();
112 CartesianAxis3::cross(min.angular(),mout_.linear());
116 CartesianAxis3::cross(min.linear(),mout_.linear());
117 CartesianAxis3::cross(min.angular(),mout_.angular());
122 template<
typename Derived1,
typename Derived2>
126 Derived2 & fout_ = PINOCCHIO_EIGEN_CONST_CAST(Derived2,fout);
128 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
130 fout_.linear().setZero();
131 CartesianAxis3::cross(fin.
linear(),fout_.angular());
135 CartesianAxis3::cross(fin.
linear(),fout_.linear());
136 CartesianAxis3::cross(fin.
angular(),fout_.angular());
149 #endif // __pinocchio_spatial_axis_hpp__
Return type of the ation of a Motion onto an object of type D.
ConstAngularType angular() const
Return the angular part of the force vector.
void cross(const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3xIn > &Min, const Eigen::MatrixBase< Matrix3xOut > &Mout)
Applies the cross product onto the columns of M.
Main pinocchio namespace.
Common traits structure to fully define base classes for CRTP.
ConstLinearType linear() const
Return the linear part of the force vector.
MultiplicationOp< InertiaTpl< Scalar, Options >, ConstraintDerived >::ReturnType operator*(const InertiaTpl< Scalar, Options > &Y, const ConstraintBase< ConstraintDerived > &constraint)
.