5 #ifndef __pinocchio_spatial_force_set_hpp__
6 #define __pinocchio_spatial_force_set_hpp__
8 #include "pinocchio/spatial/fwd.hpp"
9 #include <Eigen/Geometry>
13 template<
typename _Scalar,
int _Options>
17 typedef _Scalar Scalar;
22 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
23 typedef Eigen::Matrix<Scalar, 3, 3, Options> Matrix3;
24 typedef Eigen::Matrix<Scalar, 6, 1, Options> Vector6;
25 typedef Eigen::Matrix<Scalar, 6, 6, Options> Matrix6;
28 typedef Eigen::Matrix<Scalar, 3, Eigen::Dynamic, Options> Matrix3x;
29 typedef Eigen::Matrix<Scalar, 6, Eigen::Dynamic, Options> Matrix6x;
41 ForceSetTpl(
const Matrix3x & linear,
const Matrix3x & angular)
42 : size((
int)linear.cols())
46 assert(linear.cols() == angular.cols());
49 Matrix6x matrix()
const
57 operator Matrix6x()
const
63 const Matrix3x & linear()
const
67 const Matrix3x & angular()
const
75 Matrix3x Rf(m.rotation() * linear());
76 return ForceSetTpl(Rf,
skew(m.translation()) * Rf + m.rotation() * angular());
83 m.rotation().transpose() * linear(),
84 m.rotation().transpose() * (angular() -
skew(m.translation()) * linear()));
88 friend std::ostream & operator<<(std::ostream & os,
const ForceSetTpl & phi)
90 os <<
"F =\n" << phi.linear() << std::endl <<
"Tau =\n" << phi.angular() << std::endl;
106 Eigen::Block<ForceSetTpl::Matrix3x> linear()
108 return ref.m_f.block(0, idx, 3, len);
110 Eigen::Block<ForceSetTpl::Matrix3x> angular()
112 return ref.m_n.block(0, idx, 3, len);
114 Eigen::Block<const ForceSetTpl::Matrix3x> linear()
const
116 return ((
const ForceSetTpl::Matrix3x &)(ref.m_f)).block(0, idx, 3, len);
118 Eigen::Block<const ForceSetTpl::Matrix3x> angular()
const
120 return ((
const ForceSetTpl::Matrix3x &)(ref.m_n)).block(0, idx, 3, len);
123 ForceSetTpl::Matrix6x matrix()
const
125 ForceSetTpl::Matrix6x res(6, len);
126 res << linear(), angular();
132 assert(
copy.size == len);
133 linear() =
copy.linear();
134 angular() =
copy.angular();
140 assert(
copy.len == len);
149 Block & operator=(
const Eigen::MatrixBase<D> & m)
151 eigen_assert(D::RowsAtCompileTime == 6);
152 assert(m.cols() == len);
153 linear() = m.template topRows<3>();
154 angular() = m.template bottomRows<3>();
163 Matrix3x Rf((m.rotation() * linear()));
164 return ForceSetTpl(Rf,
skew(m.translation()) * Rf + m.rotation() * angular());
173 m.rotation().transpose() * linear(),
174 m.rotation().transpose() * (angular() -
skew(m.translation()) * linear()));
179 Block block(
const int & idx,
const int & len)
181 return Block(*
this, idx, len);
197 typedef ForceSetTpl<context::Scalar, context::Options> ForceSet;
ForceSetTpl se3ActionInverse(const SE3 &m) const
bf = aXb.actInv(af)
ForceSetTpl se3Action(const SE3 &m) const
af = aXb.act(bf)
Main pinocchio namespace.
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, KinematicLevel kinematic_level)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...
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...
ForceSetTpl se3ActionInverse(const SE3 &m) const
bf = aXb.actInv(af)
ForceSetTpl se3Action(const SE3 &m) const
af = aXb.act(bf)