Actions
Actions bsk_rl.act can be used to add actions to an agent.
To configure the observation, set the action_spec attribute of a Satellite
subclass. For example:
class MyActionSatellite(Satellite):
action_spec = [
Charge(duration=60.0),
Desat(duration=30.0),
Downlink(duration=60.0),
Image(n_ahead_image=10),
]
Actions in an action_spec should all be of the same subclass of Action. The
following actions are currently available:
Discrete Actions
Use DiscreteAction for integer-indexable, discrete actions.
Action |
Count |
Description |
1 |
Call an arbitrary |
|
1 |
Point the solar panels at the sun. |
|
1 |
Do nothing. |
|
1 |
Desaturate the reaction wheels with RCS thrusters. Needs to be called multiple times. |
|
1 |
Downlink data to any ground station that is in range. |
|
≥1 |
Image one of the next |
|
1 |
Scan nadir, collecting data when pointing within a threshold. |
Continuous Actions
Use ContinuousAction for actions with a continuous action space. Currently, satellites
can only have a single continuous action in their action_spec.
Action |
Dimension |
Description |
4 |
Instantaneously change the satellite’s velocity, and drift for some duration. |
|
4 |
Like |
- class Action(name: str = 'act')[source]
Bases:
ABC,ResetableBase class for all actions.
- Parameters:
name (str) – Name of the action.
- class DiscreteAction(name: str = 'discrete_act', n_actions: int = 1)[source]
Bases:
ActionBase class for discrete, integer-indexable actions.
A discrete action may represent multiple indexed actions of the same type.
Optionally, discrete actions may have a
set_action_overridefunction defined. If the action passed to the satellite is not an integer, the satellite will iterate over theaction_specand attempt to callset_action_overrideon each action until one is successful.- Parameters:
name (str) – Name of the action.
n_actions (int) – Number of actions available.
- class DiscreteFSWAction(fsw_action, name=None, duration: float | None = None, reset_task: bool = False)[source]
Bases:
DiscreteActionDiscrete action to task a flight software action function.
This action executes a function of a
FSWModelinstance that takes no arguments, typically decorated with@action.- Parameters:
fsw_action – Name of the flight software function to task.
name – Name of the action. If not specified, defaults to the
fsw_actionname.duration (float | None) – Duration of the action in seconds. Defaults to a large value so that the
GeneralSatelliteTaskingmax_step_durationcontrols step length.reset_task (bool) – If true, reset the action if the previous action was the same. Generally, this parameter should be false to ensure realistic, continuous operation of satellite modes; however, some Basilisk modules may require frequent resetting for normal operation.
- class Charge(name: str | None = None, duration: float | None = None)[source]
Bases:
DiscreteFSWActionAction to enter a sun-pointing charging mode (
action_charge).Charging will only occur if the satellite is in sunlight.
- Parameters:
name (str | None) – Action name.
duration (float | None) – Time to task action, in seconds.
- class Drift(name: str | None = None, duration: float | None = None)[source]
Bases:
DiscreteFSWActionAction to disable all FSW tasks (
action_drift).- Parameters:
name (str | None) – Action name.
duration (float | None) – Time to task action, in seconds.
- class Desat(name: str | None = None, duration: float | None = None)[source]
Bases:
DiscreteFSWActionAction to desaturate reaction wheels (
action_desat).This action must be called repeatedly to fully desaturate the reaction wheels.
- Parameters:
name (str | None) – Action name.
duration (float | None) – Time to task action, in seconds.
- class Downlink(name: str | None = None, duration: float | None = None)[source]
Bases:
DiscreteFSWActionAction to transmit data from the data buffer (
action_downlink).If not in range of a ground station (defined in
GroundStationWorldModel), no data will be downlinked.- Parameters:
name (str | None) – Action name.
duration (float | None) – Time to task action, in seconds.
- class Image(n_ahead_image: int, max_duration: float | None = None, name: str = 'action_image')[source]
Bases:
DiscreteActionActions to image upcoming target (
action_image).Adds
n_ahead_imageactions to the action space, corresponding to the nextn_ahead_imageunimaged targets. The action may be unsuccessful if the target exits the satellite’s field of regard before the satellite settles on the target and takes an image. The action with stop as soon as the image is successfully taken, or when the the target exits the field of regard.This action implements a
set_action_overridethat allows a target to be tasked based on the target’s ID string or the Target object.- Parameters:
n_ahead_image (int) – Number of unimaged, along-track targets to consider.
max_duration (float | None) – Maximum time to task the action, in seconds. If
None, tasks until the end of the next opportunity.name (str) – Action name.
- set_action(action: int, prev_action_key: str | None = None) str[source]
Image a target by local index.
- Parameters:
action (int) – Index of the target to image.
prev_action_key (str | None) – Previous action key.
- Meta_private:
- Return type:
str
- set_action_override(action: Target | str, prev_action_key: str | None = None) str[source]
Image a target by target index, Target, or ID.
- Parameters:
action (Target | str) – Target to image in the form of a Target object, target ID, or target index.
prev_action_key (str | None) – Previous action key.
- Meta_private:
- Return type:
str
- class Scan(name: str | None = None, duration: float | None = None)[source]
Bases:
DiscreteFSWActionAction to collect data from a
UniformNadirScanning(action_nadir_scan).- Parameters:
name (str | None) – Action name.
duration (float | None) – Time to task action, in seconds.
- class Broadcast(name: str = 'action_broadcast', duration: float | None = None)[source]
Bases:
DiscreteActionAction to broadcast data to all satellites in the simulation.
Should be used with a
BroadcastCommunication-derived communication method to limit communication to broadcasting satellites.- Parameters:
name (str) – Action name.
duration (float | None) – [s] Time to idle before communicating.
- class ContinuousAction(name: str = 'discrete_act')[source]
Bases:
ActionBase class for actions with a continuous action space.
- Parameters:
name (str) – Name of the action.
- abstract property space: Box
Return the action space.
- abstract property action_description: list[str]
Return a description of the action space.
- class ImpulsiveThrust(name: str = 'thrust_act', max_dv: float = inf, max_drift_duration: float = inf, fsw_action: str | None = None)[source]
Bases:
ContinuousActionPerform an impulsive thrust and drift for some duration.
- Parameters:
name (str) – Name of the action.
max_dv (float) – Maximum delta-V that can be applied. [m/s]
max_drift_duration (float) – Maximum duration to drift after applying the delta-V. [s]
fsw_action (str | None) – Name of the FSW action to activate during the drift period.
- property space: Box
Return the action space.
- property action_description: list[str]
Description of the continuous action space.
- class ImpulsiveThrustHill(chief_name, *args, **kwargs)[source]
Bases:
ImpulsiveThrustImpulsive thrusts in the Hill frame.
- Parameters:
chief_name – Chief to use for Hill frame.
*args – Passed to
ImpulsiveThrust.**kwargs – Passed to
ImpulsiveThrust.