scenarioStochasticDrag
This scenario uses MJScene as its DynamicObject, although it is
not its main focus. For context on dynamics using MJScene, check out:
examples/mujoco/scenarioReactionWheel.py
This script shows how to simulate a point-mass spacecraft using MJScene (mujoco-based dynamics) with cannonball drag force and a stochastic atmospheric density model. The script illustrates how one defines and handles dynamic states that are driven by stochastic terms.
The spacecraft definition is given in CANNONBALL_SCENE_XML; it contains a single
body for which we set its mass directly. We use the Module: NBodyGravity model to compute
the gravity acting on this body due to a point-mass Earth.
The drag force acting on the body is computed in the CannonballDrag module. This takes as input the state of the spacecraft (so that its velocity and orientation) and the atmospheric density. It outputs a force vector on the body-fixed reference frame (more accurately, the body’s center of mass frame/site).
The atmospheric density used on the drag model is given by:
where densityExponential is computed by the Module: exponentialAtmosphere model
while densityCorrection (written above as \(\delta_\rho\)) is a stochastic process centered at zero. This process
is modeled as an Ornstein-Uhlenbeck (OU) process, whose Stochastic Differential
Equation (SDE) is given by:
where theta and sigma are the terms that characterize the OU process.
In the SDE above, -theta*densityCorrection represents the ‘drift’ term (the
classical derivative). sigma, on the other hand, represents the ‘diffusion’
term, which maps the influence of the noise to the state.
The densityStochastic and densityCorrection are computed in
StochasticAtmDensity, which is based on
MeanRevertingNoise.
Illustration of Simulation Results
The following images illustrate a possible simulation result.
The orbit is plotted in the orbital plane:
The altitude as a function of time is plotted.
The atmospheric density as a function of altitude is plotted in lin-log space. This shows two lines: the deterministic, exponential density (should appear linear); and the stochastic density.
The atmospheric density correction, which should have a standard deviation of 0.15.
The magnitude of drag force over time is plotted in lin-log space.
- scenarioStochasticDrag.plotOrbits(timeAxis, posData, velData, dragForce, deterministicDenseData, denseData, oe, mu, planetRadius)[source]
Plot the results of the stochastic drag simulation, including orbit, altitude, density, density difference, and drag force over time.
- Parameters:
timeAxis – Array of time values.
posData – Position data array.
velData – Velocity data array.
dragForce – Drag force data array.
deterministicDenseData – Deterministic atmospheric density data.
denseData – Stochastic atmospheric density data.
oe – Classical orbital elements object.
mu – Gravitational parameter.
planetRadius – Radius of the planet.
- Returns:
Dictionary of matplotlib figure objects.