Skip to content

Commit

Permalink
sMDP connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark2000 committed Jul 30, 2024
1 parent b328ad5 commit d18ab44
Show file tree
Hide file tree
Showing 3 changed files with 520 additions and 21 deletions.
7 changes: 6 additions & 1 deletion src/bsk_rl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
from gymnasium.envs.registration import register

from bsk_rl.check_bsk_version import check_bsk_version
from bsk_rl.gym import ConstellationTasking, GeneralSatelliteTasking, SatelliteTasking
from bsk_rl.gym import (
NO_ACTION,
ConstellationTasking,
GeneralSatelliteTasking,
SatelliteTasking,
)

__all__ = [
"GeneralSatelliteTasking",
Expand Down
5 changes: 4 additions & 1 deletion src/bsk_rl/gym.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
MultiSatAct = Iterable[SatAct]
SatArgRandomizer = Callable[[list[Satellite]], dict[Satellite, dict[str, Any]]]

NO_ACTION = int(2**31) - 1


class GeneralSatelliteTasking(Env, Generic[SatObs, SatAct]):

Expand Down Expand Up @@ -356,7 +358,8 @@ def _step(self, actions: MultiSatAct) -> None:
if len(actions) != len(self.satellites):
raise ValueError("There must be the same number of actions and satellites")
for satellite, action in zip(self.satellites, actions):
if action is not None:
satellite.info = [] # reset satellite info log
if action is not None and action != NO_ACTION:
satellite.requires_retasking = False
satellite.set_action(action)
if not satellite.is_alive():
Expand Down
Loading

0 comments on commit d18ab44

Please sign in to comment.