gravityEffector#

Executive Summary#

Abstract class that is used to implement an effector impacting a GRAVITY body that does not itself maintain a state or represent a changing component of the body (for example: gravity, thrusters, solar radiation pressure, etc.)

The module PDF Description contains further information on this module’s function, how to run it, as well as testing.

Message Connection Descriptions#

The following table lists all the module input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.

Module I/O Messages#

Msg Variable Name

Msg Type

Description

centralBodyOutMsg

SpicePlanetStateMsgPayload

central planet body state output message

The gravity effector contains a list of GravBodyData objects which contain the planet mass and size properties etc. The following table lists the Spice planet ephemeris input message that can be connected to a GravBodyData object. If no message is connected, then the planet has zero position and orientation information by default.

Module I/O Messages#

Msg Variable Name

Msg Type

Description

planetBodyInMsg

SpicePlanetStateMsgPayload

planet spice ephemerisis input message

User Guide#

The user must provide a list of GravBodyData objects to the spacecraft using:

scObject.gravField.gravBodies = spacecraft.GravBodyVector(gravBodyList)

Each gravity body data object can be created using:

earth = gravityEffector.GravBodyData()
earth.planetName = 'earth_planet_data'
earth.mu = 0.3986004415E+15  # meters^3/s^2
earth.radEquator = 6378136.6  # meters
earth.isCentralBody = False

Note that the simIncludeGradBody.py helper file contains a gravity body factor class to facilitate setting up gravity bodies.

class GravityEffector : public SysModel#

gravity effector class

Public Functions

void reset(uint64_t currentSimNanos)#

Initializes every GravBodyData associated with this GravityEffector

void updateState(uint64_t currentSimNanos)#

Updates the central body, loads the ephemeris data for every GravBodyData, and writes the output messages.

void linkInStates(DynParamManager &statesIn)#

Links the correlation between times property

void registerProperties(DynParamManager &statesIn)#

Registers the gravity, inertial position, and inertial velocity properties. It also calls registerProperties for every associated GravBodyData.

void computeGravityField(Eigen::Vector3d r_cF_N, Eigen::Vector3d rDot_cF_N)#

Calculate gravitational acceleration of s/c wrt inertial (no central body) or wrt central body

Parameters:
  • r_cF_N – is position of center of mass of s/c wrt frame

  • rDot_cF_N – is the derivative of above

void updateInertialPosAndVel(Eigen::Vector3d r_BF_N, Eigen::Vector3d rDot_BF_N)#

Updates the inertial position and velocity properties

void updateEnergyContributions(Eigen::Vector3d r_CN_N, double &orbPotEnergyContr)#

Computes the Potential Energy Contributions from every associated GravBodyData

void setGravBodies(std::vector<std::shared_ptr<GravBodyData>> gravBodies)#

Sets the GravBodyData associated with this effector

void addGravBody(std::shared_ptr<GravBodyData> gravBody)#

Adds a GravBodyData associated with this effector

void prependSpacecraftNameToStates()#

Called to modify property names to prepend them by the string stored in nameOfSpacecraftAttachedTo

This can be used to make property names unique between different GravityEffector in a simulation with multiple dynamic objects.

Public Members

std::vector<std::shared_ptr<GravBodyData>> gravBodies#

[-] Vector of bodies we feel gravity from

std::shared_ptr<GravBodyData> centralBody#

Central body

std::string vehicleGravityPropName = "g_N"#

[-] Name of the vehicle gravity acceleration property

std::string systemTimeCorrPropName = "systemTime"#

[-] Name of the correlation between times

std::string inertialPositionPropName = "r_BN_N"#

[-] Name of the inertial position property

std::string inertialVelocityPropName = "v_BN_N"#

[-] Name of the inertial velocity property

std::string nameOfSpacecraftAttachedTo = ""#

[-] Name of the s/c this gravity model is attached to

Message<SpicePlanetStateMsgPayload> centralBodyOutMsg#

central planet body state output message

BSKLogger bskLogger#

— BSK Logging