eul2xf |
Table of contents
ProcedureEUL2XF ( Euler angles and derivative to transformation ) ENTRY EUL2XF ( EULANG, AXISA, AXISB, AXISC, XFORM ) AbstractCompute a state transformation from an Euler angle factorization of a rotation and the derivatives of those Euler angles. Required_ReadingROTATION KeywordsANGLES DERIVATIVES STATE DeclarationsDOUBLE PRECISION EULANG ( 6 ) INTEGER AXISA INTEGER AXISB INTEGER AXISC DOUBLE PRECISION XFORM ( 6, 6 ) Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- EULANG I An array of Euler angles and their derivatives. AXISA I Axis A of the Euler angle factorization. AXISB I Axis B of the Euler angle factorization. AXISC I Axis C of the Euler angle factorization. XFORM O A state transformation matrix. Detailed_InputEULANG is the set of Euler angles corresponding to the specified factorization. If we represent R as shown here: R = [ ALPHA ] [ BETA ] [ GAMMA ] AXISA AXISB AXISC then EULANG(1) = ALPHA EULANG(2) = BETA EULANG(3) = GAMMA EULANG(4) = dALPHA/dt EULANG(5) = dBETA/dt EULANG(6) = dGAMMA/dt AXISA, AXISB, AXISC are the axes desired for the factorization of R. All must be in the range from 1 to 3. Moreover it must be the case that AXISA and AXISB are distinct and that AXISB and AXISC are distinct. Every rotation matrix can be represented as a product of three rotation matrices about the principal axes of a reference frame. R = [ ALPHA ] [ BETA ] [ GAMMA ] AXISA AXISB AXISC The value 1 corresponds to the X axis. The value 2 corresponds to the Y axis. The value 3 corresponds to the Z axis. Detailed_OutputXFORM is the state transformation matrix corresponding to R and dR/dt as described above. Pictorially, .- -. | | | | R | 0 | | | | |-------+-------| | | | | dR/dt | R | | | | `- -' where R is a rotation matrix that varies with respect to time and dR/dt is its time derivative. ParametersNone. Exceptions1) If any of AXISA, AXISB, or AXISC do not have values in { 1, 2, 3 } an error is signaled by a routine in the call tree of this routine. FilesNone. ParticularsA word about notation: the symbol [ x ] i indicates a coordinate system rotation of x radians about the ith coordinate axis. To be specific, the symbol [ x ] 1 indicates a coordinate system rotation of x radians about the first, or x-, axis; the corresponding matrix is .- -. | 1 0 0 | | | | 0 cos(x) sin(x) | | | | 0 -sin(x) cos(x) | `- -' Remember, this is a COORDINATE SYSTEM rotation by x radians; this matrix, when applied to a vector, rotates the vector by -x radians, not x radians. Applying the matrix to a vector yields the vector's representation relative to the rotated coordinate system. The analogous rotation about the second, or y-, axis is represented by [ x ] 2 which symbolizes the matrix .- -. | cos(x) 0 -sin(x) | | | | 0 1 0 | | | | sin(x) 0 cos(x) | `- -' and the analogous rotation about the third, or z-, axis is represented by [ x ] 3 which symbolizes the matrix .- -. | cos(x) sin(x) 0 | | | | -sin(x) cos(x) 0 | | | | 0 0 1 | `- -' The input matrix is assumed to be the product of three rotation matrices, each one of the form .- -. | 1 0 0 | | | | 0 cos(r) sin(r) | (rotation of r radians about the | | x-axis), | 0 -sin(r) cos(r) | `- -' .- -. | cos(s) 0 -sin(s) | | | | 0 1 0 | (rotation of s radians about the | | y-axis), | sin(s) 0 cos(s) | `- -' or .- -. | cos(t) sin(t) 0 | | | | -sin(t) cos(t) 0 | (rotation of t radians about the | | z-axis), | 0 0 1 | `- -' where the second rotation axis is not equal to the first or third. Any rotation matrix can be factored as a sequence of three such rotations, provided that this last criterion is met. This routine is intended to provide an inverse for XF2EUL. The two subroutine calls shown here will not change XFORM except for round off errors. CALL XF2EUL ( XFORM, AXISA, AXISB, AXISC, EULANG, UNIQUE ) CALL EUL2XF ( EULANG, AXISA, AXISB, AXISC, XFORM ) On the other hand the two calls CALL EUL2XF ( EULANG, AXISA, AXISB, AXISC, XFORM ) CALL XF2EUL ( XFORM, AXISA, AXISB, AXISC, EULANG, UNIQUE ) will leave EULANG unchanged only if the components of EULANG are in the range produced by XF2EUL and the Euler representation of the rotation component of XFORM is unique within that range. ExamplesThe numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation. 1) Suppose you have a set of Euler angles and their derivatives for a 3 1 3 rotation, and that you would like to determine the equivalent angles and derivatives for a 1 2 3 rotation. R = [ALPHA] [BETA] [GAMMA] 3 1 3 R = [ROLL] [PITCH] [YAW] 1 2 3 The following code example will perform the desired computation. Example code begins here. PROGRAM EUL2XF_EX1 IMPLICIT NONE C C Local variables. C DOUBLE PRECISION ABGANG ( 6 ) DOUBLE PRECISION RPYANG ( 6 ) DOUBLE PRECISION XFORM ( 6, 6 ) LOGICAL UNIQUE C C Define the initial set of Euler angles. C ABGANG(1) = 0.01D0 ABGANG(2) = 0.03D0 ABGANG(3) = 0.09D0 ABGANG(4) = -0.001D0 ABGANG(5) = -0.003D0 ABGANG(6) = -0.009D0 C C Compute the equivalent angles and derivatives for a C 1-2-3 rotation. C CALL EUL2XF ( ABGANG, 3, 1, 3, XFORM ) CALL XF2EUL ( XFORM, 1, 2, 3, RPYANG, UNIQUE ) IF ( UNIQUE ) THEN WRITE(*,'(A)') '1-2-3 equivalent rotation to input ' . // '(radians):' WRITE(*,'(2(A,F13.9))') 'Roll ', RPYANG(1), . ', dRoll/dt ', RPYANG(4) WRITE(*,'(2(A,F13.9))') 'Pitch ', RPYANG(2), . ', dPitch/dt ', RPYANG(5) WRITE(*,'(2(A,F13.9))') 'Yaw ', RPYANG(3), . ', dYaw/dt ', RPYANG(6) ELSE WRITE(*,*) 'The values in RPYANG are not uniquely ' . // 'determined.' END IF END When this program was executed on a Mac/Intel/gfortran/64-bit platform, the output was: 1-2-3 equivalent rotation to input (radians): Roll 0.029998501, dRoll/dt -0.002999550 Pitch -0.000299950, dPitch/dt 0.000059980 Yaw 0.099995501, dYaw/dt -0.009998650 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) W.L. Taber (JPL) E.D. Wright (JPL) VersionSPICELIB Version 2.1.0, 26-OCT-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. Added complete code example based on existing fragment. SPICELIB Version 2.0.1, 25-APR-2007 (EDW) Corrected code in $Examples section, example showed a XF2EUL call: CALL XF2EUL ( XFORM, 1, 2, 3, RPYANG ) The proper form of the call: CALL XF2EUL ( XFORM, 1, 2, 3, RPYANG, UNIQUE ) SPICELIB Version 2.0.0, 31-OCT-2005 (NJB) Restriction that second axis must differ from both the first and third axes was removed. SPICELIB Version 1.0.0, 31-JUL-1995 (WLT) |
Fri Dec 31 18:36:21 2021