## Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:03:57 ```Hi Kyle, This is an excellent question. Because the sign flip represents the same rotation, you are correct that there is a redudancy. What this means is that the jacobian can take you in two possible directions: along the shortest arc, or along the longest arc. The only way to determine the correct sign is to know the source quaterion and the destination quaterion. In CalculateRotationJacobian, the source quaternion is: qsource = Manipulator.GetEndEffectorTransform().rot The destination quaternion is something you have in your program, and it isn't passed into CalculateRotationJacobian. Therefore, you'll need to flip the signs right after CalculateRotationJacobian returns using: if( (qdest-qsource).lengthsqr4() > (qdest+qsource).lengthsqr4() ) { mjacobian = -mjacobian; // or the equivalent } We could overload CalculateRotationJacobian to take in a qdest. Do you think that will make things more clear? rosen, 2011/4/28 Kyle Strabala : > Hello, > I'm trying to use the function "Manipulator.CalculateRotationJacobian" to do > some pseudo-inverse control on my robot's end-effector, but I'm having > trouble. For the control, I use changes in the quaternion multiplied by the > pseudo-inverse of the rotation jacobian to get necessary changes in the > joint angles. However, since quaternions are not unique I'm having trouble > determining the sign of the changes in the quaternion. One sign goes towards > my setpoint and the other goes away from it. > The "CalculateRotationJacobian" function calls > "CalculateActiveRotationJacobian" which uses a quaternion that I can't get, > so instead I use a quaternion which I calculate from > "Manipulator.GetEndEffectorTransform". The problem is that I have no way of > telling what sign the quaternion in CalculateRotationJacobian has, and thus > my quaternion often sends my end-effector in the wrong direction. > A few ideas: > 1)  Am I missing some way of calculating the quaternion used > in CalculateRotationJacobian? > 2)  Could the quaternion be changed to a unique vector? For example, always > having the w term positive? > 3)  I could always calculate my own rotation jacobian from the > angularvelocityjacobian function and my own quaternion. > Thanks for any help! > Kyle > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today.  Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > Openrave-users mailing list > Openrave-users@... > https://lists.sourceforge.net/lists/listinfo/openrave-users > > ```