Comments (2)
@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.
- Common parent is Kerbin
- 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.
- 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)
- 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 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).
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.
@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)
- Transfers *from* moons not working properly HOT 2
- max_time_of_flight default value
- Allow for transfer into custom orbit HOT 2
- Define minimal altitude
- Add retry logic to transfer creation HOT 1
- Add "impatience_factor" option to weight transfer search by time as well as delta-v
- search.ks fails when time:seconds > 2^31 HOT 1
- Running other files should not include extension HOT 2
- Tried to push NAN into the stack when attempting an intercept from a nearly-approaching orbit HOT 7
- Request: polar insertion HOT 3
- Add a mid course plane change option with node creation HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rsvp.