Open kiremicev opened 2 years ago
Hi,
In short, the joint's cJPos
and pJPos
contains the joint's position in child's local frame and parent's local frame respectively.
You can find these variables from joint instances by
RBJoint *joint = ...;
joint->cJPos;
joint->pJPos;
Thus, as the slide says, (v_inRB = p_inRB - joint.cjPos)
V3D v_inRB(joint->cJPos, p_inRB);
Hope this helps!
Thank you a lot!
I now used the following method to define the position:
robot->jointList[qIndex]->cJPos
I think this should work.
That should be correct, but please consider to use the GeneralizedCoordinatesRobotRepresentation::getJointForQIdx
member function instead of robot->jointList[qIndex]
.
Note In fact, they are doing the same thing in our use case, but in general it's better to use internal API's than just accessing member variables directly if that is possible; for instance, there could be some cases where qIndex
of joint and the index of joint in robot->jointList
does not coincide. In that case, we can implement getJointForQIdx
function that returns correct joint mapped to qIndex
.
But of course, I guarantee there would be no test case where robot->jointList[qIndex] != getJointForQIdx(qIndex)
.
Yes of course. I will try sticking with member functions. It is more convenient to use them anyways.
Thank you for the tip.
I want to implement the following function: According to the following sheet p_inRB is the same as pLocal in the code above. I need to get v_inRB, which is defined by p_inRB-pJoint_inRB in order to use rotateVec(v_inRB,q_j,axis_j). I would define it in the code as: V3D v_inRB(pJoint,pLocal) However, I am still missing the coordinates for the joint. How can I get the coordinates from a joint in the local frame?
Thank you in advance!