CSPICE_CKGP returns pointing (attitude) for a specified
spacecraft clock time.
For important details concerning this module's function, please refer to
the CSPICE routine ckgp_c.
inst the scalar integer NAIF ID for the instrument, spacecraft,
or other structure for which pointing is requested, the
frame fixed to this object is called the"instrument frame"
or "instrument-fixed" frame
sclkdp the double precision scalar encoded spacecraft clock time
for which pointing is being requested.
tol the scalar double precision time tolerance in ticks (+/-),
the units of encoded spacecraft clock time, about 'sclkdp'
The C-matrix returned by cspice_ckgp is the one whose
time tag is closest to 'sclkdp' and within 'tol' units
In general, because using a non-zero tolerance affects
selection of the segment from which the data is obtained,
users are strongly discouraged from using a non-zero
tolerance when reading CKs with continuous data. Using
a non-zero tolerance should be reserved exclusively to
reading CKs with discrete data because in practice
obtaining data from such CKs using a zero tolerance is
often not possible due to time round off.
ref the scalar string name of the desired reference
frame for the returned pointing
cspice_ckgp, inst, sclkdp, tol, ref, cmat, clkout, found
cmat a double precision, 3x3 rotation matrix that transforms
the components of a vector expressed in the frame
specified by 'ref' to components expressed in the frame
tied to the instrument, spacecraft, or other structure
at time 'clkout'
clkout the scalar double precision encoded spacecraft clock
time associated with the returned C-matrix. (this value
may differ from the requested time, but never by more
than the input tolerance 'tol')
found a scalar boolean with value TRUE when requested
pointing is found
If 'vec_ref' is a double-precision 3-vector defined in reference
frame 'ref', rotate 'vec_ref' into the instrument frame via:
vec_inst = cmat ## vec_ref ;; column vector
vec_inst = transpose(cmat) # vec_ref ;; row vector
cspice_mxv, cmat, vec_ref, vec_inst ;; row vector
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
Retrieve pointing data from a Voyager 2 CK kernel.
;; Constants for this program:
;; -- The code for the Voyager 2 spacecraft clock is -32
;; -- The code for the narrow angle camera on the Voyager 2
;; spacecraft is -32001.
;; -- Spacecraft clock times for successive Voyager images always
;; differ by more than 0:0:400. This is an acceptable
;; tolerance, and must be converted to "ticks" (units of
;; encoded SCLK) for input to ckgp_c .
;; -- The reference frame we want is FK4.
;; -- The narrow angle camera boresight has direction
;; ( 0, 0, 1 ) in camera (instrument) frame.
SC = -32
INST = -32001
REF = 'FK4'
TOLVGR = '0:0:400'
BORE = [ 0.d, 0.d, 1.d]
NPICS = 2
CK = '/kernels/voyager2/ck/vg2_jup_qmw_na.bc'
SCLK = '/kernels/voyager2/sclk/vg200004.tsc'
SCLKCH = [ '2/18381:54:768' , '4/08970:58:768' ]
;; Load the CK pointing file.
;; Need to load a Voyager 2 SCLK kernel to convert from
;; clock string to ticks. Although not required for
;; the Voyager spacecraft clocks, most modern spacecraft
;; clocks require a leapseconds kernel to be loaded in
;; addition to an SCLK kernel.
;; Convert tolerance from VGR formatted character string
;; SCLK to ticks, which are units of encoded SCLK.
cspice_sctiks, SC, TOLVGR, toltik
for i = 0, (NPICS-1) do begin
;; cspice_ckgp requires encoded spacecraft clock time.
cspice_scencd, SC, sclkch[i], sclkdp
;; Retrieve the 'REF' reference frame to 'INST' reference frame
;; transformation matrix at time sclkdp with a tolerance
;; [INST] = [cmat][ref]
cspice_ckgp, INST, sclkdp, toltik, REF, cmat, clkout, found
;; Did we find pointing information within (+/-) 'toltik' of the
;; requested time.
if ( found ) then begin
;; Transform the 'BORE' vector from 'INST' reference frame to
;; 'REF' frame.
;; [ref] = [cmat] [INST]
;; The Icy code to perform the same operation.
;; cspice_mtxv, cmat, BORE, bore_ref
bore_ref = cmat # BORE
print, 'At SCLK time : ', sclkch[i]
print, 'The boresight vector: ', bore_ref
endif else begin
print, 'Pointing not found for SCLK time: ', sclkch[i]
IDL outputs (for SCLK = 2/18381:54:768):
At SCLK time : 2/18381:54:768
The boresight vector: -0.089388922 0.94794277 0.30563724
IDL outputs (for SCLK = 4/08970:58:768):
Pointing not found for SCLK time: 4/08970:58:768
-Icy Version 1.0.2, 03-JUN-2010, BVS (JPL)
Edits to header. Added warning regarding non-zero tolerance.
-Icy Version 1.0.1, 09-JUN-2006, EDW (JPL)
Edits to header. Improved argument descriptions.
-Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)
get ck pointing