1.3. The Environment During Propagation¶
Each Body
object and its constituent members is updated to the current state and time automatically during the numerical propagation. We stress that only those models that are relevant for a given propagation are updated every time step (this is handled automatically, without user intervention). Some time-dependent properties of the body are set in the environment models themselves. Others are updated and stored directly in the Body
object. Below is a full list of (possibly) time varying environment models, and how to retrieve them from a Body object during propagation.
The current translational state
Retrieved direct from a
Body
object directly, with thegetState
function, as Cartesian elements. Note that this state is always in the global frame origin and orientation (note that separategetPosition
andgetVelocity
functions are also available.
The current rotational state
Retrieved direct from a
Body
object directly. The current orientation is defined by the body’s rotation model, and is retrieved as a quaternion. To get the quaternion to transform a vector from inertial (e.g. with global frame orientation) to the body-fixed frame, thegetCurrentRotationToLocalFrame
can be used. The inverse rotation can be obtained fromgetCurrentRotationToGlobalFrame
. The time-derivative of the orientation is provided in two formulations (with equivalent information content): the angular velocity vector, and the time derivative of the rotation matrix. The angular velocity vector, in inertial and body-fixed coordinates, is obtained from thegetCurrentAngularVelocityVectorInGlobalFrame
andgetCurrentAngularVelocityVectorInLocalFrame
functions respectively. The time-derivative of the rotation matrix from inertial to body-fixed frame is given bygetCurrentRotationMatrixDerivativeToLocalFrame
, while the derivative of the inverse rotation is taken fromgetCurrentRotationMatrixDerivativeToGlobalFrame
The current body mass
Retrieved direct from a
Body
object directly, with thegetBodyMass
function.
Spherical harmonic gravity field coefficients
These coefficients may be time variable (set by using one or more
GravityFieldVariationSettings
). The cosine and sine coefficients can be retrieved from a Body object through its gravity field model. A piece of example code on retrieving these coefficients is given below for the case of Earth:
NamedBodyMap bodyMap = ....
std::shared_ptr< SphericalHarmonicsGravityField > sphericalHarmonicsGravityField =
std::dynamic_pointer_cast< SphericalHarmonicsGravityField >( bodyMap.at( "Earth" ) );
if( sphericalHarmonicsGravityField == nullptr )
{
throw std::runtime_error( "Error when retrieving spherical harmonic coefficients: Earth does not have a SphericalHarmonicsGravityField" );
}
Eigen::MatrixXd cosineCoefficients = sphericalHarmonicsGravityField->getCosineCoefficients( );
Eigen::MatrixXd sineCoefficients = sphericalHarmonicsGravityField->getSineCoefficients( );
Note the check to see if the dynamic_pointer_cast
was succesfull. These checks are very helpful in ascertaining the reason for a crashing program.
Curent flight conditions
The
FlightConditions
class, and its derived classAtmosphericFlightConditions
stores data relating to altitude, flight angles, atmospheric properties, etc. Follow the links for their detailed description. TheFlightConditions
base class pointer is obtained from thegetFlightConditions
function of aBody
object.
Note
As a user, you will typically not access these variables directly. Important examples of cases where users can explicitly access them, are custom aerodynamic or thrust guidance.