Simulation (BSK)

bsk_rl.sim is a package for the underlying Basilisk simulation.

The simulation is divided into three categories of Basilisk models:

  • World Sims, capturing elements of the simulation environment common to all satellites. This includes things such as gravity and atmosphere models, the epoch, and ground station locations. While the world model can be specified in the GeneralSatelliteTasking constructor, it is generally automatically inferred from the satellite requirements.

  • Dynamics Sims, representing the dynamics model for each satellite. This is specified on a per-satellite basis by the Satellite type definition. The dynamics model captures the properties of the satellite, such as physical configurations, actuators models, instrument models, the power system, and storage resources.

  • FSW Sims, representing the flight software models for each satellite. As with flight software, this specified by the Satellite. The flight software model represents the low-level algorithms used for actuator and instrument control.

Generally, this can be thought of as a hierarchy of models, with dynamics models acting in the world model, and flight software models controlling the dynamics models, and other parts of bsk_rl controlling the flight software models. This hierarchy contributes to the realism of the simulation, as the satellite is being controlled through its flight software.

The Simulator is the main class for the simulation environment, subclassing from the Basilisk SimBaseClass. At each environment reset, the simulator and the associated flight software, dynamics, and world models are deleted and reconstructed, generating a fresh Basilisk simulation.

class Simulator(satellites: list[Satellite], world_type: type[WorldModel], world_args: dict[str, Any], sim_rate: float = 1.0, max_step_duration: float = 600.0, time_limit: float = inf)[source]

Bases: SimBaseClass

Basilisk simulator for satellite tasking environments.

The simulator is reconstructed each time the environment reset is called, generating a fresh Basilisk simulation.

Parameters:
  • satellites (list[Satellite]) – Satellites to be simulated

  • world_type (type[WorldModel]) – Type of world model to be constructed

  • world_args (dict[str, Any]) – Arguments for world model construction

  • sim_rate (float) – [s] Rate for model simulation.

  • max_step_duration (float) – [s] Maximum time to propagate sim at a step.

  • time_limit (float) – [s] Latest time simulation will propagate to.

finish_init() None[source]

Finish simulator initialization.

Return type:

None

property sim_time_ns: int

Simulation time in ns, tied to SimBase integrator.

property sim_time: float

Simulation time in seconds, tied to SimBase integrator.

setup_vizard(vizard_rate=None, vizSupport=None, **vizard_settings)[source]

Setup Vizard for visualization.

set_vizard_epoch(vizInstance=None)[source]

Set the Vizard epoch.

run() None[source]

Propagate the simulator.

Propagates for a duration up to the max_step_duration, stopping if the environment time limit is reached or an event is triggered.

Return type:

None

delete_event(event_name) None[source]

Remove an event from the event map.

Makes event checking faster. Due to a performance issue in Basilisk, it is necessary to remove created for tasks that are no longer needed (even if it is inactive), or else significant time is spent processing the event at each step.

Return type:

None