Skip to content
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

Remove duplicate code for LM hover stage (after gear deployment) as much as possible #1048

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

indy91
Copy link
Contributor

@indy91 indy91 commented Aug 13, 2023

The LM in NASSP is simulated as having three separate phases:

Stage 0: "Docked" stage, full LM before gear deployment
Stage 1: "Hover" stage, full LM after gear deployment
Stage 2: Ascent stage

Originally the gear deployment was simulated as a mesh change (now it is an animation) and the only way to accomplish this was to reload all meshes. So the function that sets up the LM hover stage (SetLmVesselHoverStage) had to create the LM entirely from scratch, in the same way as the LM dock stage function (SetLmVesselDockStage) does it.

Presently SetLmVesselHoverStage still contains a lot of duplicate code compared to SetLmVesselDockStage. This pull request removes as much as possible of this. Note that on scenario loading the function SetLmVesselDockStage is always called, no matter the stage (even ascent stage). So SetLmVesselHoverStage only needs to have configuration changes that actually come from the gear deployment.

Issue #1016 is caused by reloading the RCS thruster locations without taking the shifted CG into account. They are created in the wrong place on gear deployment, so it's not just a visual bug. Removing the duplicate code should also fix this issue.

This PR changes for the gear deployment:

-LM thrusters and thruster groups aren't deleted and then created from scratch
-Empty mass isn't re-calculated (gear deployment should have no mass change, maybe a tiny bit from the pyro)
-Beacons (docking and tracking lights) aren't deleted and created from scratch
-DPS and RCS propellants aren't created (in case they had not been created before)
-View position isn't reset

The function still contains:
-SetSize and SetVisibilityLimit. Has an influence on how visible the vessel is from long distances. The dock and hover configurations of the LM use different values right now and that is probably realistic, as the gear deployment causes a physical change and appears slightly larger
-Moments of inertia (SetPMI) call. Right now we don't simulate a difference for this before vs. after gear deployment, but it could be done to get a slightly more realistic value
-Several aerodynamic functions (SetCrossSections, CreateAirfoils, SetRotDrag, SetPitchMomentScale, SetYawMomentScale, SetLiftCoeffFunc). Like the moments of inertia no difference is currently being simulated, but the gear deployment would have an influence on aerodynamics, so this is being retained.
-Touchdown points, they are obviously a main difference between pre and post gear deployment
-Status/stage flags for all kinds of purposes

So to fully test that this pull request doesn't break anything, one should test a gear deployment, for example with the Apollo 9 Before Gear Deployment scenario:

-That the DPS and RCS are working properly after gear deployment and also is visually correct (fix for #1016)
-Mass doesn't change
-Docking and tracking lights still work
-Propellants are the same
-View doesn't jump in 2D or VC

Copy link
Member

@maxq519 maxq519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@indy91 indy91 merged commit b8b09f9 into orbiternassp:Orbiter2016 Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants