Re: Question about PmPose in posemath.h
On Tue, 29 Aug 2000 03:19:22 -0400 (EDT), Eding, Bert said:
>
>
> I guess this question is for a Fred to answer.
> Lately I am diving, at least trying to, in Kinematics.
> My question is about the definition of the PmPose structure, it is defined
> as:
>
> typedef struct
> {
> PmCartesian tran;
> PmQuaternion rot;
>
> } PmPose;
>
> while PmQuaternion and PmCartesian are defined as:
>
> typedef struct
> {
> double s, x, y, z;
>
> } PmQuaternion;
>
> typedef struct
> {
> double x, y, z;
>
> } PmCartesian;
>
>
> My question 1):
> Is the order of rotations defined by the "s" value or how is this done?
Quaternions are very weird. Everytime I think I understand them I later realize
I was turned around backwards/upside down and inside out :-). It is a
representation of the rotation that the computer can use for effecient
calculations but humans are ussually better off converting to something else.
s = the cosine of the half angle of rotation.
x,y,z = the unit vector of the rotation multiplied by the sine of the half
angle of rotation.
>
> I expect that the PmPose is entended to unique define a robots position,
> I have an understanding problem with the definition of the rotation.
> It is clear that the order of rotation is important,
> rotate x, then y is different from rotating y and then x.
>
> The reason that I ask is that in another mathe library that I have the pose
> is
> defined as:
>
> typedef struct
> {
> VECTOR pos;
> ORI ori;
> } POSE;
>
> Here VECTOR is the same as PmCartesian, but ORI is defined as:
> typedef struct
> {
> double e[3][3];
> } ORI;
>
> Here ORI is the rotation matrix, here I understand that the
> POSE structure does unique define the robots position, I do not understand
> this
> with the PmPose from the RCS-lib.
>
>
> My question 2):
> How can I convert from the PmQuaternion to a rotation matrix?
If your linking int the RCS library, (as you probably are if you are editing
something
EMC related) you can just call the function pmQuatMatConvert.
In case your not and need the actual source code to embed in something else,
here it is: (pmSq is just a macro that sqares its argument.)
int pmQuatMatConvert(PmQuaternion q, PmRotationMatrix * m)
{
#ifdef PM_DEBUG
if (! pmQuatIsNorm(q))
{
#ifdef PM_PRINT_ERROR
pmPrintError("Bad quaternion in pmQuatMatConvert\n");
#endif
return pmErrno = PM_NORM_ERR;
}
#endif
/* from space book where e1=q.x e2=q.y e3=q.z e4=q.s */
m->x.x = 1 - 2 * (pmSq(q.y) + pmSq(q.z));
m->y.x = 2 * (q.x * q.y - q.z * q.s);
m->z.x = 2 * (q.z * q.x + q.y * q.s);
m->x.y = 2 * (q.x * q.y + q.z * q.s);
m->y.y = 1 - 2 * (pmSq(q.z) + pmSq(q.x));
m->z.y = 2 * (q.y * q.z - q.x * q.s);
m->x.z = 2 * (q.z * q.x - q.y * q.s);
m->y.z = 2 * (q.y * q.z + q.x * q.s);
m->z.z = 1 - 2 * (pmSq(q.x) + pmSq(q.y));
return pmErrno = 0;
}
>
> Thanks in advance
> Bert Eding
>
>
>
>
>
--
-------------------------------------------------
William Penn Shackleford III shackle-at-nist.gov
National Institute of Standards & Technology Tel: (301) 975-4286
100 Bureau Drive Stop 8230 FAX: (301) 990-9688
Gaithersburg MD 20899 USA
http://www.isd.mel.nist.gov/personnel/shackleford/
Office Location: Bldg. 220 Rm A253
Date Index |
Thread Index |
Back to archive index |
Back to Mailing List Page
Problems or questions? Contact