5 #ifndef __pinocchio_force_set_hpp__ 6 #define __pinocchio_force_set_hpp__ 8 #include "pinocchio/spatial/fwd.hpp" 9 #include <Eigen/Geometry> 13 template<
typename _Scalar,
int _Options>
17 typedef _Scalar Scalar;
18 enum { Options = _Options };
19 typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
20 typedef Eigen::Matrix<Scalar,3,3,Options> Matrix3;
21 typedef Eigen::Matrix<Scalar,6,1,Options> Vector6;
22 typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
25 typedef Eigen::Matrix<Scalar,3,Eigen::Dynamic,Options> Matrix3x;
26 typedef Eigen::Matrix<Scalar,6,Eigen::Dynamic,Options> Matrix6x;
30 ForceSetTpl(
const int & ncols ) : size(ncols),m_f(3,ncols), m_n(3,ncols)
31 { m_f.fill(NAN); m_n.fill(NAN); }
32 ForceSetTpl(
const Matrix3x & linear,
const Matrix3x & angular)
33 : size((
int)linear.cols()),m_f(linear), m_n(angular)
34 { assert( linear.cols() == angular.cols() ); }
36 Matrix6x matrix()
const 38 Matrix6x F(6,size); F << m_f, m_n;
43 operator Matrix6x ()
const {
return matrix(); }
46 const Matrix3x & linear()
const {
return m_f; }
47 const Matrix3x & angular()
const {
return m_n; }
52 Matrix3x Rf (m.rotation()*linear());
59 return ForceSetTpl(m.rotation().transpose()*linear(),
60 m.rotation().transpose()*(angular() -
skew(m.translation())*linear()) );
64 friend std::ostream & operator << (std::ostream & os,
const ForceSetTpl & phi)
67 <<
"F =\n" << phi.linear() << std::endl
68 <<
"Tau =\n" << phi.angular() << std::endl;
78 : ref(ref), idx(idx), len(len) {}
80 Eigen::Block<ForceSetTpl::Matrix3x> linear() {
return ref.m_f.block(0,idx,3,len); }
81 Eigen::Block<ForceSetTpl::Matrix3x> angular() {
return ref.m_n.block(0,idx,3,len); }
82 Eigen::Block<const ForceSetTpl::Matrix3x> linear()
const 83 {
return ((
const ForceSetTpl::Matrix3x &)(ref.m_f)).block(0,idx,3,len); }
84 Eigen::Block<const ForceSetTpl::Matrix3x> angular()
const 85 {
return ((
const ForceSetTpl::Matrix3x &)(ref.m_n)).block(0,idx,3,len); }
87 ForceSetTpl::Matrix6x matrix()
const 89 ForceSetTpl::Matrix6x res(6,len); res << linear(),angular();
95 assert(copy.size == len);
96 linear() = copy.linear();
97 angular() = copy.angular();
103 assert(copy.len == len);
104 linear() = copy.linear();
105 angular() = copy.angular();
109 template <
typename D>
110 Block& operator= (
const Eigen::MatrixBase<D> & m)
112 eigen_assert(D::RowsAtCompileTime == 6);
113 assert(m.cols() == len);
114 linear() = m.template topRows<3>();
115 angular() = m.template bottomRows<3>();
124 Matrix3x Rf ((m.rotation()*linear()));
125 return ForceSetTpl(Rf,
skew(m.translation())*Rf+m.rotation()*angular());
133 return ForceSetTpl(m.rotation().transpose()*linear(),
134 m.rotation().transpose()*(angular() -
skew(m.translation())*linear()) );
140 Block block(
const int & idx,
const int & len) {
return Block(*
this,idx,len); }
164 #endif // ifndef __pinocchio_force_set_hpp__
ForceSetTpl se3ActionInverse(const SE3 &m) const
bf = aXb.actInv(af)
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, int LEVEL)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...
ForceSetTpl se3Action(const SE3 &m) const
af = aXb.act(bf)
ForceSetTpl se3Action(const SE3 &m) const
af = aXb.act(bf)
ForceSetTpl se3ActionInverse(const SE3 &m) const
bf = aXb.actInv(af)
Main pinocchio namespace.
void skew(const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3 > &M)
Computes the skew representation of a given 3d vector, i.e. the antisymmetric matrix representation o...