WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warptwin::SpicePlanet Class Reference

High fidelity planet model using the JPL cspice framework under the hood for ultra accurate states. More...

#include <SpicePlanet.h>

Inheritance diagram for warptwin::SpicePlanet:

Public Member Functions

START_PARAMS SIGNAL (enable_attitude, int, true) END_PARAMS START_INPUTS END_INPUTS START_OUTPUTS SIGNAL(self_id
START_PARAMS GraphTreeObject nullptr SIGNAL (inertial_frame, Frame *, nullptr) SIGNAL(rotating_frame
START_PARAMS GraphTreeObject nullptr Frame nullptr SIGNAL (eq_radius, double, warpos::earth_wgs84.eq_radius) SIGNAL(flattening
START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening SIGNAL (mu, double, warpos::earth_wgs84.mu) SIGNAL(J2
START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 SIGNAL (J3, double, warpos::earth_wgs84.J3) SIGNAL(mean_ang_vel
START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 CartesianVector3 ({0.0, 0.0, warpos::earth_wgs84.mean_ang_vel})) END_OUTPUTS SpicePlanet(SimulationExecutive &e
 ~SpicePlanet ()
Public Member Functions inherited from warptwin::Model
 Model (Model &pnt, int16 schedule_slot, const std::string &m_name="Unnamed")
 Task-based constructor for the task. Auto-assigns executive.
 Model (SimulationExecutive &executive, int16 schedule_slot, const std::string &m_name="Unnamed")
 Executive-based constructor for the task.
virtual ~Model ()
 Desrtuctor. Doesn't really do anything.
std::vector< std::string > listDefaultConfigs ()
 List all default options for the model type.
int configureFromDefault (const std::string &default_name)
 Configure model from a default configuration.
int configureFromJson (const std::string &file_path)
 Configure model from a json file with keys as params of the model.
int configureFromJson (nlohmann::json j)
 Configure model from a json file with keys as params of the model.
virtual nlohmann::json asJson ()
 Get model information as json.
void dump ()
 Dump all information associated with the model.
Public Member Functions inherited from warpos::App
 App (FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
 Executive-based constructor for the task.
virtual ~App ()
 Destructor. Doesn't really do anything.
int16 startup ()
 Initialize the app. Should be called once before step.
int16 step ()
 Step the app by a single step. Maps params, inputs, etc. to outputs.
virtual int16 activate ()
 Activate the app. The app will step when active.
virtual int16 deactivate ()
 Deactivate the app. The app will not step when deactivated.
virtual int16 command (uint16 apid, uint8 *buffer, uint16 size)
 Process commands issued to the app.
log_level_e logLevel ()
 Get the log level set for the executive.
void logLevel (log_level_e log_level)
 Set the executive log level.
bool isStarted ()
 Return whether task startup has been run.
uint16 apid ()
 Get the apid for this app.
uint8 & instance ()
 Get the instance of this app (used to differentiate between multiple instances of the same app).
Public Member Functions inherited from clockwerk::GraphTreeObject
 GraphTreeObject (const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0)
 Name-based constructor for GraphTreeObject which will have no children by default.
virtual ~GraphTreeObject ()
 Destructor.
GraphTreeObjectparent ()
 Functions to get object's parent/children.
GraphTreeObject ** children ()
GraphTreeObjectchildAtIndex (uint8 i) const
int16 parent (GraphTreeObject *new_parent)
 Function to assign the node's parent via pointer.
int16 parent (GraphTreeObject &new_parent)
 Function to assign the node's parent via reference.
uint8 nChildren () const
 Getters for number of children and descendants.
uint16 nDescendants () const
uint8 capacity () const
const char * name () const
 Getter and setter for object name.
int16 name (const char *new_name)
uint8 rank ()
 Getter for the object rank.
int8 type ()
 Function to indicate type – -1 by default unless implemented downstream.
bool loggable ()
 Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition.
GraphTreeObjectgetRootDataPointer ()
 Get the pointer to the highest object in the graph tree.
virtual int16 str (char *output, size_t size) const
 Get object represented as string.
virtual int16 fromStr (const char *val)
 Set value of graphtreeobject from string.

Public Attributes

START_PARAMS GraphTreeObject nullptr Frame nullptr double
START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening double
START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 CartesianVector3
START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 const std::string & m_name ="earth")
Public Attributes inherited from warpos::App
clockwerk::DataIO< bool > active = clockwerk::DataIO<bool>(this, "active", true)
 The active flag for the task – set to true by default.

Protected Member Functions

int16 start () override
int16 execute () override
Protected Member Functions inherited from warptwin::Model
virtual std::string classType ()
 Return the name of the class type.
Protected Member Functions inherited from clockwerk::GraphTreeObject
int16 _setStorage (GraphTreeObject **storage_array, uint8 storage_size)
 Getter for object's string address.
void _recalculateDescendants ()
 Function to recursively re-calculate the number of descendants of a given node on the tree.
void _recalculateRank ()
 Function to recursively re-calculate the rank of a given node on the tree.
int16 _addChild (GraphTreeObject *child)
 Function to decompose a string into a series of substrings via indexing.
int16 _removeChild (GraphTreeObject *child)
 Function to remove a child from the graph node's children.

Protected Attributes

Frame _planet_inertial = Frame("planet_inertial_frame")
Frame _planet_rotating = Frame("planet_rotating_frame")
clockwerk::DCM _tmp_dcm_p_pci
CartesianVector3 _tmp_vec
std::string _attitude_name
Protected Attributes inherited from warptwin::Model
SimulationExecutiveexc
std::string _default_configuration_name = ""
 Hold default configuration name model is defined from.
int16 _schedule_slot = 0
 Internal variable to hold schedule slot for model.
Protected Attributes inherited from warpos::App
FlightExecutiveexc
 Override our executive to include the FlightExecutive instead.
int16 _error = 0
 Internal variable to track and return error on app step through.
uint16 _apid = 0
 Internal variable to hold the APID for this app.
bool _is_started = false
 Flag indicating whether app has been started or not.
log_level_e _local_log_level = log_level_e::LOG_WARNING
 The log level for this particular app.
GraphTreeObject_app_children [MAXIMUM_APP_CHILDREN]
 Local storage for App children so it can live on the graph tree.
uint8 _instance
 Instance number of this app. Used to differentiate between multiple instances of the same app.
Protected Attributes inherited from clockwerk::GraphTreeObject
GraphTreeObject_parent = nullptr
GraphTreeObject ** _children_ptr = nullptr
uint32 _max_num_children = 0
uint16 _num_descendants = 0
char _name [MAXIMUM_NAME_CHARS] = ""
 String name for object.
uint8 _num_children = 0
 Number of direct children of the tree (not including the tree itself).
uint8 _rank = 0
int8 _graph_tree_type = BASE_GRAPH_TREE
 Variable to store graph tree object type.
bool _loggable = false
 Variable to indicate whether the selected object is loggable. Set to false by default.
uint32 _index = 0
 Index pointing to the next write location for the graph tree children.

Detailed Description

High fidelity planet model using the JPL cspice framework under the hood for ultra accurate states.

The SPICE planet mode uses the JPL cspice framework to generate highly precise planet state.

All planet states are set with the inertial state aligned to the J2000 frame. The rotating frame is then set at the same position. The root frame is treated as the base of the J2000 frame used in SPICE, as observed from the Sun. All states are set relative to that point using the TDB time maintained by the simulation.

Note that output values semimajor_axis, flattening, mu, J2, J3, and mean angular velocity, are not necessarily loaded from SPICE. Those parameters are first searched in the file clockwerk/utils/planetdefaults.h, which currently defines defaults for all planets, Earth's Moon, and the Sun. If parameters are not found there, then J2, J3, flattening, mu and semimajor_axis are set to zero.

All DISTANCE units are meters or meters/second All ANGULAR RATE units are radians/second

Author: Alex Reynolds alex..nosp@m.reyn.nosp@m.olds@.nosp@m.attx.nosp@m..tech

Constructor & Destructor Documentation

◆ ~SpicePlanet()

warptwin::SpicePlanet::~SpicePlanet ( )

Member Function Documentation

◆ CartesianVector3()

START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 warptwin::SpicePlanet::CartesianVector3 ( {0.0, 0.0, warpos::earth_wgs84.mean_ang_vel} ) &

◆ execute()

int16 warptwin::SpicePlanet::execute ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

◆ SIGNAL() [1/5]

START_PARAMS warptwin::SpicePlanet::SIGNAL ( enable_attitude ,
int ,
true  )

This flag enables or disables outputting attitude states from the SPICE planet. True is enabled A pointer to the spice planet object itself for easy passing to other models. Is a void pointer and must be cast in downstream model. Nullptr is set to self in constructor.

◆ SIGNAL() [2/5]

START_PARAMS GraphTreeObject nullptr Frame nullptr warptwin::SpicePlanet::SIGNAL ( eq_radius ,
double ,
warpos::earth_wgs84. eq_radius )

Equatorial radius of the planet, in meters. Default is Earth R per WGS84, in meters. This value is set to point to the defaults identified in clockwerk/planetdefaults. Flattening for the planet. Default is WGS84 flattening. This value is set to point to the defaults identified in clockwerk/planetdefaults.

◆ SIGNAL() [3/5]

START_PARAMS GraphTreeObject nullptr warptwin::SpicePlanet::SIGNAL ( inertial_frame ,
Frame * ,
nullptr  )

Accessor to the inertial frame of the planet. Set to point to _planet_inertial in constructor. Accessor to the rotating frame of the planet. Set to point to _planet_inertial in constructor.

◆ SIGNAL() [4/5]

START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 warptwin::SpicePlanet::SIGNAL ( J3 ,
double ,
warpos::earth_wgs84. J3 )

J3 parameter for planet. Default is derived from WGS84 but inexact. This value is set to point to the defaults identified in clockwerk/planetdefaults. Mean angular velocity of the planet. Assumes rotation about Z axis. Default is WGS84 Earth in rad/s. This value is set to point to the defaults identified in clockwerk/planetdefaults.

◆ SIGNAL() [5/5]

START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warptwin::SpicePlanet::SIGNAL ( mu ,
double ,
warpos::earth_wgs84. mu )

Gravitational parameter for planet. Default is WGS84 value, in m^3/s^2. This value is set to point to the defaults identified in clockwerk/planetdefaults. J2 parameter for planet. Default is derived from WGS84 but inexact. This value is set to point to the defaults identified in clockwerk/planetdefaults.

◆ start()

int16 warptwin::SpicePlanet::start ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

Member Data Documentation

◆ _attitude_name

std::string warptwin::SpicePlanet::_attitude_name
protected

◆ _planet_inertial

Frame warptwin::SpicePlanet::_planet_inertial = Frame("planet_inertial_frame")
protected

◆ _planet_rotating

Frame warptwin::SpicePlanet::_planet_rotating = Frame("planet_rotating_frame")
protected

◆ _tmp_dcm_p_pci

clockwerk::DCM warptwin::SpicePlanet::_tmp_dcm_p_pci
protected

◆ _tmp_vec

CartesianVector3 warptwin::SpicePlanet::_tmp_vec
protected

◆ CartesianVector3

START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 warptwin::SpicePlanet::CartesianVector3

◆ double [1/2]

START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warptwin::SpicePlanet::double

◆ double [2/2]

START_PARAMS GraphTreeObject nullptr Frame nullptr warptwin::SpicePlanet::double

◆ m_name

START_PARAMS GraphTreeObject nullptr Frame nullptr warpos::earth_wgs84 flattening warpos::earth_wgs84 J2 const std::string& warptwin::SpicePlanet::m_name ="earth")

The documentation for this class was generated from the following files:
  • /Users/mickey/Documents/Projects/warptwin/cpp/src/models/assemblies/SpicePlanet.h
  • /Users/mickey/Documents/Projects/warptwin/cpp/src/models/assemblies/SpicePlanet.cpp