GithubHelp home page GithubHelp logo

Comments (2)

maneatingape avatar maneatingape commented on June 12, 2024

@meep366 Thanks for the thoughtful feedback and happy new year to you too!

First the good news - this feature should be theoretically possible.
Next the tricky part - there might be practical considerations that make it difficult to implement in a reliable, timely and accurate fashion.

Background
I had considered this use case when originally writing RSVP but decided not to include as it increases complexity and test cases substantially and I felt that the cost/benefit balance was not enough. In the stock game the utility of this feature is mostly limited to a single case (Kerbin transfer directly to a Joolian moon, for example Laythe or Tylo). However there is the example that you provide in your report and several players have also used this library with planet packs (for example Galileo's Planet Pack) that have more extensive planet-moon systems (and even sub-moons) where this feature could come in useful.

Technical context
RSVP implements the Lambert problem solver that assumes 2 bodies in orbit around a single common parent, for example 2 ships in orbit around the Sun. However this would not be overly useful, so it uses a trick to allow travel from orbit around planets.

Let's use your example of a rendezvous from a ship in orbit around Minmus to a ship in orbit around Kerbin.

  1. Common parent is Kerbin
  2. Transfer is first computed as if the ship has the same orbit as Minmus around Kerbin, assuming the ship is a single zero-dimensional point located at the center of Minmus.
  3. Once a transfer is found, an iterative algorithm adjusts the departure position and time to account for the fact that the ship will leave from the edge of Minmus's SOI (and not from the center of the planet)
  4. This algorithm mostly converges. The smaller the SOI relative to the radius of the orbit the more likely this is. For example most planets are fine, but Ike-Duna, Jool-Laythe and Jool-Tylo have abnormally large ratios of SOI to orbital radius, so failure is more likely in those scenarios.

So how could your suggestion be implemented?
Let's use the example provided: A ship in orbit around Kerbin desiring a transfer to ship in orbit around Minmus.

There's no direct common parent but one idea is to use a simplifying trick. The destination ship is in elliptical orbit around Minmus, which is in elliptical orbit around Kerbin. By combining the ship's position and velocity with Minmus's position and velocity respectively, we could "erase" Minmus and pretend that the destination ship is in a strange orbit around Kerbin that speeds up and slows down and wobbles (this approach could also be recursively applied to sub-moons). The Lambert solver only considers zero-dimensional points, so would provide a transfer solution.

Now for the first tricky part. The script uses a simple hill climbing algorithm to find the best transfer window. This assumes a "smooth" gently sloping porkkchop plot that has an obvious valley. For example here is the plot from Kerbin to Duna with a single valley that the algorithm will nearly always converge to (notice the diagonal ridge from bottom left to top middle that can throw off the some searches).
Kerbin to Duna transfer

Kerbin to Moho is more challenging, the features repeat (at the synodic interval), and are much more "rugged" with local minima that the alogorithm could get trapped in. To workaround this the script simply starts many searches and usually one will find the global minimum (for the given search parameters).
Kerbin to Moho

The trick suggested above would add a layer of wrinkles (or noise) to the porkchop plot that could throw off the hill climbing algorithm. Instead of a single smooth curve from peak to valley, it would rise and fall in a bumpy manner (although overall decreasing).

However this is just one idea - I'm sure there are other approaches that you could try.

Alternatives
As a plan B, there's always the workaround that you suggested of plotting a transfer to Minmus and then a second transfer to rendezvous with the ship. With the foreknowledge that the ship is the final destination, the script could choose a target orbit around Minmus that gives a good chance of an optimal second transfer orbit. One nice feature of this approach is that it would be much simpler to get started, you would essentially be writing a wrapper script to build more sophisticated transfers on top of the direct transfers provided by the RSVP library. Detailed knowledge of the internal workings of RSVP would not be needed.

from rsvp.

meep366 avatar meep366 commented on June 12, 2024

@maneatingape Thank you for this excellent explanation, that adds a lot of clarity to what's going on behind the scenes. I have been working towards Plan B occasionally over the last week or so, and so far seems like if I target an elliptical orbit dropping in on Minmus with the periapsis close to the orbit of my target vessel, and there doesn't seem to be a huge delta-v penalty versus what might be the optimal transfer.

I'll let you know if I manage to get something working, and maybe I'll go back and try to do the full implementation after getting the simpler one working.

Thanks again!

from rsvp.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.