Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:03 ```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 > > ```

[OpenRAVE-users] Manipulator.CalculateRotationJacobian Kyle Strabala <strabala@cm...>
 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:03 ```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 > > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:06 ```Instead of negating the jacobian, you might want to negate qdest: if( (qdest-qsource).lengthsqr4() > (qdest+qsource).lengthsqr4() ) { qdest = -qdest. } That way you don't have to touch anything on the jacobian side.. rosen, 2011/4/28 Rosen Diankov : > 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 >> >> > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:08 ```Perhaps there's a proof for this, but it might be better to use dot products instead of euclidean distance: if( qdest.dot4(qsource) < 0 ) { qdest = -qdest. } 2011/4/28 Rosen Diankov : > Instead of negating the jacobian, you might want to negate qdest: > > if( (qdest-qsource).lengthsqr4() > (qdest+qsource).lengthsqr4()  ) { >  qdest = -qdest. > } > > That way you don't have to touch anything on the jacobian side.. > > rosen, > > 2011/4/28 Rosen Diankov : >> 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 >>> >>> >> > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Kyle Strabala - 2011-04-28 04:18 Attachments: Message as HTML ```It seems to me that my problem is solved if Manipulator.GetEndEffectorTransform().rot matches the input quaternion to CalculateActiveRotationJacobian [ quatMultiply(_pEndEffector->GetTransform().rot, _tGrasp.rot ]. I can check the sign or, as you suggest, distance or dot product to determine what sign my destination quaternion needs to be. Thanks for such a quick response! I'll post success if it works. Kyle On Thu, Apr 28, 2011 at 12:08 AM, Rosen Diankov Perhaps there's a proof for this, but it might be better to use dot > products instead of euclidean distance: > > if( qdest.dot4(qsource) < 0 ) { > qdest = -qdest. > } > > 2011/4/28 Rosen Diankov : > > Instead of negating the jacobian, you might want to negate qdest: > > > > if( (qdest-qsource).lengthsqr4() > (qdest+qsource).lengthsqr4() ) { > > qdest = -qdest. > > } > > > > That way you don't have to touch anything on the jacobian side.. > > > > rosen, > > > > 2011/4/28 Rosen Diankov : > >> 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 > >>> > >>> > >> > > > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:25 ```All the manipulator jacobian computations are with respect to the manipulator coordinate system, which is computed from Manipulator.GetEndEffectorTransform(). This is always EndEffectorLinkTransform * ManipulatorLocalCoordinateSystem rosen, 2011/4/28 Kyle Strabala : > It seems to me that my problem is solved > if Manipulator.GetEndEffectorTransform().rot matches the input quaternion > to CalculateActiveRotationJacobian [ > quatMultiply(_pEndEffector->GetTransform().rot, _tGrasp.rot ]. I can check > the sign or, as you suggest, distance or dot product to determine what sign > my destination quaternion needs to be. > Thanks for such a quick response! I'll post success if it works. > Kyle > On Thu, Apr 28, 2011 at 12:08 AM, Rosen Diankov > wrote: >> >> Perhaps there's a proof for this, but it might be better to use dot >> products instead of euclidean distance: >> >> if( qdest.dot4(qsource) < 0 ) { >>  qdest = -qdest. >> } >> >> 2011/4/28 Rosen Diankov : >> > Instead of negating the jacobian, you might want to negate qdest: >> > >> > if( (qdest-qsource).lengthsqr4() > (qdest+qsource).lengthsqr4()  ) { >> >  qdest = -qdest. >> > } >> > >> > That way you don't have to touch anything on the jacobian side.. >> > >> > rosen, >> > >> > 2011/4/28 Rosen Diankov : >> >> 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 >> >>> >> >>> >> >> >> > > > > ------------------------------------------------------------------------------ > 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 > > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Kyle Strabala - 2011-04-28 04:30 Attachments: Message as HTML ```Hi Rosen, i failed to mention that I'm doing this in Python, so Manipulator.GetEndEffectorTransform().rot does not seem to work. Is there another way to access this information? thanks, Kyle ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 04:36 ```Of course, openrave has one of the richest libraries in transformation conversions ;0) quatFromRotationMatrix(Manipulator.GetEndEffectorTransform()[0:3,0:3]) For more, check out all functions starting with 'quat', 'axisAngle', 'matrix', and 'pose' rosen, 2011/4/28 Kyle Strabala : > Hi Rosen, > i failed to mention that I'm doing this in Python, > so Manipulator.GetEndEffectorTransform().rot does not seem to work.  Is > there another way to access this information? > thanks, > Kyle > > > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Kyle Strabala - 2011-04-28 05:02 Attachments: Message as HTML ```I was previously using another library to convert from rotation matrix to quaternion, so I have changed to openrave's version. The problem persists and I can only guess that the problem is the following. Calculating a quaternion from a rotation matrix with quatFromRotationMatrix does not always produce the same quaternion as quatMultiply(_pEndEffector->GetTransform().rot, _tGrasp.rot). Is there anyway to directly calculate this expression in python? Kyle On Thu, Apr 28, 2011 at 12:36 AM, Rosen Diankov Of course, openrave has one of the richest libraries in transformation > conversions ;0) > > quatFromRotationMatrix(Manipulator.GetEndEffectorTransform()[0:3,0:3]) > > For more, check out all functions starting with 'quat', 'axisAngle', > 'matrix', and 'pose' > > rosen, > > 2011/4/28 Kyle Strabala : > > Hi Rosen, > > i failed to mention that I'm doing this in Python, > > so Manipulator.GetEndEffectorTransform().rot does not seem to work. Is > > there another way to access this information? > > thanks, > > Kyle > > > > > > > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 05:16 ```it should, because that's exactly what GetEndEffectorTransform() is doing underneath. try: qsource = quatFromRotationMatrix(manip.GetEndEffectorTransform()[0:3,0:3]) if dot(qsource,qdest) < 0: qdest = -qdest rosen, 2011/4/28 Kyle Strabala : > I was previously using another library to convert from rotation matrix to > quaternion, so I have changed to openrave's version. The problem persists > and I can only guess that the problem is the following. Calculating a > quaternion from a rotation matrix with quatFromRotationMatrix does not > always produce the same quaternion > as  quatMultiply(_pEndEffector->GetTransform().rot, _tGrasp.rot). Is there > anyway to directly calculate this expression in python? > Kyle > > On Thu, Apr 28, 2011 at 12:36 AM, Rosen Diankov > wrote: >> >> Of course, openrave has one of the richest libraries in transformation >> conversions ;0) >> >> quatFromRotationMatrix(Manipulator.GetEndEffectorTransform()[0:3,0:3]) >> >> For more, check out all functions starting with 'quat', 'axisAngle', >> 'matrix', and 'pose' >> >> rosen, >> >> 2011/4/28 Kyle Strabala : >> > Hi Rosen, >> > i failed to mention that I'm doing this in Python, >> > so Manipulator.GetEndEffectorTransform().rot does not seem to work.  Is >> > there another way to access this information? >> > thanks, >> > Kyle >> > >> > >> > > > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 05:17 ```If the problem persists, please send example code we can reproduce it with. thanks, rosen, 2011/4/28 Rosen Diankov : > it should, because that's exactly what GetEndEffectorTransform() is > doing underneath. > > try: > > qsource = quatFromRotationMatrix(manip.GetEndEffectorTransform()[0:3,0:3]) > if dot(qsource,qdest) < 0: >    qdest = -qdest > > rosen, > > 2011/4/28 Kyle Strabala : >> I was previously using another library to convert from rotation matrix to >> quaternion, so I have changed to openrave's version. The problem persists >> and I can only guess that the problem is the following. Calculating a >> quaternion from a rotation matrix with quatFromRotationMatrix does not >> always produce the same quaternion >> as  quatMultiply(_pEndEffector->GetTransform().rot, _tGrasp.rot). Is there >> anyway to directly calculate this expression in python? >> Kyle >> >> On Thu, Apr 28, 2011 at 12:36 AM, Rosen Diankov >> wrote: >>> >>> Of course, openrave has one of the richest libraries in transformation >>> conversions ;0) >>> >>> quatFromRotationMatrix(Manipulator.GetEndEffectorTransform()[0:3,0:3]) >>> >>> For more, check out all functions starting with 'quat', 'axisAngle', >>> 'matrix', and 'pose' >>> >>> rosen, >>> >>> 2011/4/28 Kyle Strabala : >>> > Hi Rosen, >>> > i failed to mention that I'm doing this in Python, >>> > so Manipulator.GetEndEffectorTransform().rot does not seem to work.  Is >>> > there another way to access this information? >>> > thanks, >>> > Kyle >>> > >>> > >>> > >> >> > ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Kyle Strabala - 2011-04-28 15:31 Attachments: Message as HTML ```I could not get the quaternion derived from GetEndEffectorTransform to reliably match the quaternion used in CalculateRotationJacobian, but I was able to find a way to get the quaternion jacobian. My solution is as follows (uses numpy): robot_hand_transform = orRobot.GetManipulators()[0].GetEndEffectorTransform() robot_hand_quat = array(quatFromRotationMatrix(robot_hand_transform[0:3,0:3])) jac_ang_vel = array( orRobot.GetManipulators()[0].CalculateAngularVelocityJacobian() ) qw = robot_hand_quat[0]; qx = robot_hand_quat[1]; qy = robot_hand_quat[2]; qz = robot_hand_quat[3]; jac_quat = dot( 0.5*array( [ [-qx,-qy,-qz], [qw,qz,-qy], [-qz,qw,qx], [qy,-qx,qw] ] ) , jac_ang_vel ) Kyle ```

 Re: [OpenRAVE-users] Manipulator.CalculateRotationJacobian From: Rosen Diankov - 2011-04-28 15:54 Attachments: jacobian.py ```Hi Kyle, I did some tests (attaching script), it turns out that Robot.CalculateActiveRotationJacobian was actually calling CalculateActiveJacobian, which was giving wrong results (if you are using the ros openrave package, it has been updated). However, Manipulation.CalculateRotationJacobian should be correct. The script tests the manipulator rotation jacobian with the one computed directly from the robot. The printed number should be very close to 0. rosen, 2011/4/29 Kyle Strabala : > I could not get the quaternion derived from GetEndEffectorTransform to > reliably match the quaternion used in CalculateRotationJacobian, but I was > able to find a way to get the quaternion jacobian. My solution is as follows > (uses numpy): > robot_hand_transform = > orRobot.GetManipulators()[0].GetEndEffectorTransform() > robot_hand_quat = > array(quatFromRotationMatrix(robot_hand_transform[0:3,0:3])) > jac_ang_vel = array( > orRobot.GetManipulators()[0].CalculateAngularVelocityJacobian() ) > qw = robot_hand_quat[0]; qx = robot_hand_quat[1]; qy = robot_hand_quat[2]; > qz = robot_hand_quat[3]; > jac_quat = dot( 0.5*array( [ [-qx,-qy,-qz], [qw,qz,-qy], [-qz,qw,qx], > [qy,-qx,qw] ] ) , jac_ang_vel ) > Kyle ```