How can I convert homogeneous transformation matrix into rigid3d object?

I got a homogeneous transformation matrix from 'getTransform' function in Robotics System Toolbox in order to use it to convert point clouds in end-effector frame to base frame by 'pctransform' function.(R2022a)
I tried to convert the homogeneous transform matrix into rigid3d object as below and pass it to 'pctransform', but it didn't return the expected result.
 
transform = getTransform( robot, confg, 'sourcebody', 'targetbody');
rot=tform2rotm(transform);
trvec=tform2trvec(transform);
tform=rigid3d(rot,trvec);
pcOut=pctransform(pcIn,tform);
What's wrong in the above process?

 Akzeptierte Antwort

In this case, you should transpose rotational matrix 'rot' as
>>tform=rigid3d(rot', trvec);
because 'getTransform' function and 'rigid3d' object implement homogeneous transformation matrix differently.
In 'getTransform' (and many engineering domain), homogeneous coordinates are expressed in column-vector form: [x; y; z; 1], and homogeneous transformation matrix G is defined as G = [Rot Tran; 0 0 0 1], being used as q = G*p (multiplied from left).
https://www.mathworks.com/help/robotics/ref/rigidbodytree.gettransform.html
On the opposite, 'rigid3d' (and some domains in CV) seems to use row-vector form coordinates: [x y z 1], and transformation matrix T means T = [Rot [0;0;0]; Tran 1] and s = r*T (multiplied from right).
https://jp.mathworks.com/help/images/ref/rigid3d.html
 
Obviously, the latter definition will be the same form as the former if transposing the entire equation, namely, s' = T' * r'.
If you create 'rigid3d' object by
>>tform=rigid3d(rot', trvec);
, transposed tform will be T' = [Rot' [0;0;0]; Tran 1]' = [Rot Tran; 0 0 0 1].

Weitere Antworten (0)

Produkte

Version

R2020b

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by