Repository navigation
Aerodynamic drag force on Drag_Disturbance (second of the force stack) - #246
Merged
Merged
Conversation
Disturbance gains force(), force_qjac() and force_qqhess() that return zeros, mirroring the torque trio, so torque-only disturbances need no change. Satellite.dist_forces() sums the body-frame forces over the registered disturbances using the same sat/no-sat call convention as dist_torques(). The attitude dynamics are untouched; the force is for orbit propagation and inspection. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The analytic *_qjac/*_qqhess methods differentiate with respect to the four raw quaternion components. The existing fd_quat_jac/fd_quat_hess renormalise the perturbed quaternion, which drops the radial part of the derivative and only agrees when the output is small enough to hide inside the tolerance. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Taken from 2_2/disturbance_forces_clean (#240), drag portion only.
…rences Adds fd_quat_jac_raw/fd_quat_hess_raw helpers that do not renormalise the perturbed quaternion; the analytic Jacobians differentiate with respect to the raw components, so the renormalising helpers only agree when the output is small enough to hide inside the tolerance. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Base automatically changed from
feat/disturbance-force-interface
to
2_2/update
October 26, 2026 21:37
…andle it. [drag_disturbance.py (line 253)](/home/nicla/Generalized_ADCS/ADCS/satellite_hardware/disturbances/drag_disturbance.py:253) annotates os as Orbital_State | Dict[...], but [line 288 (line 288)](/home/nicla/Generalized_ADCS/ADCS/satellite_hardware/disturbances/drag_disturbance.py:288) unconditionally calls os.get_state_vector(...). Passing a dictionary as the annotation permits raises AttributeError. Either support a mapping here or remove it from the annotation and docstring. The existing torque method has the same mismatch. [P3] The raw finite-difference helper drops other state fields. [\\_helpers.py (line 120)](/home/nicla/Generalized_ADCS/testing/test_disturbances/_helpers.py:120) rebuilds a plain State with only w and q. That discards wheel momentum and, for EstimatorState, bias and disturbance-parameter values. A function that depends on those fields will be evaluated at a different state during the finite difference. Copy x and perturb its quaternion instead.
nscheuer
approved these changes
Oct 26, 2026
nscheuer
left a comment
Owner
There was a problem hiding this comment.
looks good to me, made some small changes to the _helper files, otherwise looks awesome
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.
The problem
Drag_Disturbancecomputes the aerodynamic torque but not the force that produces it, so the orbit cannot see drag. This is the drag part of #240, with tests, on top of the force interface PR.What this adds
Nic's
force,force_qjacandforce_qqhessonDrag_Disturbance(his commit, drag portion only): the flat-plate drag force summed over the faces that see the flow,F = -½ ρ Σ_i C_D,i A_i max(0, n_i · V_b) V_b,
with the same piecewise incidence gating as the torque. Layouts match the torque methods,
(4, 3)and(4, 4, 3), units N.Tests
testing/test_disturbances/drag/test_drag_force.py:torque()equals Σ (centroid − COM) × (per-face force), which ties the new force to the already-tested torque;Satellite.dist_forces.One note from writing these: the existing
fd_quat_jachelper renormalises the perturbed quaternion, which removes the radial part of the derivative. Nic's Jacobian is exact against the raw derivative; it only looked wrong against the renormalising helper because the force is large enough that the discrepancy clears the old tolerance. The torque tests do not notice because the torques are smaller.🤖 Generated with Claude Code