18 #ifndef __se3_spatial_axis_hpp__ 19 #define __se3_spatial_axis_hpp__ 21 #include "pinocchio/spatial/fwd.hpp" 22 #include "pinocchio/spatial/cartesian-axis.hpp" 23 #include "pinocchio/spatial/motion.hpp" 24 #include "pinocchio/spatial/force.hpp" 32 template<
int axis,
typename MotionDerived>
33 struct MotionAlgebraAction<
SpatialAxis<axis>, MotionDerived>
34 {
typedef typename MotionDerived::MotionPlain ReturnType; };
40 enum { axis = _axis, dim = 6 };
43 enum { LINEAR = 0, ANGULAR = 3 };
45 template<
typename Derived1,
typename Derived2>
49 template<
typename Derived>
57 template<
typename Derived1,
typename Derived2>
61 template<
typename Derived>
69 template<
typename Scalar>
74 for(Eigen::DenseIndex i = 0; i < dim; ++i)
75 res.toVector()[i] = i == axis ? s : Scalar(0);
80 template<
typename Scalar>
87 template<
typename Derived>
88 friend Derived & operator<<(MotionDense<Derived> & min,
93 min.toVector()[axis] = Scalar(1);
97 template<
typename MotionDerived>
98 typename MotionDerived::MotionPlain
101 typename MotionDerived::MotionPlain res;
102 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
104 res.angular().setZero();
105 CartesianAxis3::cross(-m.angular(),res.linear());
109 CartesianAxis3::cross(-m.linear(),res.linear());
110 CartesianAxis3::cross(-m.angular(),res.angular());
119 template<
typename Derived1,
typename Derived2>
124 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
126 mout_.angular().setZero();
127 CartesianAxis3::cross(min.angular(),mout_.linear());
131 CartesianAxis3::cross(min.linear(),mout_.linear());
132 CartesianAxis3::cross(min.angular(),mout_.angular());
137 template<
typename Derived1,
typename Derived2>
142 if((LINEAR == 0 && axis<3) || (LINEAR == 3 && axis >= 3))
144 fout_.linear().setZero();
145 CartesianAxis3::cross(fin.
linear(),fout_.angular());
149 CartesianAxis3::cross(fin.
linear(),fout_.linear());
150 CartesianAxis3::cross(fin.
angular(),fout_.angular());
163 #endif // __se3_spatial_axis_hpp__
ConstAngularType angular() const
Return the angular part of the force vector.
ConstLinearType linear() const
Return the linear 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.