Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activating timewarp can often cause a vessel to forget about SOI changes #258

Open
JonnyOThan opened this issue Oct 7, 2024 · 1 comment
Labels
kspBug Identified KSP issue

Comments

@JonnyOThan
Copy link
Contributor

In the attached saved game my current ship is about to encounter the Mun. If you activate timewarp, the intercept disappears.
quicksave.zip

@JonnyOThan JonnyOThan added the kspBug Identified KSP issue label Oct 7, 2024
@JonnyOThan
Copy link
Contributor Author

I've made a bit of progress here: GetDTForTrueAnomaly can sometimes return a number greater than one period (implying that it is not the earliest occurrence of that tA), and GetDTforTrueAnomalyAtUT can return a negative number.

The connection to timewarp is that when activating warp in the second half of your orbit, your mean anomaly is negative while ObTAtEpoch is positive. When not in timewarp, your epoch is constantly updating to the current UTC and ObT and ObTAtEpoch are the same.

GetDTForTrueAnomaly should subtract a whole number of periods such that the result is always in [0,period), and GetDTforTrueAnomalyAtUT tries to do this but actually ends up ROUNDING the number of periods instead of taking the floor, which can produce a negative number when it rounded up. Fixing these two issues makes the intercept work again in timewarp. HOWEVER the intercept when not in warp starts flickering. It looks like the very end of the intercept calculation is a gradient descent solver that runs over the entire synodic period of the two orbits. This seems excessive, because we should already know roughly where the close approaches are. I'd guess that the instability of the intercept is related to that, but I haven't dug in yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kspBug Identified KSP issue
Development

No branches or pull requests

1 participant