scenarioBasicOrbitLivePlot

Overview

This script duplicates the basic orbit simulation in the scenario scenarioBasicOrbit. The difference is that instead of plotting the results after the simulation has stopped in this script a separate thread is created to update the plots live during the simulation run itself. For more information on doing live plotting see help file Live Plotting.

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

python3 scenarioBasicOrbitLivePlot.py

As with scenarioBasicOrbit, different simulation scenarios are setup which are controlled through the simulation flags set at the end of the file.

To enable live plotting with a regular Basilisk simulation additional python packages Pipe, Process must be imported.

Without live plotting you simply call ExecuteSimulation() and plot the logged data. The plotting and logging is done now within the method plot().

If livePlots is true, then a separate process is created to poll the BSK process for data and plot the data incrementally. The live plotting is done with the method live_outputs(). Be cautious in how much data should be plotted live as this can greatly slow down the simulation. Remember that less can be more.

To avoid the live plotting simulation running too fast, a software-based realtime clock module is used with an acceleration factor of 50x.

scenarioBasicOrbitLivePlot.run(showPlots, livePlots, orbitCase, useSphericalHarmonics, planetCase)[source]

At the end of the python script you can specify the following example parameters.

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

  • livePlots (bool) – Determines if the script should use live plotting

  • orbitCase (str) –

    String

    Definition

    ’LEO’

    Low Earth Orbit

    ’GEO’

    Geosynchronous Orbit

    ’GTO’

    Geostationary Transfer Orbit

  • useSphericalHarmonics (Bool) – False to use first order gravity approximation: \(\frac{GMm}{r^2}\)

  • planetCase (str) – {‘Earth’, ‘Mars’}