Program Listing for File spice.h

Return to documentation for file (interfaces/spice.h)

#pragma once

#include <string.h>

#include <filesystem>
#include <map>
#include <string>
#include <tuple>

#include "lupnt/conversions/frame_converter.h"
#include "lupnt/core/constants.h"
#include "lupnt/interfaces/spice_cheby.h"

namespace lupnt {

  namespace spice {
    struct GroundStationSpiceData {
      int naif_id;
      std::string name;
      BodyId body_id = BodyId::EARTH;
      std::string frame;
      Vec3d position_m = Vec3d::Zero();
      double latitude_deg = 0.0;
      double longitude_deg = 0.0;
      double altitude_m = 0.0;
    };

    void LoadSpiceKernel(void);

    void LoadSpiceKernel(const std::filesystem::path& filepath);

    void ExtractPckCoeffs(void);

    int GetNaifId(const std::string& body_name);

    std::string GetNaifName(int naif_id);

    bool HasNaifBody(const std::string& body_name);

    bool HasFrame(const std::string& frame_name);

    Mat6d GetFrameConversionMat(Real t_tdb, const std::string& from_frame,
                                const std::string& to_frame);

    Vec3d GetPlanetOrientation(BodyId id, Real t_tdb);

    Real StringToTdb(const std::string& str);

    Real StringToTai(const std::string& str);

    std::string TAItoStringUTC(Real t_tai, int prec);

    std::string TDBtoStringUTC(Real t_tdb, int prec);

    Real ConvertTime(Real t, Time from_time, Time to_time);

    Vec6 GetBodyPosVel(const Real t_tdb, BodyId center, BodyId target);

    MatX6 GetBodyPosVel(const VecX& t_tdb, BodyId center, BodyId target);

    Vec3d GetBodyPosSpice(Real t_tdb, BodyId obs, BodyId target,
                          const std::string& refFrame = "J2000",
                          const std::string& abCorrection = "NONE");

    Vec6d GetBodyPosVelSpice(Real t_tdb, BodyId obs, BodyId target,
                             const std::string& refFrame = "J2000",
                             const std::string& abCorrection = "NONE");

    GroundStationSpiceData GetGroundStationDataSpice(Real t_tdb, const std::string& station_name,
                                                     BodyId center = BodyId::EARTH,
                                                     const std::string& refFrame = "ITRF93",
                                                     const std::string& abCorrection = "NONE");

    GroundStationSpiceData GetGroundStationDataSpice(Real t_tdb, int station_id,
                                                     BodyId center = BodyId::EARTH,
                                                     const std::string& refFrame = "ITRF93",
                                                     const std::string& abCorrection = "NONE");

  }  // namespace spice
}  // namespace lupnt