Integrated Example Scripts
Integrated Example Scripts
To learn how to use Basilisk it is often convenient to study sample scripts and see how they were implemented. Below are a series of example Basilisk scripts grouped by topics and complexity. In each script the primary simulation is executed by the run method. The reader can learn from this implementation and the numerous associated in-line comments. The first sections illustrate how to setup simple spacecraft simulations and then the following sections begin to add more complexity.
The example script source code can be viewed directly within the browser by clicking on the Source link next to the run method name as shown in the image below:
The python code contains additional comments to explain what is being setup and tested here. The example instructions are all stored as extensive comments within the python script. Read the script source to study how this example functions.
Orbital Simulations
- Basic Orbit Simulations
- Delta_v Orbit Maneuvers
- Hyperbolic Jupiter Arrival Orbit
- Multiple Gravitational Bodies
- Verifying Spherical Harmonic Propagation Consistency
- Lagrange Point Orbits
- Defining Motion Relative to Planet
- Simulating Trajectory about Multiple Celestial Bodies
- Including Custom Gravitational Bodies
- Near-Halo Orbit Simulation
- Showing Ground Tracks on a Planet
Attitude Simulations
Attitude Regulation Control
- Inertial Attitude Pointing
- Inertial Attitude Pointing with Numba FSW
- Using Separate Task Group for Control
- Basic Attitude Pointing in Deep Space
- Basic Attitude Pointing in Deep Space with Numba Control
- Complex Attitude Pointing in Deep Space
- Sun-Pointing Constraint Violation in Space
- Inertial Pointing with Spice prescribed translational motion
- Basic attitude pointing flight mode with Hohmann transfer
- Thrusted Hohmann Transfer Maneuver
Attitude Guidance
- Hill Frame Pointing on Elliptic Orbit
- Velocity Frame Pointing on Hyperbolic Orbit
- Pointing at Earth Location
- Prescribing the spacecraft orientation
- Layered spiral attitude guidance
- Constrained Attitude Maneuver Guidance
- Performing Sweeping Maneuvers
- Earth Strip Imaging Tasks
Attitude Control with Actuators
- Pointing with Reaction Wheels
- Pointing with Attitude State Effector Thrusters
- Pointing with Attitude Dynamic Effector Thrusters
- Reaction Wheel Momentum Dumping using Thrusters
- Continuous Momentum Management using Dual-Gimbaled Electric Thruster
Attitude Steering Control
Orbit Control
Planetary Environments
Magnetic Field Models
Gravity Gradient Torque
Atmospheric Drag
Access to Communication Locations
- Satellite communicating to Earth ground station
- Satellite checking communication access to another satellite
Planet Albedo
Spacecraft Sensors
Coarse Sun Sensors
Three-Axis Magnetometers
- Adding a Three-Axis Magnetometer (TAM)
- RW Momentum Management using TAMs and MTBs
- RW Momentum Management using TAMs and MTBs Using desired Nominal RW Speed
- TAM Comparison
Spacecraft Sub-Systems
Power Sub-System
Data Sub-System
Thermal Sub-System
Multi-Body Dynamics Simulations with MuJoCo
It’s recommended to study the first 6 scenarios in order:
- CubeSat with Reaction Wheel
- CubeSat with 4 Unbalanced Thrusters and Fuel Tanks
- Branching Deployable Arm with Thrusters
- Chained Hinged Panel Deployment
- Solar Radiation Pressure Model on Arbitrary Surfaces
- Landing on Asteroid with Contact Physics
- Earth-Moon Gravity with SPICE or PlanetEphemeris
- Optimizing SPICE Cost with Ephemeris Reconstruction (Position)
- Optimizing SPICE Cost with Ephemeris Reconstruction (Orientation)
- Docking between Two CubeSats
- Branching Panel Deployment with Locking Mechanisms
- Pointing with Reaction Wheels in MuJoCo
- Translation-only formation flying under differential drag
- Satellite Drag with Stochastic (Random) Density using MuJoCo
- Spacecraft Control with Thruster Arms using MuJoCo
- Combining MuJoCo Scenes and a Spacecraft in Vizard
Support Files
Comparing the Backsubstitution Method and MuJoCo Dynamics Engines
These scenarios validate and benchmark the Backsubstitution C++ Module: spacecraft against the MuJoCo-based MJScene on equivalent problems of increasing complexity, best studied in order. Start with the overview for build requirements, execution order, expected artifacts, approximate runtimes, and interpretation limits.
- Comparison Overview and Execution Guide
- Keplerian Orbit Baseline
- Rigid Body with Constant Torque
- Hub with Reaction Wheels and Hinged Panels
- Lumped-Mass Flexible Panels and Runtime Scaling
- Multi-Body in Orbit with Gravity-Gradient Torque
- Variable-Mass Fuel Slosh and Depletion
- Accuracy vs Runtime Pareto Front (Reaction Wheels and Panels)
- Accuracy vs Runtime Pareto Front (Stiff Flexible Panels)
Research Sweeps and Publication Tools
These drivers probe numerical mechanisms, parameter sensitivity, and publication artifacts rather than serving as introductory tutorials.
- Integrator-Step Sweep (Keplerian Orbit)
- Velocity-Regime Round-Off Sweep (Constant Torque)
- Torque-Artifact Mechanism Checks
- Bookkeeping-Mass Sweep (Reaction Wheels)
- Slosh-Displacement Metric (Variable Mass)
- Pendulum-Inertia and Step Sweep (Variable Mass)
- Paper Figure Rendering
Constrained Spacecraft Dynamics Simulations
- Two Spacecraft Connected Using Holonomic Constraints
- Constraint Gain Tuning Analysis With Maneuvers
- Constrained Motion Component Analysis Using a Truth Model
- Frequency Analysis of Solar Panel Resonance Using the Constraint Effector
Complex Spacecraft Dynamics Simulations
- IMU Gyro Random Walk
- Fuel Slosh
- Flexible (Hinged) Panels
- Bending and Torsional Flexible Panels
- Sensors Attached to a Rotating Panel
- Hinged Panel Deployment
- MSM Simulation of Charged Spacecraft
- Spacecraft with 1- or 2-DOF Panel using single effector
- Robotic Arm Effector with Profiler
- Spacecraft with an multi-link extending component
- Solar Array Debris Impact
Prescribed Motion Spacecraft Dynamics Simulations
- Prescribed Helical Screw Motion
- Prescribed Motion Rotational Solar Array Deployment
- Prescribed Motion with Translating Effector Branching
- Prescribed Motion with Rotating Effector Branching
Mission Simulations
- Heliocentric Translation Using Custom Spice Files
- Planetary Flybys Using Custom Spice File
- Asteroid Arrival
- Aerocapture Scenario
Spacecraft Formation Flying
- Basic Servicer/Debris Simulation
- Mean orbit element based relative motion control
- Impulsive feedback control of relative motion
- Electrostatic Tractor Debris Reorbiting
- Attitude-Driven differential drag control
- Servicer approaching a debris object with 3 flight modes
- Walker-Delta Satellite Constellation
Small Body Navigation Simulations
- Proximity Operations Hybrid EKF
- Non-Keplerian Acceleration Estimation using UKF
- Landmarks-based Navigation
bskSim() Architecture
Single Satellite
- 1. Basic Orbital Simulation
- 2. Attitude Detumble Control with RW
- 3. Hill Pointing Attitude Control
- 4. Velocity Frame Pointing Control
- 5. MRP Steering Attitude Control
- 6. Sun Pointing Mode Include Eclipse Evaluation
- 7. Alternating FSW Attitude Pointing Modes
- 8. Reaction Wheel Fault Scenario Simulation
- 9. Lambert Guidance Scenario
- 10. Attitude Control
- 11. Fault Simulation
Satellite Formation
Support Files
MultiSatBskSim() Architecture
Scenarios
- 1. Three-Spacecraft Formation using MultiSat architecture
- 2. Attitude Guidance Modes Scheduling
- 3. Formation Flying Control
- 4. Constellation from TLE
Support Files
Optical Navigation Simulations
Scenarios
- 1. BSK OpNav Sim Master File
- 2. Hough Circles for Pointing and Orbit Determination
- 3. Limb-based method for Pointing and Orbit Determination
- 4. CNN for Pointing and Orbit Determination
- 5. Perform fault detection with two OpNav methods
- 6. Orbit Determination with Hough Circles
- 7. Orbit Determination with Limb-based method
- 8. Pointing with Hough Circles
- 9. Pointing with Limb-based method
- 10. Filter Heading measurements
Support Files
CNN Image Generation
CNN Image Generation
- Monte-Carlo Simulations using a OpNav Scenario
- Optical Limb Tracking Scenario
- Optical Navitation Scenario
Monte Carlo Simulations
- MC run with RW control
- MC run using Python Spice setup
- MC bskSim example folder with bokeh visualization
- Sensitivity Analysis of a differential drag spacecraft control
Advanced Simulation Options
- Setting Type of Integrator
- Using a Variable Time Step Integrator
- Comparison of different integrators
- Benchmark Numba Models
- Using a Python BSK Module Inherited from SysModel Class
- Changing the bskLog Verbosity from Python
