-
-
Notifications
You must be signed in to change notification settings - Fork 237
ENH: 3-dof lateral motion improvement #883
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
ENH: 3-dof lateral motion improvement #883
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #883 +/- ##
===========================================
+ Coverage 80.27% 80.99% +0.72%
===========================================
Files 104 107 +3
Lines 12769 13642 +873
===========================================
+ Hits 10250 11050 +800
- Misses 2519 2592 +73 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This is a new implementation within 3 dof. Please critique it and suggest improvements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a quasi-static weathercocking model for 3-DOF flight simulations to improve lateral motion realism. Previously, the 3-DOF simulation maintained a fixed attitude throughout flight, which was unrealistic. The new implementation allows the rocket's body axis to gradually align with the relative wind direction based on a configurable coefficient.
Key changes:
- Added
weathercock_coeffparameter to control the rate of attitude alignment in 3-DOF simulations - Implemented quaternion evolution in
u_dot_generalized_3dofusing cross-product-based rotation toward relative wind - Added comprehensive unit tests validating the weathercocking behavior across different scenarios
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 13 comments.
| File | Description |
|---|---|
| rocketpy/simulation/flight.py | Added weathercock_coeff parameter (default 1.0) and implemented weathercocking model that computes quaternion derivatives to align body axis with relative wind direction in 3-DOF mode |
| tests/unit/simulation/test_flight_3dof.py | Added 5 new tests covering parameter storage, default values, fixed attitude with zero coefficient, attitude evolution with misalignment, and alignment verification |
| tests/conftest.py | Fixed import ordering to follow alphabetical convention (matplotlib before netCDF4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
- ENH: a new notebook bella_lui_3dof_vs_6dof.ipynb which uses new implementations of weathercocking model on 3dof
- ENH: introduced new weathercock_coeff parameter in Flight.init (default: 1.0) - ENH: updated u_dot_generalized_3dof to compute quaternion derivatives proportional to misalignment with relative wind - ENH: angular velocity = weathercock_coeff * sin(misalignment_angle)
- ENH: unit tests added for weathercocking to check whether weathercock_coeff=0 results in fixed attitude (no quaternion change). - MNT: format and lint updates for new additions
- DOC: added 3 dof and 6 dof comparison analysis to three_dof_simulation.rst - DOC: updated iusers/index.rst to build three_dof_simulation.rst - MNT: deleted the bella_lui_3dof_vs_6dof_comparison.ipynb as the doc now covers this section
- MNT: corrected doc string to represent correct orientation - MNT: improved tolerance of check on quaternion derivative which should be ideally very small when axes are aligned
…cocking - BUG: implemented a dot product check to ensure that singularity bug is avoided when rocket body and wind velocity are anti aligned to make rocket statically stable (in u_dot_generalized_3dof) - MNT: removed redundant double assignment of e0 and w0 vectors within u_dot_generalized_3dof - MNT: format correction to test_flight_3dof.py
- MNT: 3 dof documentation only referred in users section/getting started - MNT: correction of docstring in flight.py - MNT: corrected unit_vector call when defining rotation axis in u_dot_generalized_3dof - MNT: docstring correction in test_flight_3dof.py - ENH: test coverage added for anti alignment case in weathercock model to test_flight_3dof.py
5f33d7f to
fc4228c
Compare
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall the code looks clean. I see a few things that concerns me, so I listed below.
…cking coeff usage and value.
…xtures to test_flight_3dof.py
- MNT: fixed default weathercock_coeff value in flight.py to match 3 dof behaviour by default - MNT: corrected fixtures and docstrings in test_flight_3dof.py
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aZira371 overall I'm pretty confident with this PR.
You can already update the CHANGELOG to include this PR.
Let's wait a few more days to see if there's any other comment from copilot, Stano ou Bressan. If not, I will proceed with merging this one already.
Great job!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 17 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- MNT: correction of docstring now that fixtures are used. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- MNT: perp_axis singularity value error implemented to handle edge case for perp_axis being parallel to body axis in weathercocking model of 3 dof.
* Initial plan * DOC: Add note about motor file paths in 3-DOF comparison section Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
…lized_3dof (#903) * Initial plan * Refactor: eliminate quaternion derivative code duplication in u_dot_generalized_3dof Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> * Improve comment clarity in weathercocking aligned case Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
…otion improvement
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCHANGELOG.mdhas been updated (if relevant)Current behavior
The 3-DOF flight simulation keeps a fixed attitude throughout the flight. The quaternion derivatives are always zero, meaning the body axis direction never evolves despite changes in the relative wind direction.
#882
New behavior
Introduces an evolving unit direction vector for the body axis using a quasi-static weathercocking model. The rocket's attitude gradually aligns toward the relative wind direction.
Changes:
Breaking change
Additional information
A new jupyter notebook to be added, depicting comparison of 3 dof and 6 dof. It also highlights use of weathercocking coefficient.