Table of contents
CKFROT ( CK frame, find position rotation )
SUBROUTINE CKFROT ( INST, ET, ROTATE, REF, FOUND )
Find the position rotation matrix from a C-kernel (CK) frame with
the specified frame class ID (CK ID) to the base frame of the
highest priority CK segment containing orientation data for this
CK frame at the time requested.
DOUBLE PRECISION ET
DOUBLE PRECISION ROTATE ( 3, 3 )
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
INST I Frame class ID (CK ID) of a CK frame.
ET I Epoch measured in seconds past J2000 TDB.
ROTATE O Rotation matrix from CK frame to frame REF.
REF O Frame ID of the base reference.
FOUND O .TRUE. when requested pointing is available.
INST is the unique frame class ID (CK ID) of the CK frame for
which data is being requested.
ET is the epoch for which the position rotation is desired.
ET should be given in seconds past the epoch of J2000
ROTATE is a position rotation matrix that converts positions
relative to the CK frame given by its frame class ID,
INST, to positions relative to the base frame given by
its frame ID, REF.
Thus, if a position S has components x,y,z in the CK
frame, then S has components x', y', z' in the base
.- -. .- -. .- -.
| x' | | | | x |
| y' | = | ROTATE | | y |
| z' | | | | z |
`- -' `- -' `- -'
REF is the ID code of the base reference frame to which
ROTATE will transform positions.
FOUND is .TRUE. if a record was found to satisfy the pointing
request. FOUND will be .FALSE. otherwise.
1) If no CK files were loaded prior to calling this routine, an
error is signaled by a routine in the call tree of this
2) If no SCLK correlation data needed to read CK files were
loaded prior to calling this routine, an error is signaled by
a routine in the call tree of this routine.
3) If the input time ET cannot be converted to an encoded SCLK
time, using SCLK data associated with INST, an error is
signaled by a routine in the call tree of this routine.
CKFROT searches through loaded CK files to locate a segment that
can satisfy the request for position rotation data for the CK
frame with the specified frame class ID at time ET. You must load
a CK file containing such data before calling this routine. You
must also load SCLK and possibly LSK files needed to convert the
input ET time to the encoded SCLK time with which the orientation
data stored inside that CK is tagged.
CKFROT searches through loaded CK files to satisfy a pointing
request. Last-loaded files are searched first, and individual
files are searched in backwards order, giving priority to
segments that were added to a file later than the others.
The search ends when a segment is found that can give pointing
for the specified CK frame at the request time.
Segments with and without angular velocities are considered by
This routine uses the CKMETA routine to determine the SCLK ID
used to convert the input ET time to the encoded SCLK time used
to look up pointing data in loaded CK files.
The 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) Use CKFROT to compute the instantaneous angular velocity
vector for the Mars Global Surveyor (MGS) spacecraft frame,
'MGS_SPACECRAFT', relative to the inertial frame used as the
base frame in CK files containing MGS spacecraft orientation
at 2003-JUL-25 13:00:00. The frame class ID (CK ID) for the
'MGS_SPACECRAFT' frame is -94000.
Suppose that R(t) is the rotation matrix whose columns
represent the inertial pointing vectors of the MGS spacecraft
axes at time `t'.
Then the angular velocity vector points along the vector given
limit AXIS( R(t+h)R )
And the magnitude of the angular velocity at time `t' is given
d ANGLE ( R(t+h)R(t) )
------------------------ at h = 0
Use the meta-kernel shown below to load the required SPICE
File name: ckfrot_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
mgs_sclkscet_00061.tsc MGS SCLK coefficients
mgs_sc_ext12.bc MGS s/c bus attitude
KERNELS_TO_LOAD = ( 'naif0012.tls',
End of meta-kernel
Example code begins here.
C Local parameters.
PARAMETER ( EPOCH = '2003-JUL-25 13:00:00' )
PARAMETER ( INST = -94000 )
C Local variables.
DOUBLE PRECISION ANGLE
DOUBLE PRECISION ANGVEL ( 3 )
DOUBLE PRECISION AXIS ( 3 )
DOUBLE PRECISION ET
DOUBLE PRECISION INFROT ( 3, 3 )
DOUBLE PRECISION H
DOUBLE PRECISION RET ( 3, 3 )
DOUBLE PRECISION RETH ( 3, 3 )
C Load the required LSK, SCLK and CK. Use a
C meta-kernel for convenience.
CALL FURNSH ( 'ckfrot_ex1.tm' )
C First convert the time to seconds past J2000. Set the
C delta time (1 ms).
CALL STR2ET ( EPOCH, ET )
H = 1.D-3
C Now, look up the rotation from the MGS spacecraft
C frame specified by its frame class ID (CK ID) to a
C base reference frame (returned by CKFROT), at ET
C and ET+H.
CALL CKFROT ( INST, ET, RET, REF, FOUND )
CALL CKFROT ( INST, ET+H, RETH, REFH, FOUNDH )
C If both rotations were computed and if the base
C reference frames are the same, compute the
C instantaneous angular velocity vector.
IF ( FOUND .AND. FOUNDH .AND. REF .EQ. REFH ) THEN
C Compute the infinitesimal rotation R(t+h)R(t)**T.
CALL MXMT ( RETH, RET, INFROT )
C Compute the AXIS and ANGLE of the infinitesimal
CALL RAXISA ( INFROT, AXIS, ANGLE )
C Scale AXIS to get the angular velocity vector.
CALL VSCL ( ANGLE/H, AXIS, ANGVEL )
C Output the results.
. 'Instantaneous angular velocity vector:'
WRITE(*,'(A,I5)') 'Reference frame ID:', REF
WRITE(*,*) 'ERROR: data not found or frame mismatch.'
When this program was executed on a Mac/Intel/gfortran/64-bit
platform, the output was:
Instantaneous angular velocity vector:
0.0001244121 0.0008314866 0.0003028634
Reference frame ID: 1
1) A CK file must be loaded prior to calling this routine.
2) LSK and SCLK files needed for time conversions must be loaded
prior to calling this routine.
J. Diaz del Rio (ODC Space)
B.V. Semenov (JPL)
W.L. Taber (JPL)
SPICELIB Version 1.3.0, 13-DEC-2021 (JDR) (BVS) (NJB)
Edited the header to comply with NAIF standard and modern
SPICE CK and frames terminology. Added initialization of local
Added complete code example.
SPICELIB Version 1.2.0, 17-FEB-2000 (WLT)
The routine now checks to make sure convert ET to TICKS
and that at least one C-kernel is loaded before trying
to look up the transformation. Also the routine now calls
SCE2C instead of SCE2T.
SPICELIB Version 1.0.0, 03-MAR-1999 (WLT)