Skip to content

[#337] Allow continuous aliveness checkers - #354

Open
Strtus wants to merge 2 commits into
AVSLab:developfrom
Strtus:feature/337-continuous-aliveness
Open

[#337] Allow continuous aliveness checkers#354
Strtus wants to merge 2 commits into
AVSLab:developfrom
Strtus:feature/337-continuous-aliveness

Conversation

@Strtus

@Strtus Strtus commented Aug 22, 2026

Copy link
Copy Markdown

Description

Closes #337

Adds a continuous option to @aliveness_checker so checkers can run as Basilisk events and stop the environment step when they fail. Existing checkers are unchanged.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How should this pull request be reviewed?

  • By commit
  • All changes at once

How Has This Been Tested?

Unit tests for the decorator and event setup. Integration test comparing step-level vs continuous interruption.

Future Work

Built-in checkers (battery, altitude, RW speed, etc.) still only run at environment steps.

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation and release notes
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Copilot AI lite review requested due to automatic review settings August 22, 2026 04:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbb3bf7288

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +271 to +272
and not is_property(model, name)
and callable(getattr(model, name))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip properties on proxied models

Because self.dynamics and self.fsw are weak-reference proxies, is_property(model, name) examines weakref.ProxyType rather than the underlying model class and therefore returns false for model properties. The following getattr calls consequently execute every property getter during simulator construction, even when no continuous checker exists; a custom property that requires initialized simulation state or deliberately raises will now make env.reset() fail. Inspect the underlying class (for example via model.__class__) before retrieving attributes.

Useful? React with 👍 / 👎.

Comment on lines +290 to +292
valid_func_name(
f"aliveness_{self.name}_{type(model).__name__}_{name}"
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the underlying model type in event names

When both the dynamics and FSW models define a continuous checker with the same method name, these registrations produce the same event name: model is a weak-reference proxy in both iterations, so type(model).__name__ is ProxyType, not the dynamics or FSW class name. The second registration therefore reuses the first event-map key, preventing both checkers from remaining independently active; use the underlying class name or an explicit dynamics/FSW discriminator.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for “continuous” aliveness checkers so selected @aliveness_checker methods can be evaluated via Basilisk events during integration and immediately interrupt an environment step upon failure, while preserving existing step-level checker behavior.

Changes:

  • Extend @aliveness_checker to accept continuous and check_rate options and expose them on the wrapped checker.
  • Create satellite-level Basilisk events for continuous checkers during simulator initialization.
  • Add unit + integration tests validating decorator metadata and step-level vs continuous interruption behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unittest/utils/test_functional.py Adds unit tests for new decorator defaults and kwargs (continuous, check_rate).
tests/unittest/sats/test_satellite.py Adds unit test verifying continuous checkers create terminal Basilisk events and mark the satellite dead.
tests/integration/sim/test_int_dynamics.py Adds integration test comparing step-level vs continuous termination time.
src/bsk_rl/utils/functional.py Updates aliveness_checker decorator to support optional configuration and store metadata on wrapped callables.
src/bsk_rl/sim/simulator.py Hooks satellite continuous aliveness event setup into simulator initialization.
src/bsk_rl/sim/fsw/init.py Documents the new continuous=True behavior for FSW checkers.
src/bsk_rl/sim/dyn/init.py Documents the new continuous=True behavior for dynamics checkers.
src/bsk_rl/sats/satellite.py Implements setup_aliveness_events() to create terminal Basilisk events for continuous checkers.
docs/source/release_notes.rst Adds release note entry for continuous aliveness checkers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/bsk_rl/sats/satellite.py Outdated

self.simulator.createNewEvent(
valid_func_name(
f"aliveness_{self.name}_{type(model).__name__}_{name}"
Comment thread src/bsk_rl/sats/satellite.py Outdated
Comment on lines +284 to +287
def side_effect(sim, checker=checker):
checker(log_failure=True)
self._is_alive = False
self.record_death(sim.sim_time)
@Yume27
Yume27 self-requested a review August 31, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aliveness checkers should be easily addable as per-integrator-step checks using the event system

2 participants