6 #ifndef __pinocchio_joint_prismatic_unaligned_hpp__ 7 #define __pinocchio_joint_prismatic_unaligned_hpp__ 9 #include "pinocchio/macros.hpp" 10 #include "pinocchio/multibody/joint/joint-base.hpp" 11 #include "pinocchio/multibody/joint/joint-translation.hpp" 12 #include "pinocchio/multibody/constraint.hpp" 13 #include "pinocchio/spatial/inertia.hpp" 14 #include "pinocchio/math/matrix.hpp" 22 template<
typename Scalar,
int Options>
28 template<
typename Scalar,
int Options,
typename MotionDerived>
34 template<
typename _Scalar,
int _Options>
39 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
40 typedef Eigen::Matrix<Scalar,6,1,Options>
Vector6;
41 typedef Eigen::Matrix<Scalar,6,6,Options>
Matrix6;
57 template<
typename _Scalar,
int _Options>
59 :
MotionBase < MotionPrismaticUnalignedTpl<_Scalar,_Options> >
61 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
66 template<
typename Vector3Like,
typename S2>
69 : m_axis(axis), m_v(v)
70 { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3); }
72 inline PlainReturnType
plain()
const 74 return PlainReturnType(m_axis*m_v,
75 PlainReturnType::Vector3::Zero());
78 template<
typename OtherScalar>
84 template<
typename Derived>
87 other.
linear() += m_axis * m_v;
90 template<
typename Derived>
93 other.
linear().noalias() = m_axis*m_v;
97 template<
typename S2,
int O2,
typename D2>
104 template<
typename S2,
int O2>
108 se3Action_impl(m,res);
112 template<
typename S2,
int O2,
typename D2>
122 template<
typename S2,
int O2>
126 se3ActionInverse_impl(m,res);
130 template<
typename M1,
typename M2>
141 template<
typename M1>
151 return m_axis == other.
m_axis && m_v == other.
m_v;
157 const Vector3 &
axis()
const {
return m_axis; }
158 Vector3 &
axis() {
return m_axis; }
166 template<
typename Scalar,
int Options,
typename MotionDerived>
167 inline typename MotionDerived::MotionPlain
170 typedef typename MotionDerived::MotionPlain
ReturnType;
174 template<
typename MotionDerived,
typename S2,
int O2>
175 inline typename MotionDerived::MotionPlain
184 template<
typename _Scalar,
int _Options>
199 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
202 template<
typename Scalar,
int Options>
206 template<
typename Scalar,
int Options,
typename MotionDerived>
210 template<
typename Scalar,
int Options,
typename ForceDerived>
214 typedef Eigen::Matrix<typename PINOCCHIO_EIGEN_DOT_PRODUCT_RETURN_TYPE(Vector3,typename ForceDense<ForceDerived>::ConstAngularType),1,1,
Options>
ReturnType;
217 template<
typename Scalar,
int Options,
typename ForceSet>
222 typename Eigen::MatrixBase<const ForceSet>::template NRowsBlockXpr<3>::Type
226 template<
typename _Scalar,
int _Options>
228 :
ConstraintBase< ConstraintPrismaticUnalignedTpl<_Scalar,_Options> >
230 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
239 template<
typename Vector3Like>
242 { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3); }
244 template<
typename Vector1Like>
245 JointMotion
__mult__(
const Eigen::MatrixBase<Vector1Like> &
v)
const 247 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector1Like,1);
248 return JointMotion(m_axis,v[0]);
251 template<
typename S1,
int O1>
262 template<
typename S1,
int O1>
280 template<
typename ForceDerived>
291 template<
typename ForceSet>
295 EIGEN_STATIC_ASSERT(ForceSet::RowsAtCompileTime==6,THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE)
297 return ref.
axis().transpose() * F.template middleRows<3>(LINEAR);
313 S.template segment<3>(LINEAR) = m_axis;
314 S.template segment<3>(ANGULAR).setZero();
318 template<
typename MotionDerived>
322 res.template segment<3>(LINEAR).noalias() = v.
angular().cross(m_axis);
323 res.template segment<3>(ANGULAR).setZero();
328 const Vector3 &
axis()
const {
return m_axis; }
329 Vector3 &
axis() {
return m_axis; }
333 return m_axis == other.
m_axis;
342 template<
typename S1,
int O1,
typename S2,
int O2>
351 template<
typename S1,
int O1,
typename S2,
int O2>
358 static inline ReturnType
run(
const Inertia & Y,
359 const Constraint & cpu)
363 const S1 & m = Y.
mass();
364 const typename Inertia::Vector3 &
c = Y.
lever();
366 res.template segment<3>(Constraint::LINEAR).noalias() = m*cpu.
axis();
367 res.template segment<3>(Constraint::ANGULAR).noalias() = c.cross(res.template segment<3>(Constraint::LINEAR));
374 template<
typename M6Like,
typename Scalar,
int Options>
388 template<
typename M6Like,
typename Scalar,
int Options>
393 static inline ReturnType
run(
const Eigen::MatrixBase<M6Like> & Y,
394 const Constraint & cru)
396 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(M6Like,6,6);
397 return Y.derived().template middleCols<3>(Constraint::LINEAR) * cru.
axis();
404 template<
typename _Scalar,
int _Options>
421 typedef Eigen::Matrix<Scalar,6,NV,Options>
U_t;
422 typedef Eigen::Matrix<Scalar,NV,NV,Options>
D_t;
423 typedef Eigen::Matrix<Scalar,6,NV,Options>
UD_t;
431 template<
typename Scalar,
int Options>
435 template<
typename _Scalar,
int _Options>
437 :
public JointDataBase< JointDataPrismaticUnalignedTpl<_Scalar,_Options> >
439 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
455 : M(Transformation_t::Vector3::Zero())
456 , S(Constraint_t::Vector3::Zero())
457 , v(Constraint_t::Vector3::Zero(),(
Scalar)0)
460 , UDinv(UD_t::Zero())
463 template<
typename Vector3Like>
468 , U(), Dinv(), UDinv()
471 static std::string
classname() {
return std::string(
"JointDataPrismaticUnaligned"); }
476 template<
typename Scalar,
int Options>
481 template<
typename _Scalar,
int _Options>
483 :
public JointModelBase< JointModelPrismaticUnalignedTpl<_Scalar,_Options> >
485 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
495 typedef Eigen::Matrix<Scalar,3,1,_Options>
Vector3;
504 assert(
isUnitary(
axis) &&
"Translation axis is not unitary");
507 template<
typename Vector3Like>
511 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Vector3Like);
512 assert(
isUnitary(axis) &&
"Translation axis is not unitary");
523 template<
typename ConfigVector>
524 void calc(JointDataDerived & data,
525 const typename Eigen::MatrixBase<ConfigVector> & qs)
const 528 const Scalar &
q = qs[
idx_q()];
530 data.M.translation().noalias() =
axis *
q;
533 template<
typename ConfigVector,
typename TangentVector>
534 void calc(JointDataDerived & data,
535 const typename Eigen::MatrixBase<ConfigVector> & qs,
536 const typename Eigen::MatrixBase<TangentVector> & vs)
const 538 calc(data,qs.derived());
541 const S2 &
v = vs[
idx_v()];
542 data.v.linearRate() =
v;
545 template<
typename Matrix6Like>
546 void calc_aba(JointDataDerived & data,
const Eigen::MatrixBase<Matrix6Like> & I,
const bool update_I)
const 548 data.U.noalias() = I.template block<6,3> (0,Inertia::LINEAR) *
axis;
549 data.Dinv[0] =
Scalar(1)/
axis.dot(data.U.template segment <3> (Inertia::LINEAR));
550 data.UDinv.noalias() = data.U * data.Dinv;
556 static std::string
classname() {
return std::string(
"JointModelPrismaticUnaligned"); }
560 template<
typename NewScalar>
564 ReturnType
res(
axis.template cast<NewScalar>());
579 #include <boost/type_traits.hpp> 583 template<
typename Scalar,
int Options>
585 :
public integral_constant<bool,true> {};
587 template<
typename Scalar,
int Options>
589 :
public integral_constant<bool,true> {};
591 template<
typename Scalar,
int Options>
593 :
public integral_constant<bool,true> {};
595 template<
typename Scalar,
int Options>
597 :
public integral_constant<bool,true> {};
601 #endif // ifndef __pinocchio_joint_prismatic_unaligned_hpp__ JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
static ReturnType run(const Eigen::MatrixBase< M6Like > &Y, const Constraint &cru)
Forward declaration of the multiplication operation return type. Should be overloaded, otherwise it will procude a compilation error.
void se3ActionInverse_impl(const SE3Tpl< S2, O2 > &m, MotionDense< D2 > &v) const
JointModelPrismaticUnalignedTpl< Scalar, Options > JointModelDerived
Constraint::Vector3 Vector3
JointMotion __mult__(const Eigen::MatrixBase< Vector1Like > &v) const
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
const Vector3 ConstLinearType
traits< ConstraintPrismaticUnalignedTpl< Scalar, Options > >::Vector3 Vector3
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointPrismaticUnalignedTpl< _Scalar, _Options > JointDerived
std::string shortname() const
MotionPrismaticUnalignedTpl()
int idx_q(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxQVisitor to get the index in the full model configuration space...
ConstraintPrismaticUnalignedTpl< Scalar, Options > Constraint_t
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...
void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs) const
Return type of the Constraint::Transpose * ForceSet operation.
Return type of the ation of a Motion onto an object of type D.
#define MOTION_TYPEDEF_TPL(Derived)
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
Eigen::Matrix< Scalar, 6, 1, Options > ReturnType
JointDataDerived createData() const
const MatrixMatrixProduct< M6LikeColsNonConst, Vector3 >::type ReturnType
JointIndex id(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdVisitor to get the index of the joint in the kinematic chain...
#define PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
JointModelBase< JointModelPrismaticUnalignedTpl > Base
const ConstraintPrismaticUnalignedTpl & ref
void setTo(MotionDense< Derived > &other) const
MotionTpl< Scalar, Options > ReturnType
ConstraintPrismaticUnalignedTpl()
bool isEqual(const JointModelPrismaticUnalignedTpl &other) const
Eigen::Matrix< typename PINOCCHIO_EIGEN_DOT_PRODUCT_RETURN_TYPE(Vector3, typename ForceDense< ForceDerived >::ConstAngularType), 1, 1, Options > ReturnType
const Vector3 & axis() const
PlainReturnType plain() const
const Vector3 ConstAngularType
JointModelPrismaticUnalignedTpl(const Scalar &x, const Scalar &y, const Scalar &z)
bool isEqual(const ConstraintPrismaticUnalignedTpl &other) const
bool isEqual(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel_generic, const JointModelBase< JointModelDerived > &jmodel)
Visit a JointModelTpl<Scalar,...> to compare it to JointModelDerived.
InertiaTpl< S1, O1 > Inertia
SizeDepType< 3 >::ColsReturn< M6Like >::ConstType M6LikeCols
MultiplicationOp< Inertia, Constraint >::ReturnType ReturnType
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
bool isUnitary(const Eigen::MatrixBase< MatrixLike > &mat, const typename MatrixLike::RealScalar &prec=Eigen::NumTraits< typename MatrixLike::Scalar >::dummy_precision())
Check whether the input matrix is Unitary within the given precision.
MotionDerived::MotionPlain operator+(const MotionPlanarTpl< Scalar, Options > &m1, const MotionDense< MotionDerived > &m2)
MotionPlain se3Action_impl(const SE3Tpl< S2, O2 > &m) const
bool isEqual_impl(const MotionPrismaticUnalignedTpl &other) const
DenseBase motionAction(const MotionDense< MotionDerived > &v) const
const DenseBase ConstMatrixReturnType
Eigen::Matrix< Scalar, 6, 1, Options > DenseBase
#define PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
ConstLinearType linear() const
Return the linear part of the force vector.
MultiplicationOp< Eigen::MatrixBase< M6Like >, Constraint >::ReturnType ReturnType
Eigen::internal::remove_const< M6LikeCols >::type M6LikeColsNonConst
ConstraintPrismaticUnalignedTpl< Scalar, Options > Constraint
static std::string classname()
const Vector3 & lever() const
const Vector3 & axis() const
static std::string classname()
MotionTpl< Scalar, Options > ReturnType
ConstLinearType linear() const
JointDataPrismaticUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis)
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
#define PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(Joint)
JointModelPrismaticUnalignedTpl()
MotionPlain se3ActionInverse_impl(const SE3Tpl< S2, O2 > &m) const
JointDataPrismaticUnalignedTpl< Scalar, Options > JointDataDerived
PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE typedef Eigen::Matrix< Scalar, NQ, 1, Options > ConfigVector_t
ConstraintPrismaticUnalignedTpl< S2, O2 > Constraint
Eigen::Matrix< Scalar, 6, 1, Options > ReturnType
MotionPlain motionAction(const MotionDense< M1 > &v) const
Eigen::Matrix< Scalar, NV, 1, Options > TangentVector_t
JointModelPrismaticUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis)
DenseBase MatrixReturnType
ConstraintPrismaticUnalignedTpl< Scalar, Options > Constraint
PINOCCHIO_JOINT_CAST_TYPE_SPECIALIZATION(JointModelFreeFlyerTpl)
ConstraintForceSetOp< ConstraintPrismaticUnalignedTpl, ForceSet >::ReturnType operator*(const Eigen::MatrixBase< ForceSet > &F)
Eigen::Matrix< Scalar, 3, 1, _Options > Vector3
MotionPrismaticUnalignedTpl __mult__(const OtherScalar &alpha) const
SE3GroupAction< ConstraintPrismaticUnalignedTpl >::ReturnType se3ActionInverse(const SE3Tpl< S1, O1 > &m) const
Eigen::Matrix< S2, 6, 1, O2 > ReturnType
TransformTranslationTpl< Scalar, Options > Transformation_t
const Scalar & linearRate() const
Eigen::Matrix< Scalar, 6, 1, Options > Vector6
MotionPrismaticUnalignedTpl< Scalar, Options > JointMotion
traits< ConstraintPrismaticUnalignedTpl >::Vector3 Vector3
#define PINOCCHIO_EIGEN_REF_TYPE(D)
TransposeConst transpose() const
JointModelPrismaticUnalignedTpl< NewScalar, Options > cast() const
MotionPrismaticUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis, const S2 &v)
PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR Transformation_t M
Main pinocchio namespace.
ReturnTypeNotDefined ReturnType
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...
void addTo(MotionDense< Derived > &other) const
Eigen::Matrix< Scalar, 6, NV, Options > UD_t
SE3GroupAction< ConstraintPrismaticUnalignedTpl >::ReturnType se3Action(const SE3Tpl< S1, O1 > &m) const
Eigen::Matrix< Scalar, NV, NV, Options > D_t
void motionAction(const MotionDense< M1 > &v, MotionDense< M2 > &mout) const
void calc_aba(JointDataDerived &data, const Eigen::MatrixBase< Matrix6Like > &I, const bool update_I) const
static ReturnType run(const Inertia &Y, const Constraint &cpu)
Common traits structure to fully define base classes for CRTP.
JointDataPrismaticUnalignedTpl()
JointPrismaticUnalignedTpl< Scalar, Options > JointDerived
std::string shortname() const
TransposeConst(const ConstraintPrismaticUnalignedTpl &ref)
#define PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(DERIVED)
Vector3 axis
3d main axis of the joint.
traits< ConstraintPrismaticUnalignedTpl< Scalar, Options > >::Vector3 Vector3
Eigen::ProductReturnType< M1, M2 >::Type type
MatrixMatrixProduct< Eigen::Transpose< const Vector3 >, typename Eigen::MatrixBase< const ForceSet >::template NRowsBlockXpr< 3 >::Type >::type ReturnType
MotionPrismaticUnalignedTpl< Scalar, Options > Motion_t
ConstAngularType angular() const
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Eigen::Matrix< Scalar, 6, NV, Options > U_t
static void motionAction(const MotionDense< MotionDerived > &v, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Action of a motion on a set of forces, represented by a 6xN matrix whose each column represent a spat...
DenseBase matrix_impl() const
MotionPrismaticUnalignedTpl< double > MotionPrismaticUnaligned
void se3Action_impl(const SE3Tpl< S2, O2 > &m, MotionDense< D2 > &v) const
MotionDerived::MotionPlain operator^(const MotionDense< MotionDerived > &m1, const MotionPlanarTpl< S2, O2 > &m2)
ConstraintPrismaticUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis)
void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs, const typename Eigen::MatrixBase< TangentVector > &vs) const
Return type of the Constraint::Transpose * Force operation.
MotionZeroTpl< Scalar, Options > Bias_t
ConstAngularRef rotation() const
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointPrismaticUnalignedTpl< _Scalar, _Options > JointDerived
ReturnTypeNotDefined ReturnType
MultiplicationOp< InertiaTpl< Scalar, Options >, ConstraintDerived >::ReturnType operator*(const InertiaTpl< Scalar, Options > &Y, const ConstraintBase< ConstraintDerived > &constraint)
.
Eigen::Matrix< Scalar, 1, 1, Options > JointForce
JointPrismaticUnalignedTpl< Scalar, Options > JointDerived
#define PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(Joint)