Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_rav2xf

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_RAV2XF determines the state transformation matrix
   from a rotation matrix and the angular velocity of the
   rotation.

I/O


   Given:

      rot      a 3x3 double precision rotation matrix that gives the
               transformation from some frame FRAME1 to another frame FRAME2.

               help, rot
                  DOUBLE = Array[3,3]

      av       the double precision 3-vector angular velocity of the
               transformation.

               help, av
                  DOUBLE = Array[3]

               In other words, if `p' is the position of a fixed point in
               FRAME2, then from the point of view of FRAME1, `p' rotates (in a
               right handed sense) about an axis parallel to `av'. Moreover the
               rate of rotation in radians per unit time is given by the length
               of `av'.

               More formally, the velocity `v' of `p' in FRAME1 is
               given by
                                  T
                  v  =  av x ( rot  * p )

   the call:

      cspice_rav2xf, rot, av, xform

   returns:

      xform    a double precision, 6x6 state transformation matrix associated
               with `rot' and `av'.

               help, xform
                  DOUBLE = Array[6,6]

               If `s1' is the state of an object with respect to FRAME1, then
               the state `s2' of the object with respect to FRAME2 is given by

                  s2  =  xform * s1

               where "*" denotes Matrix-Vector multiplication.

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) The following example program uses cspice_ckgpav to get C-matrix
      and associated angular velocity vector for an image whose
      SCLK count (un-encoded character string version) is known.

      From that matrix and angular velocity vector, the associated
      state transformation matrix is obtained.

      Note that we need to load a SCLK kernel to convert from clock
      string to "ticks." Although not required for older spacecraft
      clocks, most modern spacecraft ones require a leapseconds
      kernel to be loaded in addition to a SCLK kernel.


      Use the meta-kernel shown below to load the required SPICE
      kernels.


         KPL/MK

         File name: rav2xf_ex1.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name              Contents
            --------------------   -----------------------
            cas00071.tsc           CASSINI SCLK
            04161_04164ra.bc       CASSINI spacecraft
                                   reconstructed CK

         \begindata

           KERNELS_TO_LOAD = ( 'cas00071.tsc'
                               '04161_04164ra.bc' )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO rav2xf_ex1

         ;;
         ;; Constants for this program.
         ;;
         ;; -- The code for the CASSINI spacecraft clock is -82.
         ;;
         ;; -- The code for CASSINI spacecraft reference frame is
         ;;    -82000.
         ;;
         ;; --  Spacecraft clock tolerance is 1.0 seconds. This may
         ;;    not be an acceptable tolerance for some applications.
         ;;    It must be converted to "ticks" (units of encoded
         ;;    SCLK) for input to cspice_ckgpav.
         ;;
         ;; -- The reference frame we want is J2000.
         ;;
         META   =   'rav2xf_ex1.tm'
         REFFRM =   'J2000'
         SCLKCH =   '1/1465476046.160'
         SCLTOL =   '1.0'
         SCID   =   -82L
         INSTID =   -82000L

         ;;
         ;; Load kernels.
         ;;
         cspice_furnsh, META

         ;;
         ;; Convert tolerance from CASSINI formatted character
         ;; string SCLK to ticks which are units of encoded SCLK.
         ;;
         cspice_sctiks, SCID, SCLTOL, toltik

         ;;
         ;; cspice_ckgpav requires encoded spacecraft clock.
         ;;
         cspice_scencd, SCID, SCLKCH, sclkdp

         cspice_ckgpav, INSTID, sclkdp, toltik, REFFRM,                      $
                        cmat,   av,     clkout, found

         ;;
         ;; Recall that `cmat' and `av' are the rotation and angular
         ;; velocity of the transformation from J2000 to the
         ;; spacecraft frame.
         ;;
         if ( found ) then begin

            ;;
            ;; Display `cmat' and `av'.
            ;;
            print, format='(A)', 'Rotation matrix:'
            print, format='(3F10.6)', cmat

            print, format='(A)', 'Angular velocity:'
            print, format='(3F20.16)', av

            ;;
            ;; Get state transformation from J2000 to the spacecraft
            ;; frame.
            ;;
            cspice_rav2xf, cmat, av, fxmat

            ;;
            ;; Display the results.
            ;;
            print
            print, format='(A)', 'State transformation matrix:'
            print, format='(6F10.6)', fxmat


         endif else begin

            print, 'No rotation matrix/angular velocity found for ', SCLKCH

         endelse

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Rotation matrix:
       -0.604984  0.796222 -0.005028
       -0.784160 -0.596891 -0.169748
       -0.138158 -0.098752  0.985475
      Angular velocity:
        0.0000032866819065 -0.0000099372638338  0.0000197597699770

      State transformation matrix:
       -0.604984  0.796222 -0.005028  0.000000  0.000000  0.000000
       -0.784160 -0.596891 -0.169748  0.000000  0.000000  0.000000
       -0.138158 -0.098752  0.985475  0.000000  0.000000  0.000000
       -0.000016 -0.000012 -0.000003 -0.604984  0.796222 -0.005028
        0.000013 -0.000015 -0.000010 -0.784160 -0.596891 -0.169748
       -0.000008 -0.000006 -0.000002 -0.138158 -0.098752  0.985475


   2) Compute a state transformation matrix from a rotation matrix
      for "elementary" frame rotations of 90 degrees about the Z axis
      and an angular velocity vector, convert that transformation
      matrix back to a rotation matrix and an angular velocity vector
      and compute the maximum value of the absolute difference between
      the rotation matrices and the angular velocity vectors.

      Numerical equivalence shall be expected.


      Example code begins here.


      PRO rav2xf_ex2

         ;;
         ;; Define an angular velocity vector:
         ;;
         e1     = [ 1.d, 0.d, 0.d ]

         ;;
         ;; Rotation matrix for "elementary" frame rotations:  90 degrees
         ;; about the z axes:
         ;;
         rz_90  = [ [ 0.d,  1.d,  0.d ],                                     $
                    [-1.d,  0.d,  0.d ],                                     $
                    [ 0.d,  0.d,  1.d ] ]

         ;;
         ;; The call cspice_rav2xf calculates the state transformation matrix
         ;; strans associated with the angular velocity vector and the
         ;; rotation matrix.
         ;;
         cspice_rav2xf, rz_90, e1, strans

         ;;
         ;; cspice_xf2rav converts a state transformation to the associated
         ;; rotation matrix and angular velocity vector - inverting
         ;; the operation of cspice_rav2xf
         ;;
         cspice_xf2rav, strans, rot, av

         ;;
         ;; Calculate the maximum value of the absolute difference between the
         ;; output `av' and `rot' vs the inputs `e1' and `rz_90'.
         ;;
         print, format='(A,F15.13)', 'Maximum absolute difference ' +        $
                                     'between rotation matrices : ',         $
                                      max( max( abs(rot - rz_90) ) )
         print, format='(A,F15.13)', 'Maximum absolute difference ' +        $
                                     'between angular velocities: ',         $
                                      max( max( abs(av - e1) ) )

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Maximum absolute difference between rotation matrices : 0.0000000000000
      Maximum absolute difference between angular velocities: 0.0000000000000


Particulars


   This routine is essentially a macro routine for converting
   a rotation and angular velocity of the rotation to the
   equivalent state transformation matrix.

   This routine is an inverse of cspice_xf2rav.

Exceptions


   1)  No checks are performed on `rot' to ensure that it is indeed
       a rotation matrix.

   2)  If any of the input arguments, `rot' or `av', is undefined, an
       error is signaled by the IDL error handling system.

   3)  If any of the input arguments, `rot' or `av', is not of the
       expected type, or it does not have the expected dimensions and
       size, an error is signaled by the Icy interface.

   4)  If the output argument `xform' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ
   ROTATION.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.2, 10-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard. Added first code
       example and created second code example from existing fragment.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       extended -Particulars section.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.1, 12-APR-2007 (EDW)

       Edit to abstract.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   State transformation to rotation and angular velocity



Fri Dec 31 18:43:06 2021