test: characterization tests for Flight.step_simulation()#11
Open
thc1006 wants to merge 2 commits into
Open
Conversation
db87517 to
0ab556f
Compare
Verify the stepped-simulation API (run_simulation=False plus repeated step_simulation() calls) reproduces a one-shot simulate(): - initial step state is unfinished at the first phase - stepping visits multiple phases and reaches the finished state - the stepped trajectory (final t and the full solution array) matches simulate() to a tight tolerance, robust to LSODA last-bit noise across platforms - post_process_simulation / initialize_prints_plots fire on finish (t_final, prints, plots present) - stepping after finished is a no-op Uses the parachute-free calisto flight (parachute triggers are not migrated into the stepping path); the twin's launch parameters are read back from the reference so it cannot drift. Scope: uncontrolled stepping only.
0ab556f to
4e42c4b
Compare
Inject a roll command between step_simulation() calls (the Balloon Popping Challenge use case) and assert the trajectory responds: - a sustained command spins the body up (roll rate w3 grows) while a neutral command leaves w3 at zero - a mid-flight command reversal turns the roll rate around -- only possible if the command is re-read every step (a latched command could not) - a zero command leaves the angular state bit-identical to an uncontrolled run, isolating the divergence as the command, not the actuator's presence Uses time_overshoot=False (as BPC does) so each step advances one solver node and the command is injected per timestep. Tolerances/thresholds are used rather than bit-exact equality, to stay robust to LSODA last-bit noise across platforms.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds characterization tests for the stepped-simulation API (
Flight.step_simulation()), which had no coverage. This API underpins real-time, one-node-at-a-time control loops (e.g. the Balloon Popping Challenge environment steps it every timestep).Uncontrolled (
TestStepSimulation): stepping (run_simulation=False+ repeatedstep_simulation()) reproduces a one-shotsimulate()— initial_step_state, multi-phase progression tofinished, the finalt/y_soland fullsolutionarray matchingsimulate()to a tight tolerance (robust to LSODA last-bit noise), post-process artifacts on finish, and step-after-finished being a no-op.Controlled (
TestControlledStepSimulation): a roll command injected between steps (the fork's actual use case) changes the trajectory — a sustained command spins the body up while neutral stays at zero; a mid-flight reversal turns the roll rate around (only possible with per-step injection); a zero command leaves the angular state bit-identical to an uncontrolled run. Usestime_overshoot=False(as BPC does) so each step is one solver node.Parachute-free
calisto; tolerances rather than bit-exact equality for cross-platform robustness. 8 tests, ruff clean.