Rotation matrices

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Rotation matrices

Raquel Phillips
I discovered this morning that a rotation matrix given to the Octave/MATLAB function orBodySetTransform must be transposed in order to be used in the XML tag RotationMat for a KinBody.

For example, if the transform [ 1 2 3 4 5 6 7 8 9 10 11 12 ] is given to orBodySetTransform, the equivalent tags needed in a KinBody are

<Translation> 10 11 12 </Translation>
<RotationMat> 1 4 7 2 5 8 3 6 9 </RotationMat>

Is this some sort of limitation of MATLAB or just an overlooked inconsistency?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rotation matrices

Rosen Diankov-2
The transformation matrices are written and read in column order. The
reason for this is to be consistent with the way Matlab and Octave
order their matrices. One easy way to convert to the 3x4 matrix
representation from the 12 number is:

T = reshape(orBodyGetTransform(bodyid),[3 4])

In openrave, the << operator for TransformMatrix writes matrices in
the same column order format.

OpenRAVE assumes globally that anytime a rotation matrix or
transformation is serialized, it is in this format.

rosen,


2008/8/18 Raquel Phillips <[hidden email]>:

> I discovered this morning that a rotation matrix given to the Octave/MATLAB
> function orBodySetTransform must be transposed in order to be used in the
> XML tag RotationMat for a KinBody.
>
> For example, if the transform [ 1 2 3 4 5 6 7 8 9 10 11 12 ] is given to
> orBodySetTransform, the equivalent tags needed in a KinBody are
>
> <Translation> 10 11 12 </Translation>
> <RotationMat> 1 4 7 2 5 8 3 6 9 </RotationMat>
>
> Is this some sort of limitation of MATLAB or just an overlooked
> inconsistency?
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rotation matrices

Rosen Diankov-2
However the rotationmat field in XML wants a rotation matrix in row
order. I think to users, this format is more intuitive when writing
matrices in text. I agree that it confuses things a little, just like
the whole degree/radian issue. Whenever specifying an angle in XML,
you can only specify it in degrees. But beyond the XML format,
OpenRAVE only uses radians, and degrees are never specified anywhere.

One easy way to remember the format of a rotation matrix is:

- if a transformation matrix is requested (ie translation added to the
rotation matrix), then it will always be in column order
- if just a rotation matrix is requested (especially the rotationmat
field in XML), then it is in row order
- if a transformation has 12 values it is a transformation matrix
- if a transformation ha s7 values it is a quaternion (4 values) with
a translation

rosen,

2008/8/18 Rosen Diankov <[hidden email]>:

> The transformation matrices are written and read in column order. The
> reason for this is to be consistent with the way Matlab and Octave
> order their matrices. One easy way to convert to the 3x4 matrix
> representation from the 12 number is:
>
> T = reshape(orBodyGetTransform(bodyid),[3 4])
>
> In openrave, the << operator for TransformMatrix writes matrices in
> the same column order format.
>
> OpenRAVE assumes globally that anytime a rotation matrix or
> transformation is serialized, it is in this format.
>
> rosen,
>
>
> 2008/8/18 Raquel Phillips <[hidden email]>:
>> I discovered this morning that a rotation matrix given to the Octave/MATLAB
>> function orBodySetTransform must be transposed in order to be used in the
>> XML tag RotationMat for a KinBody.
>>
>> For example, if the transform [ 1 2 3 4 5 6 7 8 9 10 11 12 ] is given to
>> orBodySetTransform, the equivalent tags needed in a KinBody are
>>
>> <Translation> 10 11 12 </Translation>
>> <RotationMat> 1 4 7 2 5 8 3 6 9 </RotationMat>
>>
>> Is this some sort of limitation of MATLAB or just an overlooked
>> inconsistency?
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Openrave-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>
>>
>


Loading...