jrl-umi3218 / RBDyn

RBDyn provides a set of classes and functions to model the dynamics of rigid body systems.
BSD 2-Clause "Simplified" License
157 stars 47 forks source link

Planar Joint motion subspace seemed not configurable? #93

Closed zongyaojin closed 2 years ago

zongyaojin commented 2 years ago

Hello! Hope you're having a great week!

As the title indicated, I'm wondering if the Planar joint type only supports the default motion axes as listed in Prof. Featherstone's textbook P79, Table 4.1?

Since I noticed that there's this following part of code in src/RBDyn/RBDyn/Joint.h for constructing a Joint class:

inline void Joint::constructJoint(Type t, const Eigen::Vector3d & a)
{
  type_ = t;

  switch(t)
  {
    // ... input vector3d `a` for axis not used ...
    case Planar:
      S_ = Eigen::Matrix<double, 6, 3>::Zero();
      S_.block<3, 3>(2, 0).setIdentity();
      S_ *= dir_;
      params_ = 3;
      dof_ = 3;
      break;
    // ... input vector3d `a` for axis not used ...
  }
}

If that's the case, then, fixing it here other things should automatically work, is that right? Like other dynamics/kinematics computation would all be correct as long as the motion subspace is correctly configured?

Thank you very much in advance!

gergondet commented 2 years ago

Hi @zongyaojin

As the title indicated, I'm wondering if the Planar joint type only supports the default motion axes as listed in Prof. Featherstone's textbook P79, Table 4.1?

Yes. The Planar joint is allowes to move in the XY plane and rotate around the Z axis.

If that's the case, then, fixing it here other things should automatically work, is that right? Like other dynamics/kinematics computation would all be correct as long as the motion subspace is correctly configured?

Yes but you'd need a second parameter to define the plane correctly (e.g normal/vector). Planar joints are not very common in practice so you could also setup the joint frame so that it works with an X/Y plane.