ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
modelspace::SpiceManager Class Reference

The Spice Manager is a single class instance to manage spice frames and return SPICE states. More...

#include <spiceutils.h>

Collaboration diagram for modelspace::SpiceManager:

Public Member Functions

void loadKernels (std::vector< std::string > kernel_list)
 A function to load in a list of SPICE kernels.
 
void registerSpiceBody (const std::string &body_name)
 Function to register a spice body with the spice manager.
 
std::string getBodyFrameName (const std::string &body_name)
 Get the frame name associated with a body.
 
void setCentralBody (const std::string &central_body)
 Function to set the central body in the SPICE manager.
 
std::string centralBody ()
 Function to output the current central body.
 
double getGravitationalParameter (const std::string &body_name)
 Function to return the gravitational parameter for a SPICE body.
 
clockwerk::CartesianVector< double, 3 > getSpicePosition (const std::string &body_name, double tdb_time)
 Function to return the position of a SPICE body relative to central body.
 
clockwerk::CartesianVector< double, 3 > getSpiceVelocity (const std::string &body_name, double tdb_time)
 Function to return the velocity of a SPICE body relative to central body.
 
clockwerk::DCM< double > getSpiceAttitude (const std::string &body_name, double tdb_time)
 Function to return the attitude of a SPICE body relative to central body.
 
clockwerk::CartesianVector< double, 3 > getSpiceAngularVelocity (const std::string &body_name, double tdb_time)
 Function to return the angular velocity of a SPICE body relative to central body.
 

Protected Attributes

std::vector< std::string > _spice_bodies
 
std::string _central_body
 
bool _manual_set = false
 
bool _kernels_loaded = false
 
double _tmp_state [6]
 
double _lt = 0.0
 
double _tmp_dbl [3][3]
 
clockwerk::DCM< double > _tmp_dcm_p_pci
 
double _tmp_vec [3]
 
clockwerk::CartesianVector< double, 3 > _tmp_omega_p_pci__pci
 
double _ftmtrx [6][6]
 

Detailed Description

The Spice Manager is a single class instance to manage spice frames and return SPICE states.

The Spice Manager is a wrapper around SPICE utilities to simplify the process of getting SPICE states. It needs to exist for the following reasons:

  • Python/SWIG has some weirdness that couples with spice on kernel loading. Loading kernels here prevents having to load kernels multiple times
  • Having a single class for all spice bodies ensures they're all using the same reference point (we woldn't want to reference relative to earth sometimes and the sun others)

By default, the Spice Manager will select the central body to be Earth, if the Earth is present in the simulation. If Earth is not present, the Spice Manager will select its central body as the largest body present in the simulation by mass. (i.e. Sun > Venus)

If the user desires a different central body than the one chosen by the SPICE manager, the central body may be set via setCentralBody. This will override the default behavior.

Member Function Documentation

◆ centralBody()

std::string modelspace::SpiceManager::centralBody ( )
inline

Function to output the current central body.

Returns
The current central body

◆ getBodyFrameName()

std::string modelspace::SpiceManager::getBodyFrameName ( const std::string &  body_name)

Get the frame name associated with a body.

Parameters
body_nameThe body name to query
Returns
The string name associated with the body – empty string if body is not found

◆ getGravitationalParameter()

double modelspace::SpiceManager::getGravitationalParameter ( const std::string &  body_name)

Function to return the gravitational parameter for a SPICE body.

Parameters
body_nameThe body name to return gravitational parameter for
Returns
The gravitational parameter in km^3/s^2

◆ getSpiceAngularVelocity()

clockwerk::CartesianVector< double, 3 > modelspace::SpiceManager::getSpiceAngularVelocity ( const std::string &  body_name,
double  tdb_time 
)

Function to return the angular velocity of a SPICE body relative to central body.

Parameters
body_nameThe body name to query
tdb_timeThe ephemeris time to query state position
Returns
The J2000 angular velocity of the SPICE body relative to central body in rad/s

◆ getSpiceAttitude()

clockwerk::DCM< double > modelspace::SpiceManager::getSpiceAttitude ( const std::string &  body_name,
double  tdb_time 
)

Function to return the attitude of a SPICE body relative to central body.

Parameters
body_nameThe body name to query
tdb_timeThe ephemeris time to query state position
Returns
The J2000 attitude of the SPICE body relative to central body as a DCM

◆ getSpicePosition()

clockwerk::CartesianVector< double, 3 > modelspace::SpiceManager::getSpicePosition ( const std::string &  body_name,
double  tdb_time 
)

Function to return the position of a SPICE body relative to central body.

Parameters
body_nameThe body name to query
tdb_timeThe ephemeris time to query state position
Returns
The J2000 position of the SPICE body relative to central body in km

◆ getSpiceVelocity()

clockwerk::CartesianVector< double, 3 > modelspace::SpiceManager::getSpiceVelocity ( const std::string &  body_name,
double  tdb_time 
)

Function to return the velocity of a SPICE body relative to central body.

Parameters
body_nameThe body name to query
tdb_timeThe ephemeris time to query state position
Returns
The J2000 velocity of the SPICE body relative to central body in km/s

◆ loadKernels()

void modelspace::SpiceManager::loadKernels ( std::vector< std::string >  kernel_list)

A function to load in a list of SPICE kernels.

Parameters
kernel_listA vector list of kernel files to load

◆ registerSpiceBody()

void modelspace::SpiceManager::registerSpiceBody ( const std::string &  body_name)

Function to register a spice body with the spice manager.

Parameters
body_nameThe SPICE body name to register

◆ setCentralBody()

void modelspace::SpiceManager::setCentralBody ( const std::string &  central_body)

Function to set the central body in the SPICE manager.

Parameters
central_bodyThe central body to set

The documentation for this class was generated from the following files: