mockingbirdnest / Principia

𝑛-Body and Extended Body Gravitation for Kerbal Space Program
MIT License
769 stars 69 forks source link

Option to enable maneuver nodes (feature request) #1873

Closed MuhsinFatih closed 5 years ago

MuhsinFatih commented 6 years ago

Could you add an option to enable adding old school maneuver nodes for quick dirty estimations? As much as I love this mod, I find it very tedious to make a flight plan with the flight planner window. In fact what would be even cooler is to integrate this mod with stock maneuver nodes, so we wouldn't even need the planner window in the first place. That would even make it compatible with mods like Precise Node

pleroy commented 6 years ago

The stock manœuvre nodes are instantaneous. Our manœuvres are extended in time. Therefore, the stock UI is not capable of providing the parameters that we need for our manœuvres. Also, the stock manœuvre nodes can only exist on the stock trajectories, i.e., the patched conics.

It might be possible to modify/replace the stock manœuvres to represent extended burns, but it seems like a lot of deep interactions with the KSP UI and to be honest I wouldn't even know where to start.

MuhsinFatih commented 6 years ago

I see. How about implementing your own maneuver node? I am not very familiar with unity and especially modding, so I am not sure how valid this question is so forgive me :). In the meantime though, could you add the option to enable old patched conic maneuver nodes? I know they don't represent real trajectories but for quick dirty estimations it would save a lot of time

DocRockwell commented 6 years ago

Muhsin, MechJeb can still generate patched conic maneuver nodes. Pretty handy for simple maneuvers that don't warrant using the flight planner.

MuhsinFatih commented 6 years ago

I've been using Mechjeb as a workaround as you said, but still, it's very inconvenient. I think this mod can really use a UI overhaul. There are other things as well, for example it could be very useful to able to type in maneuver dV on 3 axis', rather than only having the slider, or exposing maneuver nodes' parameters to the game so that other mods can play along with Principia. Also window scaling like many other mods do. I love this mod, it has to have taken an enormous amount of effort to realize, but there is a lot of room for improvement on the UI. God I wish I knew Unity, I would absolutely have given the time to contribute. Principia really takes the game to a whole new level, but as I said it is a bit tedious to use sometimes.

lamont-granquist commented 6 years ago

@pleroy a more useful thing would be to be able to use instantaneous maneuver nodes but with properly integrated n-body trajectories that could be pulled off of them.

The reference frame for the Vector3d of the burn might be an issue. I think KSP maneuver nodes are in (prograde, radial, normal) which I would say is on the user to use (tangent, normal, binormal) instead -- although there would need to be utility routines available to convert from KSP barycentric world coordinates to tangent/normal/binormal in the ship frame to make that sane for the end user. Then what you've got should be a well defined dV and UT to apply it at. Integrating forwards from where the ship is to the maneuver node time would give the "before" trajectory and integrating forwards from the maneuver node (n-body integration) would give the "after" trajectory. Then it can be the responsibility of a finite-burn integrator to actually get the spacecraft from the "before" trajectory to the "after" trajectory (most of which in the real-world don't bother with n-body or J2 over the course of the burn since they're run closed-loop).

That'd allow for a bit easier integration of Principia with MechJeb, kOS, kRPC, etc. Higher level algorithms can build a maneuver node, pull the integrated trajectories off of it, calculate the real n-body-calculated miss, then do whatever minimization to drive that miss to zero, and what the user gets is an impulsive burn which is (presumably) optimal and accurate since it used Principia to do the integration.

lamont-granquist commented 6 years ago

Also this is typically how most trajectory optimization is done. It generally starts out with impulsive burn approximations with patched conics and then that solution is "perturbed" by adding finite burns or n-body effects. For PEG in the Shuttle it doesn't bother with J2 for the burn phase, only the coast phase, and doesn't bother with perturbations from the Moon or the restricted three body problem (inaccuracies are dealt with by running it closed-loop and driving the errors to zero along the burn).

eggrobin commented 5 years ago

Closing this. There are UI issues with the flight plan, and they should be addressed; the way to address them is not to use stock or a third-party mod, see also https://github.com/mockingbirdnest/Principia/issues/1964#issuecomment-479430947.

When MechJeb wants to do Principia-aware guidance, it will have to call a Principia API to perform the integration anyway; it can also read the Principia flight plan.