CKPFS ( C-kernel, get pointing from segment )
SUBROUTINE CKPFS ( HANDLE, DESCR, SCLKDP, TOL, NEEDAV,
. CMAT, AV, CLKOUT, FOUND )
Evaluate pointing data from a segment for a given time.
CK
DAF
POINTING
INTEGER HANDLE
DOUBLE PRECISION DESCR ( * )
DOUBLE PRECISION SCLKDP
DOUBLE PRECISION TOL
LOGICAL NEEDAV
DOUBLE PRECISION CMAT ( 3, 3 )
DOUBLE PRECISION AV ( 3 )
DOUBLE PRECISION CLKOUT
LOGICAL FOUND
Variable I/O Description
-------- --- --------------------------------------------------
HANDLE I CK file handle.
DESCR I Segment descriptor.
SCLKDP I Spacecraft clock time.
TOL I Time tolerance.
NEEDAV I True when angular velocity data is requested.
CMAT O C-matrix.
AV O Angular velocity vector.
CLKOUT O Output spacecraft clock time.
FOUND O True when requested pointing is available.
HANDLE is the handle of the binary CK file containing the
desired segment. The file should have been opened
for read access, either by CKLPF or DAFOPR.
DESCR is the packed descriptor of the segment.
SCLKDP is the encoded spacecraft clock time for which
pointing is desired.
TOL is a time tolerance, measured in the same units as
encoded spacecraft clock. The C-matrix returned by
CKPFS is the one whose time is closest to SCLKDP and
within TOL units of SCLKDP.
NEEDAV is true when angular velocity data is requested.
CMAT is a rotation matrix that transforms the components of
of a vector expressed in the inertial frame given in
the segment to components expressed in the instrument
fixed frame at time CLKOUT.
Thus, if a vector v has components x, y, z in the
inertial frame, then v has components x', y', z' in
the instrument fixed frame at time CLKOUT:
[ x' ] [ ] [ x ]
| y' | = | CMAT | | y |
[ z' ] [ ] [ z ]
If the x', y', z' components are known, use the
transpose of the C-matrix to determine x, y, z as
follows.
[ x ] [ ]T [ x' ]
| y | = | CMAT | | y' |
[ z ] [ ] [ z' ]
(Transpose of CMAT)
AV is the angular velocity vector. This is returned only
if it has been requested, as indicated by NEEDAV. In
other words, if NEEDAV is true, then the pointing
records in the segment must contain AV data.
The angular velocity vector is the right-handed axis
about which the reference frame tied to the instrument
is instantaneously rotating at time CLKOUT. The
magnitude of AV is the magnitude of the instantaneous
velocity of the rotation, in radians per second.
The components of AV are given relative to the
reference frame specified in the segment descriptor.
CLKOUT is the encoded spacecraft clock time associated with
the returned C-matrix and, optionally, the returned
angular velocity vector.
FOUND is true if a C-matrix and an angular velocity vector
(if requested) were found to satisfy the pointing
request. FOUND will be false otherwise.
None.
1) If the data type of the segment is not one of those supported
by this routine, the error SPICE(CKUNKNOWNDATATYPE) is
signalled.
2) If the specified handle does not belong to any file that is
currently known to be open, an error is diagnosed by a
routine that this routine calls.
3) If DESCR is not a valid, packed descriptor of a segment in
the CK file specified by HANDLE, the results of this routine
are unpredictable.
4) If TOL is negative, FOUND is false.
5) If NEEDAV is true, but the segment doesn't contain AV data,
an error is signalled by a routine that this routine calls.
None.
The structure of this routine is just a big case statement. Each
segment data type is supported by two routines:
CKRnn which reads a single logical pointing record from a
segment of type nn. (A logical record is defined as
a collection of numbers sufficient to determine the
C-matrix, and optionally the angular velocity vector,
at the input time.)
CKEnn which evaluates the pointing record returned by CKRnn
to give the C-matrix and optionally the angular
velocity vector at the input time.
The data type is determined from the segment descriptor, and the
appropriate routines are called.
CKPFS allows you to be more selective than CKGP or CKGPAV about
choosing segments to satisfy CK pointing requests.
Suppose MOC.BC is a CK file consisting of several segments
containing Mars Observer Camera pointing data. Each segment
covers the same time period, but produces different pointing
values (one segment may contain predict values, another may
contain telemetry-based values, and others may contain different
corrected versions).
The following code fragment shows how different the results are
for each segment. The program steps through the file segment by
segment and requests pointing for the same time from each
segment. The results are printed to the screen.
GETIME is an imaginary routine used to get an encoded SCLK time
(SCLKDP) and time tolerance from the user.
SC = -94
INST = -94001
NEEDAV = .TRUE.
CALL CKLPF ( 'MOC.BC', HANDLE )
CALL GETIME ( SCLKDP, TOL, QUIT )
C
C For each time, begin a forward search through the file, and
C for each segment found, get its descriptor, identifier, and
C evaluate the pointing.
C
DO WHILE ( .NOT. QUIT )
CALL DAFBFS ( HANDLE )
CALL DAFFNA ( FOUND )
DO WHILE ( FOUND )
CALL DAFGS ( DESCR )
CALL DAFGN ( IDENT )
CALL CKPFS ( HANDLE, DESCR, SCLKDP, TOL, NEEDAV,
. CMAT, AV, CLKOUT, PFOUND )
IF ( PFOUND ) THEN
WRITE (*,*) 'Segment: ', IDENT
WRITE (*,*) 'C-Matrix: ', CMAT
WRITE (*,*) 'Angular velocity: ', AV
ELSE
CALL SCDECD ( SC, SCLKDP, SCLKCH )
WRITE (*,*) 'Data not found at time ', SCLKCH
END IF
CALL DAFFNA ( FOUND )
END DO
CALL GETIME ( SCLKDP, TOL, QUIT )
END DO
A C-kernel file should have been loaded by either CKLPF
or DAFOPR.
None.
J.M. Lynch (JPL)
B.V. Semenov (JPL)
M.J. Spencer (JPL)
R.E. Thurman (JPL)
I.M. Underwood (JPL)
SPICELIB Version 5.0.0, 19-AUG-2002 (NJB)
The routine was updated to handle data type 5 segments.
SPICELIB Version 4.0.0, 02-MAY-1999 (BVS)
The routine was updated to handle data type 4 segments.
The RECSIZ size parameter was eliminated. The dimension
of the RECORD buffer is now defined by the CKMRSZ parameter
specified in the 'ckparam.inc' include file.
SPICELIB Version 3.0.0, 11-SEP-1992 (JML)
The routine was updated to handle data type 3 segments.
SPICELIB Version 2.0.1, 10-MAR-1992 (WLT)
Comment section for permuted index source lines was added
following the header.
SPICELIB Version 2.0.0, 30-AUG-1991 (JML)
The routine was updated to handle data type 2 segments.
FOUND is now initialized to false.
SPICELIB Version 1.0.1, 02-NOV-1990 (JML)
The restriction that a C-kernel file must be loaded
was explicitly stated.
SPICELIB Version 1.0.0, 07-SEP-1990 (RET) (IMU)
|