SPICE

SPICE is a system of data files (kernels) and software developed and maintained by the Navigation Ancillary Information Facility (NAIF) at JPL for the purpose of sharing mission data and definitional information.

ODTK leverages a subset of the SPICE software in order to interact with and provide support for the following SPICE kernel formats:

SPICE File Format (File Extension) Represents Use in ODTK
SPK (*.bsp) Ephemeris Use this to supply reference ephemeris for planetary bodies and spacecraft. ODTK can export spacecraft ephemeris in this format.
CK (*.bc) Attitude Use this to supply attitude for a spacecraft. For ODTK to use it, you must pair this with valid SCLK files.
SCLK (*.tsc) Spacecraft Clock Enables you to associate spacecraft clock times in CK files with inertial time. You can specify it using either continuous or integral tick format.
LSK (*.ker) Leap Seconds Enables accurate time conversions within SPICE. You can access this via the time.ker file in the STKData\Spice folder of the ODTK install.
FK (*.fk) Reference Frames Use this to label the planetary ephemeris files supplied with ODTK. You can access it via the names.ker file in the STKData\Spice folder of the ODTK install.

The leap second kernel is available for update through the Data Update Utility to stay current with newly announced leap seconds. ODTK loads SPICE files at startup, and these files are then available to be referenced by components of ODTK. You can configure central bodies to use SPICE for position information in the EphemerisData section of the (*.cb) file.

Option Description
Files This is a read-only list of SPICE ephemeris and attitude files loaded at ODTK startup. Each SPICE file contains information for one or more bodies, spacecraft, or structures. Files appear in the order of loading; see below for the importance of loading order and directory locations from which ODTK loads SPICE files. The leap second and spacecraft clock kernels are not on this list. Each entry contains two settings:
  • Enabled indicates if the displayed file is actively loaded into SPICE.
  • Filename is the fully qualified file name for detected SPICE file.

How ODTK automatically loads SPICE files

ODTK has an automatic loading scheme for SPICE files, which begins when you start the ODTK application. First, ODTK loads all SPICE files located in <ODTK Install Directory>\STKData\Spice. Next, ODTK loads all SPICE files in ODTK_ALL_USERS_DIR\STKData\Spice, followed by all SPICE files in USER_CONFIG_DIR\Spice.

The ODTK_ALL_USERS_DIR is usually in C:\Documents and Settings\All Users\Application Data\AGI on machines with x86 (32 bit) operating systems and in C:\ProgramData\AGI\ on machines with x64 (64 bit).

To load newly placed SPICE files, you must exit and then restart ODTK.

You must be careful concerning the use of two or more SPICE files that contain ephemeris or attitude for the object. When there are two or more definitions of the ephemeris or attitude of the object at a given time because of files containing overlapping data, SPICE itself resolves the conflict, using the latest file loaded that can handle the request.

The order of file loading is important. Since ODTK does not allow you to set the order of the file loading, it is a best practice to resolve these conflicts outside of ODTK by using SPICE files that do not have overlapping data. You can use SPICE utilities, provided by NAIF of JPL (maintainers of the SPICE capability), for this purpose. Consult STKData/Spice/ReadMe/ReadMe.txt located in the ODTK installation directory for more information regarding which ephemerides are loaded by ODTK at startup.

Typically, SPICE identifies natural bodies by positive integer IDs, while artificial satellites receive negative integer IDs. Structures and instruments receive IDs equal to 1000 times the spacecraft ID, minus the instrument number (e.g., -82001 for instrument 1 on a satellite with ID -82). In addition to the integer IDs, bodies usually have textual names as well. You can help SPICE resolve the names associated with integer IDs that are not recognized by supplying a special SPICE kernel that establishes the mapping. You can locate this kernel (data file) in any of the directories loaded by ODTK at startup. The following is a simple example of such a kernel. It is important to use "+=" and not "=" in the assignment statements to avoid wiping out the prior contents of the SPICE variables.

\begintext
\begindata
NAIF_BODY_CODE +=(-76,-85)
NAIF_BODY_NAME +=('MSL', 'LRO')
\begintext

When supplying attitude files to ODTK, you must also include spacecraft clock files. Without the clock files, ODTK cannot associate attitude information to behavior occurring in inertial time. Normally you would also need a leap second file to interpret SPICE attitude files, but ODTK already manages one internally, you do not need to provide one.