eggrobin

[WIP][1.5.1, 1.6.1, 1.7.x] Principia—version פרנקל, released 2019-11-26—n-Body and Extended Body Gravitation, axial tilt

Recommended Posts

Brouwer is out, you can get it by asking on IRC (#principia on EsperNet), as usual.

User-facing features:

  • The whole Frenet trihedron is now displayed in the correct reference frame when "fix navball in plotting frame" is selected.
  • The initial state (and thus the evolution) of the system is now deterministic even when not using RSS.
  • Tidally locked bodies no longer spin back and forth madly (on the other hand, they may not be tidally locked if their mean period differs from their Jacobi osculating period).
  • When using stock, the Jool system is modified, cancelling the apocalypse. Specifically, we make the inner Jool system nonresonant, since we have been unable to replicate the results (Manley, priv. comm.) according to which some interpretations of the orbital elements yielded a stable Laplace resonance, despite systematic searches of the Jacobi osculating elements. In addition, at Scott Manley (@illectro)'s and @UmbralRaptor's suggestion, we put Bop in a surprisingly stable, though highly precessing, retrograde orbit. The modified system is stable for upwards of a century.
  • Flight planning has been implemented.

Modder-facing changes:

  • When a Cartesian initial state cfg is not given, the KSP orbital elements are interpreted in a hierarchical osculating Jacobi fashion; for instance, the orbital elements of Jool are the osculating elements at game start of the orbit of the barycentre of the Jool system around the barycentre of the (sun, moho, eve, gilly, kerbin, mun, minmus, duna, ike, dres) system; the elements of Laythe are the osculating elements at game start of the orbit of Laythe around Jool; the elements of Vall are the osculating elements at game start of the orbit of Vall around the Laythe-Jool barycentre.

Optimizations:

  • The Windows build now uses profile-guided optimization (we estimate that this improves performance by ~20%); in theory this could be extended to other platforms.
  • The evaluation of the Чебышёв series has been significantly optimized.
  • @sarbian made trajectory rendering faster (as he pointed out, there is still lots of room for improvement).

Other features:

  • Everything that crosses the interface can now be journalled if the right flag is set, allowing us to replay the C++ side of a session; this is useful for tracking down tricky bugs, and it enables profile-guided optimization.

Highlights of miscellaneous library changes; beware, this gets technical:

For more details, see all 195 pull requests between Bourbaki and Brouwer.

Edited by eggrobin
~20%

Share this post


Link to post
Share on other sites

 

1 hour ago, eggrobin said:

Flight planning has been implemented.

stephen-colbert-screaming-gif.gif

Aherm...
Great work on this! I will definitely try it out during the week. Has there been any progress on the stability issues?

Share this post


Link to post
Share on other sites

Some clarifications regarding reference frames and flight planning.

Reference frames.

At the moment, two types of reference frame are available: the nonrotating reference frame centred on one body, and the barycentric rotating reference frame.

The nonrotating reference frame centred on one body (let's call that body ⨁) is the one that stock KSP uses inside the sphere of action of ⨁. In that reference frame, if ⨁ is a point mass and the orbit is unperturbed, the orbit will be a conic. The navball's reference plane is the celestial equator, and its reference direction is the origin of right ascension (this navball is grey and black, the reference direction is marked , right ascension is labelled in hours and declination in degrees).

The barycentric rotating reference frame fixes the barycentre between a body and its primary (let's call them ☽ and ⨁ respectively), the line between them, and the plane of their orbit. The navball's reference plane is the orbit plane, and its reference direction is the line from the secondary to the primary (this navball is purple, its reference direction is marked I for primary, and the opposite direction is marked II for secondary).
A nice feature of the barycentric rotating navball is that one can see launch windows into inclined orbits: when a rocket sitting upright on the launch pad on ⨁ points into the orbit plane (the grey band between the hemisphere of the navball), launching at that inclination will put it in the plane of ☽'s orbit.

As an illustration, the following shows a free-return trajectory (fuchsia) and a convoluted insertion into some sort of loose orbit around the Earth-Moon L4 point (royal blue), in all three relevant reference frames.

Let us consider the (fuchsia) free-return trajectory.

In the Earth-centred nonrotating reference frame, we start on a conic, then "something non-Keplerian happens", then we end up on another conic. This is (approximately) what one would see in stock KSP (using conic draw mode 3). It hard to see what is happening when we interact with the moon, or how close we come to it.

In the Moon-centred nonrotating reference frame, we start on a highly non-Keplerian trajectory, pass by the moon in a nearly-straight hyperbolic arc, and go back to non-Keplerian motion. Here it is easy to see how close we get to the Moon, but the parts of the trajectory that are far from the moon are very confusing.

In the barycentric rotating reference frame, we can see that we go around the moon, staying far away from it, and come back to Earth: this reference frame gives us the clearest overview, while details close to either body are best investigated using the body-centred reference frames.

Note that the Moon (and the Earth) are not fixed in the barycentric rotating reference frame; instead they move towards each other and away from each other over the course of their orbit. If the Moon's orbit were perfectly circular, the bodies would be fixed in the barycentric rotating reference frame.

The frame in which the trajectories are plotted can be chosen by clicking on "Plotting frame selection...".

Prediction and history.

The history (drawn in acid green) shows the trajectory that the craft has followed up to now.

The prediction (drawn in fuchsia) shows the trajectory that the craft would follow in free fall (without engine thrust), much like stock KSP's plotted orbit.

See for instance the following launch from Kourou:

DcDrLh8.png

Flight planning.

A principia manœuvre is a rocket engine burn (following Циолко́вский's equation), in a fixed inertial direction.

The direction and intensity of the burn are specified by giving three components (tangent, normal, binormal) of the Δv.
The tangent, normal, and binormal direction form the Frenet frame of a free-falling trajectory in the manœuvring frame; in particular, in the body-centred frame, for a Keplerian orbit, they correspond to stock's yellow, blue, and pink markers respectively (confusingly, the KSP wiki calls the binormal "normal").

A flight plan consists in a series of manœuvres.

A flight plan can be created by pressing "Flight plan..." → "Create flight plan". Once the flight plan is created, it is no longer affected by what happens to the craft: in particular, the initial mass used by to solve Циолко́вский's equation is the initial mass when the flight plan was created.

The coasting phases of the flight plan are plotted (in the plotting frame) in royal blue; the burning phases are plotted in orange-red. Manœuvres can be added to the flight plan by pressing "Add manœuvre". By default the manœuvring frame is the current plotting frame. A trihedron marks the beginning of the manœuvre, showing the tangent, normal, and binormal directions for that manœuvre. See below for an illustration of the plotted flight plan and manœuvre marker.

mMhD6FP.png

By default, a manœuvre will be configured to use all active engines; if there are none, it will fall back to all active RCS thrusters; if there are none, it will fall back to an unrealistic stock-style instant impulse. This does not work well with solid engines (since they cannot be activated without providing thrust), we will attempt to improve engine specifications in a future release.

Note that there is no check of available Δv: the user can plan a burn that requires more fuel than is available, just like in stock.

A countdown to the beginning of the next manœuvre is shown at the top of the flight plan, or, if a manœuvre is in progress, a countdown to the end.

To execute a manœuvre, select "Show on navball". This will create a stock manœuvre node in the direction of the upcoming or ongoing manœuvre, SAS (or MechJeb) can then be set to Node to point in the right direction. The node can be used for timewarping with Kerbal Alarm Clock. When the ignition countdown reaches 0, light the engines that were used to plan the burn; as the burn progresses, the prediction can be seen to converge towards the flight plan; when the cutoff countdown reaches 0, shut down all engines. Note that the stock node is only here for guidance: its Δv counter does not decrease as you burn, and it does not show a residual Δv like in stock.

Edited by eggrobin

Share this post


Link to post
Share on other sites

Great work. Every time I've tried to do that, my flight planner crashes the game because I plotted a trajectory that intersects earth. :D

Share this post


Link to post
Share on other sites

This did happen during the last correction burn, but it did not crash. I cut out about 1 minute of it chugging while the trajectory passed the center of the moon.
One thing that will crash it is if your trajectory history becomes less than the starting point of your flight plan.

Edited by maccollo

Share this post


Link to post
Share on other sites

Wow guys, I've waited a long time for a new release, and peering for even longer. Now that I saw these very practical improvements (like flight planner), I would like to download it. 

On 2/5/2014 at 1:19 AM, eggrobin said:

Brouwer is out, you can get it by asking on IRC (#principia on EsperNet), as usual.

So..I just ask them for download? *bows down in mild embarrassment*

Share this post


Link to post
Share on other sites
31 minutes ago, viktor19 said:

Wow guys, I've waited a long time for a new release, and peering for even longer. Now that I saw these very practical improvements (like flight planner), I would like to download it. 

So..I just ask them for download? *bows down in mild embarrassment*

Pretty much. Log on EsperNet IRC, go to the #principia channel, and ask Egg. It's basically just a minor hoop to jump through in order to keep the testing cohort to relatively engaged users who can follow simple instructions. :-)

Share this post


Link to post
Share on other sites
5 hours ago, Autochton said:

Pretty much. Log on EsperNet IRC, go to the #principia channel, and ask Egg. It's basically just a minor hoop to jump through in order to keep the testing cohort to relatively engaged users who can follow simple instructions. :-)

Hmm I should also start doing this...

Edited by blackrack

Share this post


Link to post
Share on other sites

I have played with it for some time and it is amazing!! However, it would be nice to have some basic guides in the future. Getting to Kerbin-Sun L1 required a lot of fiddling around.

Share this post


Link to post
Share on other sites

Finally got the L4 Lagrange point of the kerbin/Mun system after a few hours with this amazing mod!

Congratulations and thank you Eggrobin with your team!  :)

Share this post


Link to post
Share on other sites
3 hours ago, Courn Wallace said:

If I don't have an EsperNet IRC login, I can't try out this mod?

You don't need a login, that's only if you plan to make it a habit to keep coming back, then it'll reserve your nickname for you.

Share this post


Link to post
Share on other sites

Buffon is out, you can get it by asking on IRC (#principia on EsperNet), as usual.

Changes:

  • The integrators now limit the number of steps they perform, and terminate if their step size vanishes. This avoids issues where the plugin would hang when the trajectory would accidentally get very close to the centre of a celestial body or spend a long time in a low orbit.

  • A use-after-free bug has been fixed which caused a variety of crashes (#872, #881, #889, #896) when the historical trajectory was shortened in a way that would cause it to start after the beginning of the flight plan.

  • The version identifier of the plugin is now displayed in the UI to make it is easier to assert what version is running.

  • A verbosity option has been added to the journalling which makes it easier for us to reproduce crashes.

The first two items above are illustrated by the following two reports.

On 12/02/2016 at 5:19 AM, nilof said:

Great work. Every time I've tried to do that, my flight planner crashes the game because I plotted a trajectory that intersects earth. :D

On 12/02/2016 at 11:29 AM, maccollo said:

One thing that will crash it is if your trajectory history becomes less than the starting point of your flight plan.

For more details see all 19 pull requests between Brouwer and Buffon.

Share this post


Link to post
Share on other sites

That looks Badass!

Seriously, I am the kind of person that would totally abuse of this mod with Hyper Edit and move the orbit of some planets suc has Jool  just to see how the solar system would react.
Oh man.  I always wanted to make the Mun almost crash on Kerbin and enjoy the view.

Is it possible?

What I know is that with the standard KSP, when the moon get close enough, physics breaks out and our ship just get spawned around the mun or explode.

Share this post


Link to post
Share on other sites

Did a little mun landing yesterday. Had to learn some new things. Started to love the flight planer in an instant.

I nearly performed a suicide burn at the mun landing, only from looking at the flight path (on how it gets completely vertical at the end (I wish I could zoom in a bit more in map view)), but I  would love to see the time the engines burn in a different colored flight path. That would allow one to really perform a suicide burn. Would be super-cool.

One thing tht bothered me. As well as the patched conics are "hidden", you still can click them and set maneuver nodes, etc. But I definitly will be using this from now on.

 

Thank you for this gorgeous pice of work.

Share this post


Link to post
Share on other sites

NOTICE:

There is a bug in Buffon (2016022220-Buffon-0-g0455d0cb0e4b0b584a84caf40520cf7993903e0c) that causes a crash when starting a new save with RSS (loading an existing save works fine). The hotfix "2016022220-Buffon-12-g1298cffba22d90119bd59e9933a9ef261922a423" (let's call it "Buffon + 12") resolves that, so if you run into this issue just go back to the IRC channel to get the latest build, it will be Buffon + 12.

There are no other changes between Buffon and Buffon + 12.

Unrelated:

13 hours ago, Benji said:

I  would love to see the time the engines burn in a different colored flight path.

On the flight plan, coasting is in blue, while burning is in orange-red.

Share this post


Link to post
Share on other sites
37 minutes ago, 123nick said:

but as someone who has downloaded it, it still makes little too no sense why you have to login too some IRC chat, and then do !linux too have a link (that can easily be posted on the original post) too the download too then be able to download. it just seems so unnecessary,  and this is the only mod in existence too have such a method for downloading. i mean, if @eggrobin has a reason why, then i guess its ok, but still.

It is also the only mod that will cause actual crashes (as opposed to just breaking and throwing exceptions), that has its own logs, that requires the user to download different binaries for different platforms (even within Linux, things vary, the Ubuntu build seems to have trouble on arch), that requires the user to install the appropriate C++ runtime (this is probably what @FreeThinker is running into by the way, missing or misinstalled C++ runtime), etc.

As a result, a (small) potential barrier, and one that hopefully heightens the chances of having the user read the FAQ, is welcome while the mod is still very unstable:

On 2/13/2016 at 2:13 PM, Autochton said:

Pretty much. Log on EsperNet IRC, go to the #principia channel, and ask Egg. It's basically just a minor hoop to jump through in order to keep the testing cohort to relatively engaged users who can follow simple instructions. :-)

In addition, the IRC channel allow users to get support fairly quickly with the usual stuff (e.g. misinstalled C++ libs), and facilitates bugreporting (since I can quickly specify which logs are needed, how to start a journalling instance to replicate the bug, etc.).

When we consider that things are stabler, we will switch to a more conventional release mechanism. In the meantime this minor inconvenience helps us fix issues more quickly by interacting with users, which helps us find and diagnose the bugs.

Edited by eggrobin

Share this post


Link to post
Share on other sites
12 minutes ago, 123nick said:

 and are people really showing the " gimme gimme now now now attitude" that you say they are?

You must not frequent the popular mod threads. Maybe only few now, but tolerating the attitude only perpetuate the false assumption that that it is ok. That is whwy I said I would love for more of the most popular mods to adopt this idea. If only :rolleyes: 

 

Egg Robin beautifully sums it up. Straight from the horses mouth. :) 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.