nyx-space / anise

ANISE provides a toolkit and files for Attitude, Navigation, Instrument, Spacecraft, and Ephemeris data. It's a modern replacement of the NAIF SPICE toolkit.
Mozilla Public License 2.0
48 stars 8 forks source link

Load SPICE metakernel #123

Open ChristopherRabotin opened 9 months ago

ChristopherRabotin commented 9 months ago

High level description

SPICE metakernels are really useful for ensuring that the same data is always loaded correctly. The purpose of this issue is to implement a way to load and append a given Almanac from a SPICE metakernel.

Requirements

Test plans

Design

This is the design section. Each subsection has its own subsection in the quality assurance document.

API definition

Maybe something like this:

impl Almanac {

    /// Extends the current Almanac with the provided meta kernel
    pub fn extend(&mut self, meta: Metakernel) {
    // ...
    }

    // Clone the Almanac and extend it with the provided meta kernel
    pub fn with(&self, meta: Metakernel) -> Self {
    // ...
    }
}

pub struct Metakernel {
paths: HashMap<String, PathBuf>,
kernels: Vec<String>
}

Metakernel would implement FromStr to be build from the string of the metakernel I think. It would also reuse the parse function currently used to parse all other KPL files.

Example input:

\begindata

   PATH_VALUES  = ( '/flight_projects/mgs/SPICE_kernels',
                    '/generic/SPICE_kernels'              )

   PATH_SYMBOLS = ( 'MGS',
                    'GEN' )

   KERNELS_TO_LOAD = ( '$GEN/leapseconds.tls',
                       '$MGS/mgs.tsc',
                       '$GEN/generic.bsp',
                       '$MGS/mgs.bc',
                       '$GEN/earth.bpc',
                       '$MGS/mgs.bes'           )

   \begintext

High level architecture

Document, discuss, and optionally upload design diagram into this section.

Detailed design

The detailed design *will be used in the documentation of how ANISE works.

Feel free to fill out additional QA sections here, but these will typically be determined during the development, including the release in which this issue will be tackled.

ChristopherRabotin commented 7 months ago

After diving way too deep into configs, I'll follow @sellout's recommendation and use Dhall for the configuration of metakernels.

ChristopherRabotin commented 5 months ago

@GregoireHENRY In your opinion, is this still a required feature, or is the dhall configuration an acceptable substitute?