Repository navigation
[#337] Allow continuous aliveness checkers #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Yume27
merged 4 commits into
AVSLab:develop
from
Strtus:feature/337-continuous-aliveness
Nov 4, 2026
+397
−32
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ffc3bb8
[#337] Allow continuous aliveness checkers
Strtus c8db3a1
[#337] Use model class for aliveness event setup
Strtus 88d1f33
[#337] Enable continuous battery and wheel checks
Strtus 605d62a
[#337] Make continuous failure logging configurable and separate FSW …
Yume27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,55 @@ | ||
| # For fsw models not tested in other tests | ||
| from typing import ClassVar | ||
|
|
||
| import gymnasium as gym | ||
| import pytest | ||
|
|
||
| from bsk_rl import act, obs, sats | ||
| from bsk_rl.sim import dyn, fsw | ||
| from bsk_rl.utils.functional import aliveness_checker | ||
| from bsk_rl.utils.orbital import random_orbit | ||
|
|
||
|
|
||
| class TestContinuousAlivenessChecker: | ||
| @pytest.mark.parametrize( | ||
| "continuous,check_rate,expected_time", | ||
| [ | ||
| (False, None, 100.0), | ||
| (True, None, 5.0), | ||
| (True, 0.5, 5.0), | ||
| (True, 2.0, 6.0), | ||
| (True, 2.5, 6.0), | ||
| (True, 3.0, 6.0), | ||
| ], | ||
| ) | ||
| def test_step_vs_continuous( | ||
| self, continuous, check_rate, expected_time, caplog | ||
| ): | ||
| class BoomFSW(fsw.FSWModel): | ||
| @aliveness_checker(continuous=continuous, check_rate=check_rate) | ||
| def time_valid(self): | ||
| return self.simulator.sim_time < 5.0 | ||
|
|
||
| class BoomSat(sats.Satellite): | ||
| fsw_type = BoomFSW | ||
| dyn_type = dyn.DynamicsModel | ||
| observation_spec: ClassVar[list[obs.Observation]] = [obs.Time()] | ||
| action_spec: ClassVar[list[act.Action]] = [act.Drift()] | ||
|
|
||
| env = gym.make( | ||
| "SatelliteTasking-v1", | ||
| satellite=BoomSat("Boom", sat_args=dict(oe=random_orbit)), | ||
| sim_rate=1.0, | ||
| time_limit=100.0, | ||
| max_step_duration=100.0, | ||
| disable_env_checker=True, | ||
| ) | ||
|
|
||
| env.reset(seed=0) | ||
| _, _, terminated, _, _ = env.step(0) | ||
|
|
||
| assert env.unwrapped.simulator.sim_time == pytest.approx(expected_time) | ||
| assert not env.unwrapped.satellite.is_alive() | ||
| assert env.unwrapped.satellite.time_of_death == pytest.approx(expected_time) | ||
| assert terminated | ||
| assert caplog.messages.count("failed time_valid check") == 1 | ||
| env.close() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.