Navigation and Ancillary Information Facility NAIF Camera-matrix Kernel CK (Orientation or Attitude Kernel) Emphasis on CK files for Cassini October 2004 Navigation and Ancillary Information Facility Cassini C-Kernel 2 NAIF Scope This tutorial covers use of predict and reconstruction CKs produced by the Cassini AACS Team. It does not cover use of image navigated (sometimes called c-smithed ) CKs made by the Imaging Team, or any other CKs. Those topics are best presented by the producers of such CK files. Navigation and Ancillary Information Facility Cassini C-Kernel 3 NAIF Cassini CK Contents - 1 A CK file holds orientation data for the Cassini spacecraft . Orientation data quaternions that may be used to rotate vectors from a base reference frame to a target frame For Cassini: the base frame is the Earth Equator and Equinox of 2000 inertial frame SPICE frame name is J2000 the target reference frame is the Cassini spacecraft SPICE frame name is CASSINI_SC_COORD A CK file also contains angular velocity of the target frame with respect to the base frame. Navigation and Ancillary Information Facility Cassini C-Kernel 4 NAIF Cassini CK Contents - 2 CK files also contain comments (metadata). For reconstruction CK files, the comments include: parameters used in the creation of the file. segment summaries showing time bounds for the: entire segment interpolation intervals within each segment For predict CK files, the comments include: names of products used in making the predict CK These comments may be displayed on your computer using the COMMNT utility program supplied with the SPICE Toolkit. To display comments, run COMMNT as follows: % commnt -r | more See COMMNT User s Guide (toolkit/doc/commnt.ug) for complete usage Navigation and Ancillary Information Facility Cassini C-Kernel 5 NAIF Cassini CK Files-1 Cassini CK files produced at JPL are either predict or reconstruction Predict Predict CK files are made using information that predicts the orientation some time in the future, as generated by Cassini s Kinematic Predictor Tool (KPT). Due to their high quality (good fidelity and, by definition, no data gaps) they may be used to fill gaps in reconstructed CKs. Normally a predict CK covers one sequence. To achieve the best possible accuracy a predict CK should be used with the same SCLK data used in the CK generation. This is found in the SCLK used in generation of the predict CK. This may* also be found in a later-made SCLK. * see later discussion about re-made predict CKs Latest file naming schema: [start]_[end][p][version][_xxxxxx].[ext] E.G. 03215_03220pa_port1.bc Navigation and Ancillary Information Facility Cassini C-Kernel 6 NAIF Cassini CK Files-2 Reconstruction Reconstruction CK files are made from orientation telemetry returned from the Cassini spacecraft. To achieve the best possible accuracy, a reconstruction CK should be used with an SCLK produced after the last data in the CK. File naming schema: [start]_[end][r][version][_xxxxxx].[ext] optional Navigation and Ancillary Information Facility Cassini C-Kernel 7 NAIF While the Cassini CK naming scheme may suggest that a CK file provides continuous coverage for the interval of time specified in the file name, in reality this is rarely the case for reconstruction CK files they almost alwa ys contain gaps in coverage. Below is an example of this. Coverage of . CK file as suggested by file name CK file segments as appears in ckbrief and spacit summaries, and in comment area CK segments containing continuous data this is what is actually available to the SPICE high-level interfaces Black lines represent interpolation intervals within which pointing data may be returned. White spaces represent gaps in the data. CK segments may overlap slightly (not shown here). Cassini Reconstruction CK Coverage - 1 A segment boundary Interpolation intervals (typical of many) Navigation and Ancillary Information Facility Cassini C-Kernel 8 NAIF Cassini Reconstruction CK Coverage - 2 All Cassini CK files are of Type 3, in which segments contain discrete pointing instances. In reconstruction CK files, the nominal spacing between orientation data points extracted from telemetry is 4 seconds. These pointing instances are partitioned into groups, called interpolation intervals, within which linear interpolation between adjacent instances is valid and is done by SPICE code. Gaps in coverage in reconstruction CKs result from insufficient source orientation data, i.e. telemetry. Navigation and Ancillary Information Facility Cassini C-Kernel 9 NAIF Cassini Reconstruction CK Coverage - 3 Interpolation intervals can be thought of as representing intervals of time over which the pointing of the spacecraft is available continuously. In Cassini reconstruction CK files, the intervals are constrained such that interpolation is valid between any two adjacent points that are less than or exactly 16 seconds apart. This means that interpolation will be done if up to three adjacent pointing instances are missing. If four instances are missing, there will be a gap in the segment. SPICE CK reader routines compute and return pointing using linear interpolation between the attitude data points that bound the user s pointing request time as long as that time is within an interpolation interval. Navigation and Ancillary Information Facility Cassini C-Kernel 10 NAIF Cassini Reconstruction CK Coverage - 4 The time periods between interpolation intervals are gaps during which the CK readers are not able to compute pointing Information about the start and stop time for each interpolation interval can be obtained using two methods by examining a reconstruction CK file s comments using the COMMNT utility by summarizing a CK file using CKBRIEF with the -dump option Navigation and Ancillary Information Facility Cassini C-Kernel 11 NAIF Cassini Reconstruction CK Coverage - 5 To view the interpolation intervals table provided in a reconstruction CK file s comments using COMMNT: % commnt -r 04059_04066ra.bc ... ************************************************************************ ** INTERPOLATION INTERVALS IN THE FILE SEGMENTS: ************************************************************************ ** SEG.SUMMARY: ID -82000, COVERG: 2004-02-28T13:00:00 2004-03-03T22:27:22 ------------------------------------------------------------------------ ---- 2004-02-28T13:00:00.989 2004-02-29T14:16:28.395 2004-03-01T07:05:43.750 2004-03-01T14:52:19.568 ... To view a summary of interpolation intervals in a reconstruction CK using CKBRIEF: % ckbrief 04215_04220ra.bc cas00085.tsc naif0007.tls -utc -dump ... Segment No.: 1 Object: -82000 Interval Begin UTC Interval End UTC AV ------------------------ ------------------------ --- 2004-AUG-02 00:00:01.275 2004-AUG-02 01:56:53.479 Y 2004-AUG-02 01:59:21.478 2004-AUG-04 11:28:19.880 Y ... Navigation and Ancillary Information Facility Cassini C-Kernel 12 NAIF Cassini Predict CK Coverage Cassini predict CK files are also of Type 3, in which segments contain discrete pointing instances. Spacing between points varies depending on the simulated attitude mode and the actual method of generation. By definition, predict CK files have no data gaps and thus provide continuous coverage throughout the entire span of the file. Continuous coverage means you always get a pointing solution. The coverage of a predict CK file may be seen using the ckbrief utility. Navigation and Ancillary Information Facility Cassini C-Kernel 13 NAIF When Are Cassini CKs Made? 1. A predict CK for an entire sequence is made prior to uplink of the sequence. There may be multiple instances of this; if you use it be sure to get the very last version prior to uplink 2. During execution of the sequence, reconstruction CKs are made about every week. 3. After completion of the sequence, the predict CK for that sequence may be re-made using the latest SCLK, and 4. After completion of the sequence, a single reconstruct CK covering the entire sequence is made using the latest SCLK. Navigation and Ancillary Information Facility Cassini C-Kernel 14 NAIF Using Predict CKs To Fill Gaps - 1 You may require continuous spacecraft orientation data may to process science data. Reconstruction CKs have gaps and therefore cannot provide 100% continuous coverage. Predict CKs have no gaps and are of very high fidelity; these can be used to fill the gaps in reconstruction CKs. Therefore, for continuous coverage, both predict and reconstruction CKs must be loaded into a user s program. To make sure that reconstruction data is used when available, the predict CK should be loaded first and reconstruction CK(s) loaded afterwards. SPICE gives the latest loaded file the highest priority and will therefore take data from the latest file, if possible. Navigation and Ancillary Information Facility Cassini C-Kernel 15 NAIF Using Predict CKs To Fill Gaps-2 Since only one SCLK file can be loaded, it is important to use the correct file for this procedure. If processing data from a sequence while that sequence is still active: 1. Load the latest predict CK made for that sequence (the one uplinked). 2. Load one or more weekly reconstruction CK(s). 3. Load the SCLK used in making the aforementioned predict CK. If processing data from a sequence that has finished executing: 1. Load the latest predict CK for that sequence, made perhaps after the sequence is finished. 2. Load the single reconstruction CK for that sequence, made after the sequence is finished. 3. Load the SCLK used in making the aforementioned predict and reconstruction CKs, or use any later-made SCLK. Navigation and Ancillary Information Facility Cassini C-Kernel 16 NAIF Validation of Predict CKs AACS validates each predict CK by comparing it with the reconstruction CKs for the same time period. The results of this validation are presented as a set of plots showing the difference between predict and reconstruction orientation (where it is available) broken down into rotational deltas about individual axes of the s/c frame. See slides 25-30 for examples. These reports will be available on the Web. (mid- October) Currently they are being stored in AACS AFS space. (/afs/jpl/home/b/burkt/public/ck_compare) Navigation and Ancillary Information Facility Cassini C-Kernel 17 NAIF To get the orientation (rotation matrix) and angular velocity of the spacecraft, one usually needs four SPICE file types: CK, SCLK, LSK and FK. Spacecraft orientation kernel (CK). Spacecraft Clock Kernel (SCLK) and Leapseconds Kernel (LSK). Used to convert between ephemeris time (ET) and spacecraft clock time (SCLK). Frames Kernel (FK), when high level SPICE interfaces are used to access CK data. Used to associate e.g., an instrument frame with the CK (e.g. spacecra ft) frame. See the next page for examples of high level SPICE interfaces. Accessing Cassini CKs - 1 Navigation and Ancillary Information Facility Cassini C-Kernel 18 NAIF The high-level SPICELIB routines should normally be used to access CK data. These high-level routines are: Position or state transformation matrix determination PXFORM: return a rotation matrix (3x3) from one frame to another, either of which can be a CK frame SXFORM: return a state transformation matrix (6x6) from one frame to another, either of which can be a CK frame Position or state vector vector determination SPKPOS: return a position vector (1x3) in a specified frame, which can be a CK frame or have a CK frame as one of the links in its chain SPKEZR: return a state vector (1x6) in a specified frame, which can be a CK frame or have a CK frame as one of the links in its chain The above mentioned routines are discussed in the frames (fk.*, using_frames. *) and spk (spk. *) tutorials. Accessing Cassini CKs - 2 Navigation and Ancillary Information Facility Cassini C-Kernel 19 NAIF Initialization ... typically once per program run Tell your program which SPICE files to use ( loading files). CALL FURNSH( 'lsk_file_name' ) CALL FURNSH( 'sclk_file_name' ) CALL FURNSH( 'ck_file_name' ) CALL FURNSH( fk_file_name' ) Loop ... do as often as you need Convert UTC to Ephemeris Time (et) CALL STR2ET( 'utc_string', et ) Get 3x3 position vector rotation matrix (cmat), or 6x6 state vector rota tion matrix (camat) at your requested time. CALL PXFORM ( from_frame', to_frame', et, cmat ) CALL SXFORM ( from_frame', to_frame', et, camat ) inputs output or Better yet, use a furnsh kernel to load all the needed files. Accessing Cassini CKs - 3 Navigation and Ancillary Information Facility Cassini C-Kernel 20 NAIF Accessing Cassini CKs - 4 The original CK access routines, CKGP and CKGPAV, are also available but not recommended for use because they don t have the ability to combine transformations provided by the high level interfaces. The exception to this is if one wants to know if pointing is available for a particular time prior to calling one of the highlevel routines, in order to prevent those from signaling an error. In this case CKGP or CKGPAV can be called before calling high-level routines, and the FOUND flag returned by this call can be checked to see if pointing is available. Use the Cassini spacecraft ID (-82000), encoded Cassini SCLK, tolerance 0.0 and reference frame J2000 when calling CKGP or CKGPAV for that purpose Navigation and Ancillary Information Facility Cassini C-Kernel 21 NAIF PROGRAM READ_CASSINI_CK_EXAMPLE IMPLICIT NONE CC Declare variables C CHARACTER*(32) UTCBEG CHARACTER*(32) UTCEND DOUBLE PRECISION ET DOUBLE PRECISION ETBEG DOUBLE PRECISION ETEND DOUBLE PRECISION ETSTEP DOUBLE PRECISION SCLK DOUBLE PRECISION HMAT ( 3, 3 ) DOUBLE PRECISION CMAT ( 3, 3 ) LOGICAL FOUND CC Load needed kernels -- LSK, SCLK, CK and FK. C CALL FURNSH ( 'naif0007.tls' ) CALL FURNSH ( 'cas00084.tsc' ) CALL FURNSH ( '04059_04066ra.bc' ) CALL FURNSH ( 'cas_v38.tf' ) Accessing Cassini CKs - 5 A small FORTRAN program below illustrates a way of computing transformation from the ISS NAC frame to the J2000 inertial frame, incorporating pointing data from Cassini spacecraft CKs. Navigation and Ancillary Information Facility Cassini C-Kernel 22 NAIF CC Set begin and end UTC and time step. Convert UTCs to ETs. C UTCBEG = '2004-FEB-29 14:10' UTCEND = '2004-FEB-29 14:30 ETSTEP = 60.D0 CALL STR2ET( UTCBEG, ETBEG ) CALL STR2ET( UTCEND, ETEND ) CC Loop over times. C ET = ETBEG DO WHILE( ET .LE. ETEND ) CC Convert ET to Cassini encoded SCLK and call CKGP to verify C that s/c pointing is available in the loaded Cassini CK(s). C CALL SCE2T( -82, ET, SCLK ) CALL CKGP ( -82000, SCLK, 0.D0, J2000 , CMAT, SCLK, FOUND ) C C If pointing is available, compute matrix rotating vectors C from ISS NAC frame to J2000 inertial frame. C IF ( FOUND ) THEN CALL PXFORM ( 'CASSINI_ISS_NAC', 'J2000', ET, CMAT ) WRITE (*,*) ' ET, Rotation matrix: ', ET, CMAT ELSEWRITE (*,*) S/C POINTING IS NOT FOUND AT ET: , ET END IF ET = ET + ETSTEP END DO END Accessing Cassini CKs - 6 Navigation and Ancillary Information Facility Cassini C-Kernel 23 NAIF Common Error When Reading CK The file, or files, you loaded do not cover the time at which you requested orientation You may get an error message like: ======================================================================== ======== Toolkit version: N0057 SPICE(NOFRAMECONNECT) -- There is insufficient information available to ROTform from -82360 (CASSINI_ISS_NAC) to frame 1 (J2000). Frame -82360 could be transformed to -82000 (CASSINI_SC_COORD). Frame 1 could be transformed to 1 (J2000).' A traceback follows. The name of the highest level module is first. RADEC --> GBV --> PXFORM --> REFCHG Oh, by the way: The SPICELIB error handling actions are USER-TAILORABLE. You can choose whether the Toolkit aborts or continues when errors occur, wh ich error messages to output, and where to send the output. Please read the ERROR "Required Reading" file, or see the routines ERRACT, ERRDEV, and ERRPRT. ======================================================================== ======== Check file coverage on the segment level by summarizing the file(s) using CKBRIEF or SPACIT. Check interpolation interval coverage using CKBRIEF with option -dump, or by examining comments provided in the comment area of the file you may be asking for data within a coverage gap (outside of interpolation intervals). Navigation and Ancillary Information Facility Cassini C-Kernel 24 NAIF For more information about CK, look at the following documents Headers for PXFORM, SXFORM, SPKPOS and SPKEZR If needed, see headers for CKGP and CKGPAV Generic CK Tutorial Frames tutorial CK and Frames Required Reading CKBRIEF and SPACIT User s Guides Most Useful SPICELIB Routines Porting_Kernels tutorial Related documents SCLK Required Reading Time Required Reading Frames Required Reading NAIF_IDS Required Reading Rotations Required Reading For a general guide to locating documents, see ftp://naif/pub/naif/toolkit_docs/Tutorials/pdf/individual_docs/ 39_finding_components.pdf Additional Information on CK AACS CK-Compare Reports Each report covers 5-7 days of attitude data Each report includes: Interval and gap times in SCET format (e.g. 2004-DOYT00:00:00.000) 24-hours of data per plot Tabular data of mean and 1-sigma attitude difference, each axis, for t hat 24-hour period (also tabulated on a continuous trend report) The plots contain: Page 1 -- Attitude difference data expressed as a rotation (in mrads) about the S/C axes (X, Y, and Z) from the predicted attitude to the reconstructed attit ude Page 2 -- Predicted S/C body rates (X, Y, and Z) in mrads/sec Page 3 -- Data present indication 0 = All data is present 1 = Gap in Recon CK 2 = Real-time activity (predict not applicable) Navigation and Ancillary Information Facility 26 NAIF Navigation and Ancillary Information Facility 27 NAIF Navigation and Ancillary Information Facility 28 NAIF AACS Proposed C-Kernel Prediction/Reconstruction Comparison Recon CK: /home2/gsw/dbeach/utils/ckernel_dir/04136_04142ra.bc PRODUCT_CREATION_TIME = 2004-145T17:37:57 QUERY_START_TIME = 2004-136T13:00:01 QUERY_STOP_TIME = 2004-142T23:58:57 INTERVALS = 20 Interval Gap ------------------------------------------- ---------------------------- ------ 1. 2004-136T13:00:01 2004-136T14:25:45 2004-136T14:25:45 2004-136T14:27:17 2. 2004-136T14:27:17 2004-137T10:54:57 2004-137T10:54:57 2004-137T11:11:09 3. 2004-137T11:11:09 2004-138T17:39:52 2004-138T17:39:52 2004-138T17:40:44 4. 2004-138T17:40:44 2004-138T18:31:52 2004-138T18:31:52 2004-138T18:33:08 5. 2004-138T18:33:08 2004-138T22:38:32 2004-138T22:38:32 2004-138T22:38:52 6. 2004-138T22:38:52 2004-138T22:41:20 2004-138T22:41:20 2004-138T22:42:36 7. 2004-138T22:42:36 2004-138T22:56:08 2004-138T22:56:08 2004-138T22:56:52 8. 2004-138T22:56:52 2004-138T23:09:28 2004-138T23:09:28 2004-138T23:09:56 9. 2004-138T23:09:56 2004-138T23:13:12 2004-138T23:13:12 2004-138T23:14:12 10. 2004-138T23:14:12 2004-138T23:34:48 2004-138T23:34:48 2004-138T23:35:40 11. 2004-138T23:35:40 2004-139T09:30:32 2004-139T09:30:32 2004-139T09:33:00 12. 2004-139T09:33:00 2004-140T06:41:27 2004-140T06:41:27 2004-140T06:45:31 13. 2004-140T06:45:31 2004-140T07:11:19 2004-140T07:11:19 2004-140T07:14:51 14. 2004-140T07:14:51 2004-140T14:54:51 2004-140T14:54:51 2004-140T14:56:59 15. 2004-140T14:56:59 2004-141T07:37:34 2004-141T07:37:34 2004-141T07:37:54 Day No 1 (DOY 136-137) 2004-136T13:00:01.675 to 2004-137T13:00:01.675 Maximum Error X 1.26 mrad at 2004-136T16:37:26.675 Y 1.80 mrad at 2004-136T15:19:11.675 Z 1.01 mrad at 2004-136T16:24:36.675 Mean Deviation X 0.17 mrad Y 0.15 mrad Z 0.13 mrad Day No 2 (DOY 137-138) 2004-137T13:00:01.675 to 2004-138T13:00:01.675 Maximum Error X 2.98 mrad at 2004-137T20:17:36.675 Y 2.86 mrad at 2004-137T23:42:41.675 Z 3.07 mrad at 2004-137T20:40:56.675 Mean Deviation X 0.59 mrad Y 0.57 mrad Z 0.69 mrad Day No 3 (DOY 138-139) 2004-138T13:00:01.675 to 2004-139T13:00:01.675 Maximum Error X 1.10 mrad at 2004-138T18:35:21.675 Y 1.39 mrad at 2004-138T19:50:11.675 Z 0.66 mrad at 2004-138T18:35:56.675 Mean Deviation X 0.11 mrad Y 0.11 mrad Z 0.07 mrad