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

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_CKW02 adds a type 2 segment to a C-kernel.

   For important details concerning this module's function, please refer to
   the CSPICE routine ckw02_c.

I/O

   
   Given:
   
      handle   scalar integer value of the file handle for 
               an open CK file returned from cspice_ckopn
               
      begtim   double precision scalar encoded SCLK segment
               begin time value
               
      endtim   double precision scalar encoded SCLK segment 
               end time value
               
      inst     the scalar integer NAIF instrument ID code
      
      ref      scalar string identifying the reference frame for the
               segment
               
      segid    a scalar string to identify the segment
      
      start    a double precision N-vector containing
               encoded SCLK interval start times
               
      stop     a double precision N-vector containing
               the encoded SCLK interval stop times
               
      quats    a 4xN double precision matrix of quaternions
               representing instrument pointing
               
      avvs     a 3xN double precision matrix of angular 
               velocity vectors
    
      rates    a double precision N-vector containing the
               number of seconds per tick for each interval
   
   the call:
   
      cspice_ckw02, handle, $ 
                    begtim, $ 
                    endtim, $ 
                    inst,   $
                    ref',   $
                    segid,  $
                    start,  $
                    stop,   $
                    quats,  $
                    avvs,   $
                    rates
   
   writes the data for a type 2 segment to the open CK file 
   indicated by 'handle'.
   

Examples


   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.

   
      ;;
      ;; Create a CK type 2 segment; fill with data for a simple time 
      ;; dependent rotation and angular velocity.
      ;;
   
      ;;
      ;; Define needed parameters
      ;;
      CK2        = "type2.bc"
      INST       = -77702
      MAXREC     = 201
      SECPERTICK = 0.001d
      SPICETRUE  = 1L
      IFNAME     = "Test CK type 2 segment created by cspice_ckw02"
      SEGID      = "Test type 2 CK segment"
   
      ;;
      ;; 'NCOMCH' is the number of characters to reserve for the kernel's
      ;; comment area. This example doesn't write comments, so set to 
      ;; zero.
      ;;
      NCOMCH     = 0
      
      ;;
      ;; The base reference from for the rotation data.
      ;;
      REF        = "J2000"
   
      ;;
      ;; Time spacing in encoded ticks.
      ;;
      SPACING_TICKS = 10.d
      
      ;;
      ;; Time spacing in seconds
      ;;
      SPACING_SECS = SPACING_TICKS * SECPERTICK
      
      ;;
      ;; Declare an angular rate in radians per sec.
      ;;
      RATE = 1.d-2
   
      ;;
      ;; Open a new kernel.
      ;;
      cspice_ckopn, CK2, IFNAME, NCOMCH, handle
   
      ;;
      ;; Create a 4xMAXREC matrix for quaternions, and a 
      ;; 3xMAXREC for expavs.
      ;;
      quats = dblarr( 4, MAXREC )
      av    = dblarr( 3, MAXREC )
   
      ;;
      ;; Create a 3x3 double precision identity matrix.
      ;; The Icy call:
      ;;
      ;;   cspice_ident, work_mat
      ;;
      ;; performs the same function.
      ;;
      work_mat = identity( 3 )
   
      ;;
      ;; Convert the matrix to quaternions.
      ;;
      cspice_m2q, work_mat, work_quat
   
      ;;
      ;; Copy the work quaternions to the first row of
      ;; 'quats'.
      ;;
      quats[0:3] = work_quat
   
      ;;
      ;; Create an angular velocity vector. Copy to the first row 
      ;; of 'av'. This vector is in the 'REF' reference frame.
      ;;
      av [0:2] = [0.d, 0.d, RATE ]
   
      ;;
      ;; Create arrays of interval start and stop times.  The interval
      ;; associated with each quaternion will start at the epoch of
      ;; the quaternion and will extend 0.8 * SPACING_TICKS forward in time,
      ;; leaving small gaps between the intervals.
      ;;
      starts = dblarr( MAXREC )
      stops  = dblarr( MAXREC )
   
      ;;
      ;; Fill in the clock rates array with a constant 'SECPERTICK' for
      ;; all values.
      ;;
      rates  = dblarr( MAXREC ) + SECPERTICK
   
      ;;
      ;; Create an array of encoded tick values in increments of 
      ;; 'SPACING_TICKS' with an initial value of 1000 ticks...
      ;;
      sclkdp = dindgen(MAXREC) * SPACING_TICKS
      sclkdp = sclkdp + 1000.d
   
      starts = sclkdp
      stops  = sclkdp + ( 0.8d * SPACING_TICKS )
   
      
      ;;
      ;; Fill the rest of the av and quats matrices
      ;; with simple data.
      ;;
      for i = 1, (MAXREC-1) do begin
   
         ;;
         ;; Create the transformation matrix for a rotation of 'theta' 
         ;; about the Z axis. Calculate 'theta' from the constant
         ;; angular rate 'RATE' at increments of 'SPACING_SECS'.
         ;;
         theta = ( double(i) * RATE * SPACING_SECS)
         cspice_rotmat, work_mat, theta, 3, work_mat
   
         ;;
         ;; Convert the 'work_mat' matrix to SPICE type quaternions.
         ;;
         cspice_m2q, work_mat, work_quat
   
         ;;
         ;; Store the quaternions in the 'quat' matrix.
         ;; Store angular velocity in 'av'. Both variables
         ;; represent arrays, but in IDL you can fill them
         ;; as vectors.
         ;; 
         ;;
         quats[ (i*4):((i*4)+3) ] = work_quat
         av   [ (i*3):((i*3)+2) ] = [ 0.d, 0.d, RATE ]
   
      endfor
   
      ;;
      ;; Set the segment boundaries equal to the first and last
      ;; time in the segment.
      ;;
      begtim = starts[      0]
      endtim = stops [MAXREC-1]
   
      ;;
      ;; All information ready to write. Write to a CK type 2 segment
      ;; to the file indicated by 'handle'.
      ;;
      cspice_ckw02, handle, $
                    begtim, $
                    endtim, $
                    INST,   $
                    REF,    $
                    SEGID , $
                    starts, $
                    stops,  $
                    quats,  $
                    av,     $
                    rates
   
      ;;
      ;; SAFELY close the file.
      ;;
      cspice_ckcls, handle

Particulars


   None.

Required Reading


   ICY.REQ
   CK.REQ
   DAF.REQ 
   SCLK.REQ 

Version


   -Icy Version 1.0.1, 07-JAN-2008, EDW (JPL)

      Removed mention of 'nrec' from the I/O section. mention of
      this argument constitutes a typo as the Icy interface
      does not need to explicitly pass this value.

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

Index_Entries

 
   write ck type_2 pointing data segment 
 



Wed Apr  5 17:57:59 2017