-
Notifications
You must be signed in to change notification settings - Fork 63
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
Feature/330 gravity effector refactor #331
Conversation
src/simulation/dynamics/_GeneralModuleFiles/pointMassGravityModel.cpp
Outdated
Show resolved
Hide resolved
066fbf6
to
cba2952
Compare
@schaubh |
@juan-g-bonilla , thanks for the update. Are you saying the test is failing on |
The test is passing in develop. However, after the gravity effector refactor it appears that the numerical error builds up different and this test that integrates fails. If you try to reduce the integrator step size in |
@juan-g-bonilla , I'm ok to update the truth values as you did. I looked at the new results and the change is comparatively small. As you say, we are doing different algebra to implement the same math, so there will be small round off difference that accumulate over time. The difference we are seeing here is due to this. You can keep the surface area at 1 m^2 as this causes a position difference on the order of 10's of km, much larger than our test tolerance. The integrated test remains a consistency test and can keep the 1m tolerance for now. The compute values should not change unless we change how the math is implemented. |
9027131
to
bd4dc15
Compare
@schaubh Finally polished up this PR for merging. Some of the improvements here should also help fix some of the leaks Mark is experiencing. Lmk of any requested changes. |
Thanks. I’ll review ASAP. 😎
Blue Skies, Hanspeter Schaub
[http://hanspeterschaub.info/pics/AVSlogo5-Email.png] Hanspeter Schaub, Ph.D.
Schaden Leadership Chair
Professor and Chair of Smead Aerospace Engineering Sciences Department
LASP Senior Associate for Engineering Research and Education
Director of the Autonomous Vehicle Systems (AVS) Laboratory
Fellow of AIAA and AAS
Address: Aerospace Engineering Sciences (ASEN) Department
Colorado Center for Astrodynamics Research (CCAR)
3775 Discovery Drive, 429 UCB
University of Colorado
Boulder, CO 80303-0429
Office: AERO 224N
Phone: +1 (303) 492-2767
Email: ***@***.******@***.***>
Web: http://hanspeterschaub.info<http://hanspeterschaub.info/>
On Oct 25, 2023, at 19:00, Juan Garcia Bonilla ***@***.***> wrote:
@schaubh<https://github.com/schaubh> Finally polished up this PR for merging. Some of the improvements here should also help fix some of the leaks Mark is experiencing. Lmk of any requested changes.
—
Reply to this email directly, view it on GitHub<#331 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVGSPDJGT4DVNYQ4APH25ATYBGYZBAVCNFSM6AAAAAAYFYSVDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBQGI2TMNZSHE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
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.
Nice refactor.
examples/OpNavScenarios/scenariosOpNav/scenario_faultDetOpNav.py
is failing now? Isn't this gravity refactor supposed to be backwards compatible? I updated the script to use the new way to set spherical harmonics.- if this is not backwards compatible, then we should have notes in the release notes warning users to update these spherical harmonics setting part of their code?
src/simulation/dynamics/_GeneralModuleFiles/pointMassGravityModel.cpp
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/_GeneralModuleFiles/pointMassGravityModel.h
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/gravityEffector/sphericalHarmonicsGravityModel.cpp
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/gravityEffector/sphericalHarmonicsGravityModel.cpp
Show resolved
Hide resolved
src/simulation/dynamics/gravityEffector/sphericalHarmonicsGravityModel.h
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/gravityEffector/polyhedralGravityModel.h
Outdated
Show resolved
Hide resolved
src/simulation/dynamics/gravityEffector/_UnitTest/test_gravityDynEffector.py
Show resolved
Hide resolved
The issue was that when we called:
we were retrieving With the change you published, we are saying that we should use spherical harmonics, and the loading them. So after this update, scripts that use It is possible that this wasnt a design error, but that Let me know of what you think is the best way forward. Personally, I believe this was a mistake and |
bfbed72
to
b6c6c07
Compare
I agree that this was a mistake in the original script. Should be good to go then. |
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.
Ok, good to go with this.
Description
Computation of gravity has been moved away from
GravityEffector
and into an abstract classGravityModel
. Three new classes have been created that inherit fromGravityModel
:PolyhedralGravityModel
,SphericalHarmonicsGravityModel
, andPointMassGravityModel
.Utility functions have been added to switch gravity models and load coefficients in a single call:
can now be written as:
Apart from being a slightly shorter syntax, we avoid invalid states by condensing these calls into one:
simIncludeGravBody.loadGravFromFile
without callinguseSphericalHarmParams = True
would lead to loading the coefficients but not using them. Confusing.useSphericalHarmParams = True
without callingsimIncludeGravBody.loadGravFromFile
(or manually setting the coefficients) would lead to an error during propagation.simIncludeGravBody.loadGravFromFile
beforeuseSphericalHarmParams = True
would raise an error, asplanet.spherHarm
raises an error if the body is not already using Spherical Harmonics.A similar syntax was added for
usePolyhedralGravityModel
andusePointMassGravityModel
. All scenarios were updated to use this syntax, but not tests.In order to set any gravity model (including user-defined ones) without using the utility functions, one can do:
Additionally, there has been some general clean-up in
GravityEffector
.Verification
Existing tests all pass except for
src\simulation\dynamics\RadiationPressure\_UnitTest\test_radiation_pressure_integrated.py
. Does anybody know how trust-worthy the truth data for this test is? I think that we are testing to an accuracy that is smaller than the integrator error we are making. Using thedevelop
branch, I computed the final position of propagation using the currently set time step of10 s
and using1 s
and the integrator position error is in the order of 1 km. This is much higher than the accuracy of1 m
currently set in the test.Documentation
The documentation file for
GravityEffector
was updated. Outdated information was removed. The code flow diagram was removed, as it is invalidated by the changes but also simplified slightly. Could be updated and added back, but to me this seems like an implementation detail that is covered in the text anyway.To deprecate or not to deprecate
It's possible to deprecate the following syntax:
in favor of:
If users want to set coefficients themselves, they could do this with:
Should we deprecate the older syntax? This would lead to deprecation warnings in many user scripts and in 20 tests (which would need to be updated).
Future work
Implement new
GravityModel
subclasses. Issue #332.