Error in quaternion multiplication functions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in quaternion multiplication functions

Huzaifa
Hello Rosen

I have observed an error in quatMult() and quatMultiply() routines in openravepy. I am using the latest openrave.

Here is the full scenario of what I am doing.

1. I convert these matrices to quaternions using quatFromRotationMatrix():  [ [0, -1, 0], [1, 0, 0], [0, 0, 1] ] and [ [0.8086, -0.0242, -0.5878], [-0.5883, -0.03339, -0.8079], [1.304e-8, 0.9991, -0.0412] ]

2. Then I multiply the resulting quaternions using quatMult() or quatMultiply()  (both give me the same result)

3. Now I change the result back to rotation matrix using  matrixFromQuat()

The result that I get is
[[  5.88338739e-01   3.33521134e-02   8.07926460e-01  ]
 [  8.08614573e-01  -2.42295397e-02  -5.87839606e-01  ]
 [ -3.00069472e-05   9.99149922e-01  -4.12241818e-02  ]]

whereas the result that I should get is
[[  5.88338739e-01   3.33521134e-02   8.07926460e-01  ]
 [  8.08614573e-01  -2.42295397e-02  -5.87839606e-01  ]
 [ 1.304e-8   9.99149922e-01  -4.12241818e-02  ]]

please take a look yourself
Reply | Threaded
Open this post in threaded view
|

Re: Error in quaternion multiplication functions

Rosen Diankov
Administrator
it looks like you are suffering from floating point precision. you should use 15 digits of precision when doing such multiplications.
you can check at the very end the determinant of the matrix (linalg.det) to see if it is exactly 1. i think the quaternion multiplication is more precise.


2014-09-10 16:16 GMT+09:00 Huzaifa <[hidden email]>:
Hello Rosen

I have observed an error in quatMult() and quatMultiply() routines in
openravepy. I am using the latest openrave.

Here is the full scenario of what I am doing.

1. I convert these matrices to quaternions using quatFromRotationMatrix():
[ [0, -1, 0], [1, 0, 0], [0, 0, 1] ] and [ [0.8086, -0.0242, -0.5878],
[-0.5883, -0.03339, -0.8079], [1.304e-8, 0.9991, -0.0412] ]

2. Then I multiply the resulting quaternions using quatMult() or
quatMultiply()  (both give me the same result)

3. Now I change the result back to rotation matrix using  matrixFromQuat()

The result that I get is
[[  5.88338739e-01   3.33521134e-02   8.07926460e-01  ]
 [  8.08614573e-01  -2.42295397e-02  -5.87839606e-01  ]
 [ *-3.00069472e-05*   9.99149922e-01  -4.12241818e-02  ]]

whereas the result that I *should* get is
[[  5.88338739e-01   3.33521134e-02   8.07926460e-01  ]
 [  8.08614573e-01  -2.42295397e-02  -5.87839606e-01  ]
 [* 1.304e-8*   9.99149922e-01  -4.12241818e-02  ]]

please take a look yourself



--
View this message in context: http://openrave-users-list.185357.n3.nabble.com/Error-in-quaternion-multiplication-functions-tp4027099.html
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users