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

Mission Architect won't iterate over coast event with anomaly #21

Open
1greywind opened this issue Feb 13, 2019 · 6 comments
Open

Mission Architect won't iterate over coast event with anomaly #21

1greywind opened this issue Feb 13, 2019 · 6 comments

Comments

@1greywind
Copy link

1greywind commented Feb 13, 2019

KSP TOT version - 1.6.2

Sometimes Mission Architect can't find more or less obvious solution. In attached example Optimizer is unable to find correct true anomaly and prograde dV for transmunar injection trajectory. This bug manifests itself in diffirent situations and only thing that helps is to manually set true anomaly insted of using it as optimization variable.

STR:
1
Setup following scenario:

  • use default initial state (Kerbin, SMA 700 km, e=0, i=0, raan=0, aop=0)
  • add coast to true anomaly event (true anomaly = 0, optimization range = [0, 360])
  • add dV maneuver (prograde dV=800, optimization range = [0, 1000])
  • add cost to periapsis event (reference body = Mun)
  • set optimization function to "minimize distance to body", applicable event=4, applicable body=Mun

2
Run optimization

3
Observe how optmization function value does not goes below 11300 km

Expected result:
Burn true anomaly after optimization = 140 degree, Maneuver prograde after optimization ~ 840 m\s

ksptot.log
bug-wont-iterate-over-true-anomaly.zip

@Arrowstar
Copy link
Owner

Okay, so I see what you're talking about here. Unfortunately this isn't a bug, it's a matter of how gradient descent optimization works. What you're trying to do is get to the Mun, yes?

The best way to handle this is to use the "revs prior to coast" function on Event 4. Set it to 1. Now try reoptimizing. You should see that you end up with a trajectory that runs right into the Mun. (At least I did when I changed that.)

Here's why this works. Without the coast revs set to 1, when you "go to periapsis" in event 4, you aren't actually moving because after the burn, you are at periapsis already. But what about the "Reference Body" to Mun that we set? This only kicks in if the propagator detects an SoI transition to that body during the coast. If it doesn't find one, then it just stops the first time it hits the target condition (true anom = 0) at any body.

Your initial problem set up prior to optimization probably doesn't intercept the Mun at any point, and so when you say go to periapsis, since you don't move, the optimizer probably seems a local minimum and quits early.

Anyway, I'm going to close this because it's more about software techniques than a bug in the code. Thanks for the reporting though! If you have any questions about this, please let me know. :)

@1greywind
Copy link
Author

Well, in this particular case you can add 1, 2, 3 or even 4 revs before coast and this won't solve problem.

Try this. Or I will upload video proof a little later.

@Arrowstar
Copy link
Owner

A video might be helpful. I was able to get a Mun intercept with no problem, but that may be because I'm familiar with the tool. It would be good to see what you're doing.

@1greywind
Copy link
Author

In this video I try to add 1 rev before coast, when 3, when 5: http://recordit.co/ibEAfMxCdm

@1greywind
Copy link
Author

1greywind commented Feb 15, 2019

A video might be helpful. I was able to get a Mun intercept with no problem, but that may be because I'm familiar with the tool. It would be good to see what you're doing.

I'm on KSP TOT 1.6.2 on Windows 7 x64. MCR version is 2017b.

I can get Mun intercept most times, but this example illustrates problem, that manifests itself in different situations. It is just simplest case.

@Arrowstar Arrowstar reopened this Feb 15, 2019
@Arrowstar
Copy link
Owner

Oh hey, I see. You need to add the rev before the coast to the Coast after the maneuver, Event 4. :)

Let me know how that works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants