6 #ifndef __pinocchio_joint_free_flyer_hpp__ 7 #define __pinocchio_joint_free_flyer_hpp__ 9 #include "pinocchio/macros.hpp" 10 #include "pinocchio/spatial/inertia.hpp" 11 #include "pinocchio/spatial/explog.hpp" 12 #include "pinocchio/multibody/joint/joint-base.hpp" 13 #include "pinocchio/multibody/constraint.hpp" 14 #include "pinocchio/math/fwd.hpp" 15 #include "pinocchio/math/quaternion.hpp" 22 template<
typename _Scalar,
int _Options>
27 typedef Eigen::Matrix<Scalar,6,6,Options>
Matrix6;
34 typedef Eigen::Matrix<Scalar,6,6,Options>
DenseBase;
40 template<
typename _Scalar,
int _Options>
44 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49 template<
typename Vector6Like>
50 JointMotion
__mult__(
const Eigen::MatrixBase<Vector6Like> & vj)
const 52 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector6Like,6);
53 return JointMotion(vj);
56 template<
typename S1,
int O1>
64 template<
typename S1,
int O1>
75 template<
typename Derived>
81 template<
typename MatrixDerived>
83 operator*(const
Eigen::MatrixBase<MatrixDerived> & F)
90 MatrixReturnType
matrix_impl()
const {
return DenseBase::Identity(); }
92 template<
typename MotionDerived>
93 typename MotionDerived::ActionMatrixType
101 template<
typename Scalar,
int Options,
typename Vector6Like>
104 const Eigen::MatrixBase<Vector6Like> &
v)
106 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector6Like,6);
109 return Motion(v.derived());
113 template<
typename S1,
int O1,
typename S2,
int O2>
121 template<
typename Matrix6Like,
typename S2,
int O2>
128 template<
typename S1,
int O1>
132 template<
typename S1,
int O1,
typename MotionDerived>
138 template<
typename _Scalar,
int _Options>
155 typedef Eigen::Matrix<Scalar,6,NV,Options>
U_t;
156 typedef Eigen::Matrix<Scalar,NV,NV,Options>
D_t;
157 typedef Eigen::Matrix<Scalar,6,NV,Options>
UD_t;
165 template<
typename Scalar,
int Options>
169 template<
typename Scalar,
int Options>
173 template<
typename _Scalar,
int _Options>
176 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
192 : M(Transformation_t::Identity())
193 , v(Motion_t::Zero())
196 , UDinv(UD_t::Identity())
199 static std::string
classname() {
return std::string(
"JointDataFreeFlyer"); }
205 template<
typename _Scalar,
int _Options>
207 :
public JointModelBase< JointModelFreeFlyerTpl<_Scalar,_Options> >
209 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
219 JointDataDerived
createData()
const {
return JointDataDerived(); }
221 template<
typename ConfigVectorLike>
222 inline void forwardKinematics(Transformation_t & M,
const Eigen::MatrixBase<ConfigVectorLike> & q_joint)
const 224 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ConfigVector_t,ConfigVectorLike);
225 typedef typename Eigen::Quaternion<typename ConfigVectorLike::Scalar,PINOCCHIO_EIGEN_PLAIN_TYPE(ConfigVectorLike)::Options> Quaternion;
226 typedef Eigen::Map<const Quaternion> ConstQuaternionMap;
228 ConstQuaternionMap
quat(q_joint.template tail<4>().data());
230 assert(math::fabs(static_cast<Scalar>(
quat.coeffs().squaredNorm()-1)) <= 1e-4);
232 M.rotation(
quat.matrix());
233 M.translation(q_joint.template head<3>());
236 template<
typename Vector3Derived,
typename QuaternionDerived>
238 void calc(JointDataDerived & data,
239 const typename Eigen::MatrixBase<Vector3Derived> & trans,
240 const typename Eigen::QuaternionBase<QuaternionDerived> & quat)
const 242 data.M.translation(trans);
243 data.M.rotation(quat.matrix());
246 template<
typename ConfigVector>
248 void calc(JointDataDerived & data,
249 const typename Eigen::PlainObjectBase<ConfigVector> & qs)
const 251 typedef typename Eigen::Quaternion<typename ConfigVector::Scalar,ConfigVector::Options> Quaternion;
252 typedef Eigen::Map<const Quaternion> ConstQuaternionMap;
254 typename ConfigVector::template ConstFixedSegmentReturnType<NQ>::Type
q = qs.template segment<NQ>(
idx_q());
255 ConstQuaternionMap
quat(q.template tail<4>().data());
257 calc(data,q.template head<3>(),
quat);
260 template<
typename ConfigVector>
262 void calc(JointDataDerived & data,
263 const typename Eigen::MatrixBase<ConfigVector> & qs)
const 265 typedef typename Eigen::Quaternion<Scalar,Options> Quaternion;
267 typename ConfigVector::template ConstFixedSegmentReturnType<NQ>::Type
q = qs.template segment<NQ>(
idx_q());
268 const Quaternion
quat(q.template tail<4>());
270 calc(data,q.template head<3>(),quat);
273 template<
typename ConfigVector,
typename TangentVector>
275 void calc(JointDataDerived & data,
276 const typename Eigen::MatrixBase<ConfigVector> & qs,
277 const typename Eigen::MatrixBase<TangentVector> & vs)
const 279 calc(data,qs.derived());
281 data.v = vs.template segment<NV>(
idx_v());
284 template<
typename Matrix6Like>
286 const Eigen::MatrixBase<Matrix6Like> & I,
287 const bool update_I)
const 300 static std::string
classname() {
return std::string(
"JointModelFreeFlyer"); }
304 template<
typename NewScalar>
317 #include <boost/type_traits.hpp> 321 template<
typename Scalar,
int Options>
323 :
public integral_constant<bool,true> {};
325 template<
typename Scalar,
int Options>
327 :
public integral_constant<bool,true> {};
329 template<
typename Scalar,
int Options>
331 :
public integral_constant<bool,true> {};
333 template<
typename Scalar,
int Options>
335 :
public integral_constant<bool,true> {};
338 #endif // ifndef __pinocchio_joint_free_flyer_hpp__ JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
JointFreeFlyerTpl< Scalar, Options > JointDerived
MatrixReturnType matrix_impl() const
EIGEN_DONT_INLINE void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs) const
JointDataDerived createData() const
int idx_q(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxQVisitor to get the index in the full model configuration space...
int idx_v(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxVVisitor to get the index in the full model tangent space corre...
MotionZeroTpl< Scalar, Options > Bias_t
SE3Tpl< S1, O1 >::ActionMatrixType se3Action(const SE3Tpl< S1, O1 > &m) const
Return type of the ation of a Motion onto an object of type D.
JointDataFreeFlyerTpl< Scalar, Options > JointDataDerived
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
JointIndex id(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdVisitor to get the index of the joint in the kinematic chain...
ToVectorConstReturnType toVector() const
Return the force as an Eigen vector.
#define PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
PINOCCHIO_EIGEN_REF_CONST_TYPE(MatrixDerived) operator*(const Eigen
std::string shortname() const
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointFreeFlyerTpl< _Scalar, _Options > JointDerived
Eigen::Matrix< Scalar, 6, 6, Options > DenseBase
ConstraintIdentityTpl< Scalar, Options > Constraint_t
Matrix6::IdentityReturnType ConstMatrixReturnType
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
MotionDerived::ActionMatrixType motionAction(const MotionBase< MotionDerived > &v) const
Eigen::Matrix< Scalar, 6, 1, Options > JointForce
Matrix6::IdentityReturnType MatrixReturnType
#define PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointFreeFlyerTpl< _Scalar, _Options > JointDerived
SE3Tpl< S1, O1 >::ActionMatrixType se3ActionInverse(const SE3Tpl< S1, O1 > &m) const
ActionMatrixType toActionMatrix() const
The action matrix of .
static std::string classname()
#define PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(Joint)
SE3Tpl< Scalar, Options > Transformation_t
MotionTpl< double, 0 > Motion
Eigen::Matrix< Scalar, NV, NV, Options > D_t
EIGEN_DONT_INLINE void calc(JointDataDerived &data, const typename Eigen::PlainObjectBase< ConfigVector > &qs) const
EIGEN_DONT_INLINE void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs, const typename Eigen::MatrixBase< TangentVector > &vs) const
JointMotion __mult__(const Eigen::MatrixBase< Vector6Like > &vj) const
MotionTpl< Scalar, Options > Motion_t
static std::string classname()
SE3Tpl< S1, O1 >::ActionMatrixType ReturnType
void forwardKinematics(Transformation_t &M, const Eigen::MatrixBase< ConfigVectorLike > &q_joint) const
PINOCCHIO_JOINT_CAST_TYPE_SPECIALIZATION(JointModelFreeFlyerTpl)
void calc_aba(JointDataDerived &data, const Eigen::MatrixBase< Matrix6Like > &I, const bool update_I) const
JointFreeFlyerTpl< Scalar, Options > JointDerived
Eigen::Matrix< Scalar, 6, NV, Options > UD_t
Eigen::Matrix< Scalar, 6, NV, Options > U_t
JointModelBase< JointModelFreeFlyerTpl > Base
JointModelFreeFlyerTpl< NewScalar, Options > cast() const
Main pinocchio namespace.
EIGEN_DONT_INLINE void calc(JointDataDerived &data, const typename Eigen::MatrixBase< Vector3Derived > &trans, const typename Eigen::QuaternionBase< QuaternionDerived > &quat) const
void setIndexes(JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel, JointIndex id, int q, int v)
Visit a JointModelTpl through JointSetIndexesVisitor to set the indexes of the joint in the kinematic...
PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR Constraint_t S
Common traits structure to fully define base classes for CRTP.
bool isEqual(const ConstraintIdentityTpl &) const
TransposeConst transpose() const
PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE typedef Eigen::Matrix< Scalar, NQ, 1, Options > ConfigVector_t
#define PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(DERIVED)
ActionMatrixType toActionMatrixInverse() const
The action matrix of .
SE3Tpl< S1, O1 >::ActionMatrixType ReturnType
ActionMatrixType toActionMatrix() const
MultiplicationOp< InertiaTpl< Scalar, Options >, ConstraintDerived >::ReturnType operator*(const InertiaTpl< Scalar, Options > &Y, const ConstraintBase< ConstraintDerived > &constraint)
.
MotionTpl< Scalar, Options > JointMotion
Eigen::Matrix< Scalar, NV, 1, Options > TangentVector_t
std::string shortname() const
JointModelFreeFlyerTpl< Scalar, Options > JointModelDerived
ForceDense< Derived >::ToVectorConstReturnType operator*(const ForceDense< Derived > &phi)
#define PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(Joint)