Verified Commit 899f5772 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

joints/motions: add __mult__ operation for some joints

parent 51066ecf
......@@ -63,12 +63,21 @@ namespace pinocchio
template<typename Vector3Like, typename S2>
MotionPrismaticUnalignedTpl(const Eigen::MatrixBase<Vector3Like> & axis,
const S2 rate)
const S2 & rate)
: axis(axis), rate(rate)
{ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3); }
// operator MotionPlain() const
// { return MotionPlain(axis*rate,MotionPlain::Vector3::Zero());}
operator MotionPlain() const
{
return MotionPlain(axis*rate,
MotionPlain::Vector3::Zero());
}
template<typename OtherScalar>
MotionPrismaticUnalignedTpl __mult__(const OtherScalar & alpha) const
{
return MotionPrismaticUnalignedTpl(axis,alpha*rate);
}
template<typename Derived>
void addTo(MotionDense<Derived> & other) const
......
......@@ -53,7 +53,8 @@ namespace pinocchio
}; // struct traits MotionPrismaticTpl
template<typename _Scalar, int _Options, int _axis>
struct MotionPrismaticTpl : MotionBase < MotionPrismaticTpl<_Scalar,_Options,_axis> >
struct MotionPrismaticTpl
: MotionBase < MotionPrismaticTpl<_Scalar,_Options,_axis> >
{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
MOTION_TYPEDEF_TPL(MotionPrismaticTpl);
......@@ -66,7 +67,13 @@ namespace pinocchio
MotionPrismaticTpl() {}
MotionPrismaticTpl(const Scalar & v) : rate(v) {}
// inline operator MotionPlain() const { return Axis() * rate; }
inline operator MotionPlain() const { return Axis() * rate; }
template<typename OtherScalar>
MotionPrismaticTpl __mult__(const OtherScalar & alpha) const
{
return MotionPrismaticTpl(alpha*rate);
}
template<typename Derived>
void addTo(MotionDense<Derived> & other) const
......
......@@ -66,12 +66,18 @@ namespace pinocchio
: axis(axis)
, w(w)
{}
// operator MotionPlain() const
// {
// return MotionPlain(MotionPlain::Vector3::Zero(),
// axis*w);
// }
inline operator MotionPlain() const
{
return MotionPlain(MotionPlain::Vector3::Zero(),
axis*w);
}
template<typename OtherScalar>
MotionRevoluteUnalignedTpl __mult__(const OtherScalar & alpha) const
{
return MotionRevoluteUnalignedTpl(axis,alpha*w);
}
template<typename MotionDerived>
void addTo(MotionDense<MotionDerived> & v) const
......
......@@ -212,6 +212,12 @@ namespace pinocchio
operator MotionPlain() const { return Axis() * w; }
template<typename OtherScalar>
MotionRevoluteTpl __mult__(const OtherScalar & alpha) const
{
return MotionRevoluteTpl(alpha*w);
}
template<typename MotionDerived>
void setTo(MotionDense<MotionDerived> & m) const
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment