scenarioCustomGravBody

Overview

Demonstrates how to setup a custom gravity object in Basilisk that is not directly supported by the simIncludeGravBody.py file. In this simulation the sun is created using standard values, the Earth is created using custom values, and the asteroid Itokawa is created with custom values.

../_images/scenarioCustomGravObject.jpg

Further, the Vizard binary file is setup to load up a custom CAD model for the asteroid. The spacecraft orbit is defined relative to the asteroid. Note, this feature requires Vizard version 1.8 or higher.

The script is found in the folder basilisk/examples and executed by using:

python3 scenarioCustomGravBody.py

The simulation layout is shown in the following illustration. A single simulation process is created which contains both modules.

../_images/test_scenarioCustomGravBody.svg

Module: planetEphemeris is used to create the planet ephemeris states. The sun is assumed to be stationary, while Earth is on a circular orbit and Itokawa is on its elliptical heliocentric orbit.

The method createCustomGravObject() is used to create the BSK grav bodies for both earth and Itokawa. The earth body is already supported in simIncludeGravBody, but in this script we show how this could be customized. The gravity body ephemeris states are connected to the Module: planetEphemeris planet state output messages.

Finally, the recorded states will all be relative to the inertial origin at the sun. Module: planetEphemeris does not have the zeroBase capability as Module: spiceInterface has. This script also records the asteroid states so that the plot is done of the spacecraft motion relative to the asteroid.

The simulation executes and shows a plot of the spacecraft motion relative to the asteroid.

Illustration of Simulation Results

show_plots = True
../_images/scenarioCustomGravBody1.svg
scenarioCustomGravBody.run(show_plots)[source]

The scenarios can be run with the followings setups parameters:

Parameters:

show_plots (bool) – Determines if the script should display plots