FSW Base

Basic FSW model for BSK-RL.

action(func: Callable[[...], None]) Callable[[Callable[[...], None]], Callable[[...], None]][source]

Decorator to reset the satellite software before executing an action.

Each time an action is called, the FSW tasks and dynamics models call their reset_for_action methods to ensure that the satellite is in a consistent state before the action is executed.

Action functions are typically called by Actions to task the satellite.

Parameters:

func (Callable[[...], None])

Return type:

Callable[[Callable[[…], None]], Callable[[…], None]]

class FSWModel(satellite: Satellite, fsw_rate: float, priority: int = 100, **kwargs)[source]

Bases: ABC

The abstract base flight software model.

One FSWModel is instantiated for each satellite in the environment each time the environment is reset and new simulator is created.

Parameters:
  • satellite (Satellite) – Satellite modelled by this model

  • fsw_rate (float) – [s] Rate of FSW simulation.

  • priority (int) – Model priority.

  • kwargs – Passed to task creation functions

property simulator: Simulator

Reference to the episode simulator.

property world: WorldModel

Reference to the episode world model.

property dynamics: DynamicsModel

Reference to the satellite dynamics model for the episode.

is_alive(log_failure=False) bool[source]

Check if the FSW model has failed any aliveness requirements.

Returns:

True if the satellite FSW is still alive.

Return type:

bool

class Task(fsw: FSWModel, priority: int)[source]

Bases: ABC

Template class for defining FSW processes.

Each FSW process has a task associated with it, which handle certain housekeeping functions.

Parameters:
  • fsw (FSWModel) – FSW model task contributes to

  • priority (int) – Task priority

name: str
create_task() None[source]

Add task to FSW with a unique name.

Return type:

None

reset_for_action() None[source]

Housekeeping for task when a new action is called.

Disables task by default, can be overridden by subclasses.

Return type:

None

class BasicFSWModel(satellite: Satellite, fsw_rate: float, priority: int = 100, **kwargs)[source]

Bases: FSWModel

The abstract base flight software model.

One FSWModel is instantiated for each satellite in the environment each time the environment is reset and new simulator is created.

Parameters:
  • satellite (Satellite) – Satellite modelled by this model

  • fsw_rate (float) – [s] Rate of FSW simulation.

  • priority (int) – Model priority.

  • kwargs – Passed to task creation functions

action_drift() None[source]

Decorated with action

Disable all tasks and do nothing.

Return type:

None

class SunPointTask(fsw, priority=99)[source]

Bases: Task

Task to generate a sun-pointing reference.

Parameters:

fsw (FSWModel)

name: str = 'sunPointTask'
setup_sun_pointing(nHat_B: Iterable[float], **kwargs) None[source]

Configure the solar array sun-pointing task.

Parameters:
  • nHat_B (Iterable[float]) – Solar array normal vector.

  • kwargs – Passed to other setup functions.

Return type:

None

action_charge() None[source]

Decorated with action

Charge battery by pointing the solar panels at the sun.

Return type:

None

class NadirPointTask(fsw, priority=98)[source]

Bases: Task

Task to generate nadir-pointing reference.

Parameters:

fsw (FSWModel)

name: str = 'nadirPointTask'
class RWDesatTask(fsw, priority=97)[source]

Bases: Task

Task to desaturate reaction wheels using thrusters.

Parameters:

fsw (FSWModel)

name: str = 'rwDesatTask'
setup_thruster_mapping(controlAxes_B: Iterable[float], thrForceSign: int, **kwargs) None[source]

Configure the thruster mapping.

Parameters:
  • controlAxes_B (Iterable[float]) – Control unit axes.

  • thrForceSign (int) – Flag indicating if pos (+1) or negative (-1) thruster solutions are found.

  • kwargs – Passed to other setup functions.

Return type:

None

setup_momentum_dumping(hs_min: float, maxCounterValue: int, thrMinFireTime: float, desatAttitude: str | None, **kwargs) None[source]

Configure the momentum dumping algorithm.

Parameters:
  • hs_min (float) – [N*m*s] Minimum RW cluster momentum for dumping.

  • maxCounterValue (int) – Control periods between firing thrusters.

  • thrMinFireTime (float) – [s] Minimum thruster firing time.

  • desatAttitude (str | None) –

    Direction to point while desaturating:

    • "sun" points panels at sun

    • "nadir" points instrument nadir

    • None disables attitude control.

  • kwargs – Passed to other setup functions.

Return type:

None

reset_for_action() None[source]

Disable power draw for thrusters when a new action is selected.

Return type:

None

action_desat() None[source]

Decorated with action

Charge while desaturating reaction wheels.

This action maneuvers the satellite into desatAttitude, turns on the thruster power sink, and enables the desaturation tasks. This action typically needs to be called multiple times to fully desaturate the wheels.

Return type:

None

class TrackingErrorTask(fsw, priority=90)[source]

Bases: Task

Task to convert an attitude reference to guidance.

Parameters:

fsw (FSWModel)

name: str = 'trackingErrTask'
class MRPControlTask(fsw, priority=80)[source]

Bases: Task

Task to control the satellite with reaction wheels.

Parameters:

fsw (FSWModel)

name: str = 'mrpControlTask'
setup_mrp_feedback_rwa(K: float, Ki: float, P: float, **kwargs) None[source]

Set the MRP feedback control properties.

Parameters:
  • K (float) – Proportional gain.

  • Ki (float) – Integral gain.

  • P (float) – Derivative gain.

  • kwargs – Passed to other setup functions.

Return type:

None

setup_rw_motor_torque(controlAxes_B: Iterable[float], **kwargs) None[source]

Set parameters for finding motor torque from the control law.

Parameters:
  • controlAxes_B (Iterable[float]) – Control unit axes.

  • kwargs – Passed to other setup functions.

Return type:

None

reset_for_action() None[source]

MRP control is enabled by default for all tasks.

Return type:

None

class SteeringFSWModel(*args, **kwargs)[source]

Bases: BasicFSWModel

FSW extending attitude control to use MRP steering instead of MRP feedback.

This class replaces the simple attitude feedback control law with a more sophisticated MRP steering control law.

class MRPControlTask(fsw, priority=80)[source]

Bases: Task

Task to control the satellite with reaction wheels.

Parameters:

fsw (FSWModel)

name: str = 'mrpControlTask'
setup_mrp_steering_rwa(K1: float, K3: float, omega_max: float, servo_Ki: float, servo_P: float, **kwargs) None[source]

Define the control properties.

Parameters:
  • K1 (float) – MRP steering gain.

  • K3 (float) – MRP steering gain.

  • omega_max (float) – [rad/s] Maximum targetable spacecraft body rate.

  • servo_Ki (float) – Servo gain.

  • servo_P (float) – Servo gain.

  • kwargs – Passed to other setup functions.

Return type:

None

setup_rw_motor_torque(controlAxes_B: Iterable[float], **kwargs) None[source]

Define the motor torque from the control law.

Parameters:
  • controlAxes_B (Iterable[float]) – Control unit axes.

  • kwargs – Passed to other setup functions.

Return type:

None

reset_for_action() None[source]

Keep MRP control enabled on action calls.

Return type:

None