maneatingape / rsvp

kOS library that enables scripted orbital transfer window planning and vessel rendezvous for the the game Kerbal Space Program
GNU General Public License v3.0
41 stars 5 forks source link

Tried to push NAN into the stack when attempting an intercept from a nearly-approaching orbit #6

Closed JonnyOThan closed 4 years ago

JonnyOThan commented 4 years ago

current vessel is ion-u [nero]. target is nero (from gpp).

neeero.zip

image

maneatingape commented 4 years ago

@JonnyOThan In order to reproduce I'm going to need some more info:

Additionally, your save file is heavily modded and I can't load the relevant craft. Using the F12 debug menu, can you cheat a stock craft into the same orbit (using the "Rendezvous" button). Anything with a kOS processor will do.

Then I can run the same script as you, with a craft in the same location to diagnose the issue.

JonnyOThan commented 4 years ago

KSP version: 1.8.1 GPP version: 1.6.4.0 RSVP version: v4

I'm sorry this is so lacking in details. I had hoped to get another screenshot of the actual orbits but one of the stream viewers had started another burn before I could. But essentially, imagine a transfer out to something like eeloo or jool but the burn undershot a little - so there is a close approach but no encounter. In my limited experience with rsvp, running it in this situation could produce a course correction to achieve an encounter, but it resulted in this error instead.

plan_rsvp is:

parameter destination is target.
parameter user_options is lexicon().

local options is lexicon(
    "create_maneuver_nodes", (choose "both" if destination:istype("body") else "first"),
    "verbose", true).

if destination:istype("body") {
    set options["final_orbit_periapsis"] to destination:atm:height + 10000.
}

for key in user_options:keys
    set options[key] to user_options[key].

runoncepath("rsvp/main").

print rsvp:goto(destination, options).
maneatingape commented 4 years ago

@JonnyOThan Thanks for the details, I was able to recreate the issue.

Steps:

This looks like your description of the situation: screenshot0

The expected behavior is that you should just be able to run the script again to refine the intercept. Will investigate the NaN error.

maneatingape commented 4 years ago

Fixed in c0c59dd1ed52bcb6d3db8ec8a37799350243db9e and Release 5

Running a new time-limited search:

local options is lex(
    "search_duration", 400 * 21600,
    "create_maneuver_nodes", "both",
    "verbose", true
).

print rsvp:goto(nero, options).

Resulted in a decent correction and intercept: screenshot1

maneatingape commented 4 years ago

@JonnyOThan Appreciate all the feedback btw, keep it coming!

JonnyOThan commented 4 years ago

Hm, the code is slightly different but I'm still hitting a similar error in the same situation. Vessel is "Leto Relay" rsvp_bug.zip

maneatingape commented 4 years ago

This is due to a bug, caused by using min instead of maxin the Lambert guard condition. Should be fixed in 4067861bf78a128a3a3dc2dcd7e0bb80fbd6f258.

Would you mind trying again using the latest master branch?