BUG: use the angular rates in the solid propulsion equations of motion - #1195
Open
MateusStano wants to merge 1 commit into
Open
MateusStano wants to merge 1 commit into
MateusStano wants to merge 1 commit into
Conversation
Flight.u_dot zeroed omega1, omega2 and omega3 right after unpacking the state, so the aerodynamics and the Euler equations saw a rocket that never rotates: no aerodynamic damping at all. A pitch rate produced no restoring moment and a canted fin spun the rocket up without bound (1000 rad/s for a 1.5 degree cant on Calisto). Every rocket with a SolidMotor is mapped to these equations, so every such 6-DOF flight was affected. Introduced with the 3-DOF work in #745. With the rates back, the solid propulsion equations agree with the generalized ones to 0.25% on apogee and 0.2% on roll rate. Tests: each body axis rate must produce a damping angular acceleration with both sets of equations, the two must agree when rotating, and a rolling flight's roll rate must stay bounded and track the airspeed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1195 +/- ##
===========================================
+ Coverage 91.58% 91.59% +0.01%
===========================================
Files 132 132
Lines 18404 18403 -1
===========================================
+ Hits 16855 16857 +2
+ Misses 1549 1546 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Pull request type
Checklist
ruff) has passed locallyCHANGELOG.md— no action needed; an LLM workflow auto-updates it after mergeCurrent behavior
Flight.u_dot, the"solid_propulsion"equations of motion, zeroes the angular rates right after unpacking the state:So the aerodynamics (every surface's forces and moments, the rate-dependent drag inputs, the
ω × rterm of each surface's local airspeed) and the Euler equations see a rocket that never rotates. There is no aerodynamic damping at all: a pitch rate produces no restoring moment, and a canted fin spins the rocket up without bound.Every rocket with a
SolidMotoris mapped to these equations automatically, so every such 6-DOF flight has been affected. The line was introduced with the 3-DOF work in #745; before it,u_dotused the real rates.On Calisto with 5–15 m/s wind, apogee-terminated:
u_dot_generalizedNew behavior
The line is removed. The solid-propulsion equations now agree with the generalized ones to ~0.25 % on apogee and ~0.2 % on roll rate, which is the genuine modelling difference between them (two-body mass model and axisymmetric inertia versus the full tensor).
Why the suite never caught it: no test asserted anything about rotation (
test_rolling_flightonly checkedall_info()), the hard-coded expected values are sampled at rail exit, apogee and landing where the rates are zero anyway, the fixture environments have no wind so there is no angle of attack to damp, and the two sets of equations were never compared. The new tests close those gaps:test_an_angular_rate_is_aerodynamically_damped(unit, both derivatives): a rate about each body axis, on a coasting state, produces an angular acceleration that opposes it, roughly linearly.test_solid_propulsion_and_generalized_equations_agree_when_rotating(unit): with a pitch rate applied, both models give the same damping moment and accelerations.test_solid_propulsion_equations_damp_rotation(integration): a 1.5° canted-fin Calisto reaches the same roll rate with either model, and stays under 100 rad/s.test_rolling_flightnow asserts the roll rate is bounded and tracks the airspeed through the coast.With the bug re-introduced, the three tests that exercise
u_dotfail.Breaking change
Results of solid-motor 6-DOF flights change, since they are now damped: apogee moves by a percent or so on Calisto, and any quantity involving rotation (roll rate, angular accelerations, sensor readings on gyroscopes) changes substantially. The acceptance tests against real flight data still pass.
Additional information
Found while comparing
u_dotandu_dot_generalizedline by line for a review question on #968. The same fix is applied onenh/events.