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" 19 template<
int axis,
typename MotionDerived>
20 struct MotionAlgebraAction<
SpatialAxis<axis>, MotionDerived>
21 {
typedef typename MotionDerived::MotionPlain ReturnType; };
27 enum { axis = _axis, dim = 6 };
30 enum { LINEAR = 0, ANGULAR = 3 };
32 template<
typename Derived1,
typename Derived2>
36 template<
typename Derived>
44 template<
typename Derived1,
typename Derived2>
48 template<
typename Derived>
56 template<
typename Scalar>
61 for(Eigen::DenseIndex i = 0; i < dim; ++i)
62 res.toVector()[i] = i == axis ? s : Scalar(0);
67 template<
typename Scalar>
74 template<
typename Derived>
75 friend Derived & operator<<(MotionDense<Derived> & min,
80 min.toVector()[axis] = Scalar(1);
84 template<
typename MotionDerived>
85 typename MotionDerived::MotionPlain
88 typename MotionDerived::MotionPlain res;
89 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
91 res.angular().setZero();
92 CartesianAxis3::cross(-m.angular(),res.linear());
96 CartesianAxis3::cross(-m.linear(),res.linear());
97 CartesianAxis3::cross(-m.angular(),res.angular());
106 template<
typename Derived1,
typename Derived2>
111 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
113 mout_.angular().setZero();
114 CartesianAxis3::cross(min.angular(),mout_.linear());
118 CartesianAxis3::cross(min.linear(),mout_.linear());
119 CartesianAxis3::cross(min.angular(),mout_.angular());
124 template<
typename Derived1,
typename Derived2>
129 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
131 fout_.linear().setZero();
132 CartesianAxis3::cross(fin.
linear(),fout_.angular());
136 CartesianAxis3::cross(fin.
linear(),fout_.linear());
137 CartesianAxis3::cross(fin.
angular(),fout_.angular());
150 #endif // __pinocchio_spatial_axis_hpp__
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.
ConstAngularType angular() const
Return the angular part of the force 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.