# Jacobian for the rotation matrix (not quaternion) Classic List Threaded 3 messages Reply | Threaded
Open this post in threaded view
|

## Jacobian for the rotation matrix (not quaternion)

 Hi guys, For my current task at hand, I need to compute the Jacobian of the rotation matrix of a given link, i.e. a (3 x 3 x n) tensor, instead of the (4 x n) Jacobian of the quaternion representation. I can compute it using the (4 x 3 x 3 x 4) quaternion-to-rotation-matrix tensor (FYI, Python code below) but it is quite slow. Is it possible to access it directly from OpenRAVE? (And if not, could you add this feature?) Best, -Stéphane -- Python code -- C = quat_to_rot # C.shape == (4, 3, 3, 4) index = link.GetIndex() pose = link.GetTransformPose() quat, pos = pose[:4], pose[4:] J_trans = robot.CalculateJacobian(index, pos) # J_trans.shape == (3, n) J_quat = robot.CalculateRotationJacobian(index, quat) tens1 = dot(C, quat).transpose([1, 2, 0]) tens2 = tensordot(quat, C, axes=([0, 0])) J_rot = dot(tens1 + tens2, J_quat) # J_rot.shape == (3, 3, n) ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk_______________________________________________ Openrave-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openrave-users signature.asc (917 bytes) Download Attachment Stéphane Caron https://scaron.info
Reply | Threaded
Open this post in threaded view
|

## Re: Jacobian for the rotation matrix (not quaternion)

 Administrator hi Stéphane,you should be able to useRobot.CalculateAngularVelocityJacobianhope that helps,rosen, 2014-02-06 13:34 GMT+09:00 Stephane Caron : Hi guys, For my current task at hand, I need to compute the Jacobian of the rotation matrix of a given link, i.e. a (3 x 3 x n) tensor, instead of the (4 x n) Jacobian of the quaternion representation. I can compute it using the (4 x 3 x 3 x 4) quaternion-to-rotation-matrix tensor (FYI, Python code below) but it is quite slow. Is it possible to access it directly from OpenRAVE? (And if not, could you add this feature?) Best, -Stéphane -- Python code -- C = quat_to_rot # C.shape == (4, 3, 3, 4) index = link.GetIndex() pose = link.GetTransformPose() quat, pos = pose[:4], pose[4:] J_trans = robot.CalculateJacobian(index, pos) # J_trans.shape == (3, n) J_quat = robot.CalculateRotationJacobian(index, quat) tens1 = dot(C, quat).transpose([1, 2, 0]) tens2 = tensordot(quat, C, axes=([0, 0])) J_rot = dot(tens1 + tens2, J_quat) # J_rot.shape == (3, 3, n) ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk_______________________________________________ Openrave-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openrave-users ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk_______________________________________________ Openrave-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

## Re: Jacobian for the rotation matrix (not quaternion)

 Hi Rosen, Thanks for your answer, it helps! In my experiment, CalculateAngularVelocityJacobian is around 25% faster than CalculateRotationJacobian, and it yields simpler tensor computations (python below). Best, -Stéphane -- Python code -- G = rotation_vect_to_mat   # G.shape == (3, 3, 3) index = link.GetIndex() R = link.GetTransform()[0:3, 0:3] Jomega = robot.CalculateAngularVelocityJacobian(index) Jrot = tensordot(dot(G, Jomega), R, axes=([1, 0])).transpose([0, 2, 1]) # Jrot.shape == (3, 3, n) On 2014年02月06日 18:37, Rosen Diankov wrote: > hi Stéphane, > > you should be able to use > > Robot.CalculateAngularVelocityJacobian > > hope that helps, > rosen, > > > > 2014-02-06 13:34 GMT+09:00 Stephane Caron <[hidden email] > >: > >     Hi guys, > >     For my current task at hand, I need to compute the Jacobian of the >     rotation matrix of a given link, i.e. a (3 x 3 x n) tensor, instead of >     the (4 x n) Jacobian of the quaternion representation. > >     I can compute it using the (4 x 3 x 3 x 4) quaternion-to-rotation-matrix >     tensor (FYI, Python code below) but it is quite slow. Is it possible to >     access it directly from OpenRAVE? (And if not, could you add this >     feature?) > >     Best, > >     -Stéphane > > >     -- Python code -- > >     C = quat_to_rot >     # C.shape == (4, 3, 3, 4) >     index = link.GetIndex() >     pose = link.GetTransformPose() >     quat, pos = pose[:4], pose[4:] >     J_trans = robot.CalculateJacobian(index, pos) >     # J_trans.shape == (3, n) >     J_quat = robot.CalculateRotationJacobian(index, quat) >     tens1 = dot(C, quat).transpose([1, 2, 0]) >     tens2 = tensordot(quat, C, axes=([0, 0])) >     J_rot = dot(tens1 + tens2, J_quat) >     # J_rot.shape == (3, 3, n) > > >     ------------------------------------------------------------------------------ >     Managing the Performance of Cloud-Based Applications >     Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. >     Read the Whitepaper. >     http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk>     _______________________________________________ >     Openrave-users mailing list >     [hidden email] >     >     https://lists.sourceforge.net/lists/listinfo/openrave-users> > ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience.  Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk_______________________________________________ Openrave-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/openrave-users signature.asc (917 bytes) Download Attachment Stéphane Caron https://scaron.info