MechJeb2

MechJeb2

4M Downloads

Equatorial DN is off

mmomtchev opened this issue · 5 comments

commented

#1587 adds AN/DN to the target orbit info window, which are computed by MechJeb, and it seems that the DN is off.

This image shows Moon's orbit - the target's true longitude is 180° from the AN, but the DN is still 4 days ahead. Also, if you subtract the time to DN from the time to AN, the result should be exactly half the orbital period - and it is not.

mechjeb-bug

(This is issue seems to be independent from #1587)

commented

I think I have found the problem, what is called true anomaly should probably be called true longitude as AFAIK the result of this calculation is the true longitude and not the true anomaly:

public static double AscendingNodeEquatorialTrueAnomaly(this Orbit o)

It computes the direction of the equatorial crossing which is the Unity's up direction?

commented

Shouldn't all calculations involving orbital times use the mean anomaly instead of the true anomaly?

commented

Related to Principia dynamically modifying the orbital period, everything is like it should be in MechJeb

commented

I found the culprit - there are two overloaded functions called TrueAnomalyFromVector: one in KSP, that returns an angle in radians and another one in MechJeb that returns an angle in degrees. There is even a todo for fixing it 😄

//TODO 1.1 changed trueAnomaly to rad but MJ ext stil uses deg. Should change for consistency

The equatorial DN uses the KSP version.

commented

Fixed by #1589