Git Product home page Git Product logo

astrogator's Introduction

How to donate

Donate

astrogator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

astrogator's Issues

Excessive lag when under force

Whenever RCS, Engines, or drag is continuously changing velocity, Astrogator continuously recalculates route updates. This results in extreme performance lag, dropping FPS to 2-3 FPS.

Recommend: disable automatic updates in the atmosphere and reduce recalculation rate to no more than once per second.

[LOG 23:36:46.479] [Astrogator 6261.723] Got route from Kerbin, calculating ejection
[LOG 23:36:46.486] [Astrogator 6261.730] Differences: sma
[LOG 23:36:46.487] [Astrogator 6261.731] Looking for a route from 4 to the Mun, via Kerbin
[LOG 23:36:46.489] [Astrogator 6261.733] Found transfer patch, parent: Kerbin, destination: the Mun
[LOG 23:36:46.490] [Astrogator 6261.734] Looking for a route from 4 to Minmus, via Kerbin
[LOG 23:36:46.491] [Astrogator 6261.735] Found transfer patch, parent: Kerbin, destination: Minmus
[LOG 23:36:46.493] [Astrogator 6261.737] Looking for a route from 4 to Moho, via Kerbin
[LOG 23:36:46.494] [Astrogator 6261.738] Direct route to Moho not found, recursing through parent Kerbin
[LOG 23:36:46.495] [Astrogator 6261.739] Looking for a route from 4 to Moho, via the Sun
[LOG 23:36:46.497] [Astrogator 6261.741] Found transfer patch, parent: the Sun, destination: Moho
[LOG 23:36:46.498] [Astrogator 6261.742] Got route from Kerbin, calculating ejection
[LOG 23:36:46.499] [Astrogator 6261.744] Looking for a route from 4 to Eve, via Kerbin
[LOG 23:36:46.501] [Astrogator 6261.745] Direct route to Eve not found, recursing through parent Kerbin
[LOG 23:36:46.502] [Astrogator 6261.746] Looking for a route from 4 to Eve, via the Sun
[LOG 23:36:46.504] [Astrogator 6261.748] Found transfer patch, parent: the Sun, destination: Eve
[LOG 23:36:46.505] [Astrogator 6261.749] Got route from Kerbin, calculating ejection
[LOG 23:36:46.507] [Astrogator 6261.750] Looking for a route from 4 to Duna, via Kerbin
[LOG 23:36:46.508] [Astrogator 6261.752] Direct route to Duna not found, recursing through parent Kerbin
[LOG 23:36:46.509] [Astrogator 6261.753] Looking for a route from 4 to Duna, via the Sun
[LOG 23:36:46.510] [Astrogator 6261.754] Found transfer patch, parent: the Sun, destination: Duna
[LOG 23:36:46.512] [Astrogator 6261.756] Got route from Kerbin, calculating ejection
[LOG 23:36:46.513] [Astrogator 6261.757] Looking for a route from 4 to Dres, via Kerbin
[LOG 23:36:46.514] [Astrogator 6261.758] Direct route to Dres not found, recursing through parent Kerbin
[LOG 23:36:46.516] [Astrogator 6261.760] Looking for a route from 4 to Dres, via the Sun
[LOG 23:36:46.517] [Astrogator 6261.761] Found transfer patch, parent: the Sun, destination: Dres
[LOG 23:36:46.518] [Astrogator 6261.763] Got route from Kerbin, calculating ejection
[LOG 23:36:46.520] [Astrogator 6261.764] Looking for a route from 4 to Jool, via Kerbin
[LOG 23:36:46.521] [Astrogator 6261.765] Direct route to Jool not found, recursing through parent Kerbin
[LOG 23:36:46.523] [Astrogator 6261.767] Looking for a route from 4 to Jool, via the Sun
[LOG 23:36:46.524] [Astrogator 6261.768] Found transfer patch, parent: the Sun, destination: Jool
[LOG 23:36:46.525] [Astrogator 6261.769] Got route from Kerbin, calculating ejection
[LOG 23:36:46.526] [Astrogator 6261.771] Looking for a route from 4 to Eeloo, via Kerbin
[LOG 23:36:46.528] [Astrogator 6261.772] Direct route to Eeloo not found, recursing through parent Kerbin
[LOG 23:36:46.529] [Astrogator 6261.773] Looking for a route from 4 to Eeloo, via the Sun
[LOG 23:36:46.530] [Astrogator 6261.774] Found transfer patch, parent: the Sun, destination: Eeloo
[LOG 23:36:46.532] [Astrogator 6261.776] Got route from Kerbin, calculating ejection

Switching vessels adds stock toolbar icon

And quitting to the main menu doesn't reset it. At the moment I have eight Astrogater icons. Also tried switching to a different save game, same results, but now I have nine. More general case than vessel switching then.

Flicker-dance when settings open in short windows

I often play on a laptop in a window 768 pixels high. When I open the Astrogator settings, it sticks off the bottom of the window. When I then try to drag the Astrogator pane up to see the bottom of the settings, the whole window flickers between two states, showing the bottom of the pane and the top. It’s hard to describe, so I made a short screencast of it happening.

Interrupted transfers

I was trying to create a transfer to Minmus, but as the Mun was in the way, it didn't make a sensible transfer.

Is this expected, or should Astrogator try another orbit when there isn't a body in the way?

Here's an image of the result:

image

The deltaV of the 2 nodes created when there isn't an intercept are the same as when there is an intercept, so it looks like it calculated the transfer as if nothing would get in the way. Can the calculations take into consideration that the eventual target isn't the one specified?

Garbage generation doubled over stock

Hey,
CPU chart

when I saw this was updated for 1.7 I was very excited. Having a reduced number of mods to only the 1.7 compatible ones this would be a welcome addition.

Unfortunately, after installing this mod I found KSP to be nonresponsive every 15 seconds dropping frames to 1fps and dropping load from GPU and CPU during that time. I'm assuming it's doing a memory cleanup - but could be wrong.

So I will attach a picture of the CPU graph showing this. Once I removed the mod and ran KSP again, the memory cleanup was back to normal at about once per 10 min. and the CPU chart was pretty flat.

I hope you find the problem and patch it. I'd love to add this back in.

Should transfers reach target when in inclined orbits?

Using v0.10.4

Sorry if this is a known thing, I couldn't see it in the docs.

Does Astrogator take into consideration the inclination when calculating the initial burn?
Obviously very high values are going to be hard to calculate an ejection for, but lower angles should work?

In experimenting I found it would hit Mun with a 17 degree inclination or less, getting better as it got closer to 0.
Minmus misses with anything over 0.4 degree inclination.

The initial DV doesn't seem to change whatever the inclination (just the plane change DV).

(And also in testing my little ship, I can't seem to get an Eve intercept at all even with a 0 inclination, but that's for a different thread)

Is KoS integration possible?

Would it be possible to access Astrogator from within KoS?

Something like:

addons:astrogator:create(Minmus)

so that the maneuver node can be created from KoS script?
It would wipe out half the code I've written in trying to work out a decent node for transferring between bodies.

Transfer solution instability when at or near window

Background

Astrogator version: v0.10.1
KSP version: 1.10.1

Problem

Transfers sometimes change unexpectedly, especially when very close to a planned burn. For example, you might warp to a few minutes before what Astrogator said was the correct window, only to discover that it now wants you to wait a year and a half.

Link to reference PM (only works for me, obviously):

Cause

We determine the "angle search space" to use based on an initial rough guess plus or minus π/2. If the initial rough guess is in the past, we advance the whole search space a full τ into the future, even if much of the search space was OK and even if the eventual optimal solution it contained would have been in the future.

double optimalPhaseAngle = clamp(Math.PI * (
1 - Math.Pow(
(currentOrbit.semiMajorAxis + transferDestination.GetOrbit().semiMajorAxis)
/ (2 * transferDestination.GetOrbit().semiMajorAxis),
1.5)
));
double currentPhaseAngle = clamp(
AbsolutePhaseAngle(transferDestination.GetOrbit(), now)
- AbsolutePhaseAngle(currentOrbit, now));
double angleToMakeUp = currentPhaseAngle - optimalPhaseAngle;
double phaseAnglePerSecond =
(Tau / transferDestination.GetOrbit().period)
- (Tau / currentOrbit.period);
// This whole section borrowed from Kerbal Alarm Clock; thanks, TriggerAu!
if (angleToMakeUp > 0 && phaseAnglePerSecond > 0)
angleToMakeUp -= Tau;
if (angleToMakeUp < 0 && phaseAnglePerSecond < 0)
angleToMakeUp += Tau;
if (phaseAnglePerSecond == 0) {
// Can't launch to surface-stationary target because
// we'll never reach a good relative phase angle for it.
// Ideally we'd check <Epsilon here, but that risks breaking
// normal transfers to asteroids, since they have very low
// relative angular velocities.
return null;
}
// This is the launch time used by Kerbal Alarm Clock
double timeTillOptimalPhaseAngle = Math.Abs(angleToMakeUp / phaseAnglePerSecond);
// We'll search a time span this wide for the best burn time
double searchInterval = 0.5 * Math.PI / Math.Abs(phaseAnglePerSecond);
double ejectionBurnTime = BurnTimeSearch(
currentOrbit,
transferDestination.GetOrbit(),
Math.Max(now, now + timeTillOptimalPhaseAngle - 0.5 * searchInterval),
now + timeTillOptimalPhaseAngle + 0.5 * searchInterval
);
double arrivalTime = ejectionBurnTime + TransferTravelTime(
currentOrbit, transferDestination.GetOrbit(), ejectionBurnTime
);

Ideas

The angleToMakeUp += Tau / angleToMakeUp -= Tau lines should probably be conditional on whether the search interval is out of range, not just the initial guess. This way we could still find transfers where the initial guess is in the very recent past but the optimal solution is in the near future. And if the solution we find isn't in the future, then we can advance by τ and try again.

NRE spam on compiling internal spaces

[EXC 13:11:07.644] NullReferenceException: Object reference not set to an instance of an object
    FlightGlobals.get_ActiveVessel () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    Astrogator.AstrogatorMenu..ctor () (at <53d746b99efb4192a3e3b763aab2ce34>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Object:Instantiate(InternalProp)
    PartLoader:GetInternalProp(String)
    InternalModel:AddProp(ConfigNode)
    InternalModel:Load(ConfigNode)
    PartLoader:LoadInternalSpace(UrlConfig)
    <CompileInternalSpaces>d__79:MoveNext()
    KSPCommunityFixes.Performance.<FrameUnlockedCoroutine>d__62:MoveNext()
    KSPCommunityFixes.Performance.<PartLoader_CompileAll>d__58:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

KSP - 2024-02-24T132234.261.log.zip

Astrogator window opening with no "settings" or "close" icons.

KSP version: 1.7.0
OS: Windows 10

I'm having a strange issue with Astrogator after I updated it to v0.9.1. When I click it's toolbar icon to open a window for it, there is no "X" to close the window and the settings symbol is missing too. If I uninstall it and install the previous v0.9.0, I have no problems like this with it.

I have installed it via CKAN, but have manually installed with the same results. Any help if I am missing some step would be greatly appreciated.

Oh, another thing, I'm opening it at the space center screen. I'm not sure if that is why it's occurring, where as if I opened it while controlling a spaceship in space it might not happen. With the previous version it did not matter for me.

spacecenter_screen

Window position problems with UI Scale setting

If GameSettings.UI_SCALE is not 1.0, multiple problems occur:

  • The window can disappear off the edge of the screen.
  • The window jumps around the screen when clicking to/from the settings

This is due to some very weird treatment of the positioning parameter of MultiOptionDialog; at 100% scale, (0,0) is the lower left of the screen and (1,1) is the upper right, with (0.5,0.5) at the center. However, at every other scale, the bounds and center point are changed in surprising ways, such that there does not appear to be any mapping from coordinates at one scale to any other, nor any way to find the center or edges at any scale other than 100%. This creates many problems for us, as we wish to:

  1. Preserve the position of our window when closing and re-opening, both manual and automated
  2. Ensure our window is visible (on-screen) whenever it is open

In essence, it is impossible for us to construct valid coordinates or test the validity of coordinates at any scale other than 100%. In v0.7.3, we account for this by refusing to open our window at all if the scale is not 100% and providing one-click access to reset it.

This issue tracks the problem of the window disappearing and jumping.

Null ref in Astrogator.Settings.get_GeneratePlaneChangeBurns

[LOG 03:02:47.408] Game State Saved as persistent
[ERR 03:02:47.445] Exception handling event onFlightReady in class FlightAstrogator:System.NullReferenceException: Object reference not set to an instance of an object
at Astrogator.Settings.get_GeneratePlaneChangeBurns () [0x00000] in :0
at Astrogator.Astrogator.OnFlightReady () [0x00000] in :0
at EventVoid.Fire () [0x00000] in :0

[EXC 03:02:47.447] NullReferenceException: Object reference not set to an instance of an object
Astrogator.Settings.get_GeneratePlaneChangeBurns ()
Astrogator.Astrogator.OnFlightReady ()
EventVoid.Fire ()
UnityEngine.Debug:LogException(Exception)
EventVoid:Fire()
c__Iterator44:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[ERR 03:02:47.450] Exception handling event onFlightReady in class SpaceCenterAstrogator:System.NullReferenceException: Object reference not set to an instance of an object
at Astrogator.Settings.get_GeneratePlaneChangeBurns () [0x00000] in :0
at Astrogator.Astrogator.OnFlightReady () [0x00000] in :0
at EventVoid.Fire () [0x00000] in :0

[EXC 03:02:47.452] NullReferenceException: Object reference not set to an instance of an object
Astrogator.Settings.get_GeneratePlaneChangeBurns ()
Astrogator.Astrogator.OnFlightReady ()
EventVoid.Fire ()
UnityEngine.Debug:LogException(Exception)
EventVoid:Fire()
c__Iterator44:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[LOG 03:02:47.456] crushingDepth Exception!
[LOG 03:02:47.457] Method not found: 'EventReport..ctor'.
[LOG 03:02:47.522] crushingDepth Exception!
[LOG 03:02:47.523] Method not found: 'EventReport..ctor'.
[LOG 03:02:47.552] crushingDepth Exception!
[LOG 03:02:47.553] Method not found: 'EventReport..ctor'.
[LOG 03:02:47.556] -INFO- Tac.LifeSupportController[FFF0C47E][341.25]: Vessel situation change

KSP crashes when quitting if Astrogator installed (OS X)

Of late, KSP has been crashing when I quit the game in OS X 10.11.6. There don’t seem to be any actual side effects from this in the game itself, but basically the game freezes for half a second after quitting (either by clicking the “Quit Game” menu option or just hitting ⌘Q), and then a crash dialog pops up as the game shuts down or is shut down by the crash-handling system.

I’m reporting it here because I uninstalled Astrogator, and the crashing problem stopped. I’ve tested this a few times by reinstalling to get the quit-crash again, and then uninstalling to make it go away.

I don’t know if this is a conflict with another mod, or if Astrogator just makes KSP itself unhappy. I do have crash logs I can share. I can’t find Astrogator’s name in the crash log, but I’m not terribly familiar with log parsing.

IndexOutOfRangeException

Background

Astrogator version: 0.10.0

KSP version: 1.9.1.2788

Operating system: Win 10 Pro x62 1909 Build 18363.778

Planet packs installed: None

Save file: Not included

Problem

I realize this one won't be easily reproduced but I am getting a hard crash in KSP, log exceptions below.

I have multiple landed vessels within the same scenes (within 50km). Some with no engines and some with engines. When switching between them I get the crash without Astrogator GUI being open or used since game launch.

[EXC 12:30:19.853] IndexOutOfRangeException: index + length > size
	System.Array.Clear (System.Array array, System.Int32 index, System.Int32 length) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Collections.Generic.List`1[T].Clear () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	PatchedConicSolver.RemoveManeuverNode (ManeuverNode node) (at <55ba45dc3a43403382024deac8dcd0be>:0)
	ManeuverNode.RemoveSelf () (at <55ba45dc3a43403382024deac8dcd0be>:0)
	Astrogator.KerbalTools.ClearManeuverNodes () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette.RecalculatePlaneChanges () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette.ThreadStart (ITargetable newOrigin, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback partialLoaded, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback fullyLoaded, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback aborted) (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette+<>c__DisplayClass33_0.<TryStartLoad>b__0 () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ThreadHelper.ThreadStart () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)
[EXC 12:30:19.857] IndexOutOfRangeException: index + length > size
	System.Array.Clear (System.Array array, System.Int32 index, System.Int32 length) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Collections.Generic.List`1[T].Clear () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	PatchedConicSolver.RemoveManeuverNode (ManeuverNode node) (at <55ba45dc3a43403382024deac8dcd0be>:0)
	ManeuverNode.RemoveSelf () (at <55ba45dc3a43403382024deac8dcd0be>:0)
	Astrogator.KerbalTools.ClearManeuverNodes () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette.RecalculatePlaneChanges () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette.ThreadStart (ITargetable newOrigin, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback partialLoaded, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback fullyLoaded, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback aborted) (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette+<>c__DisplayClass33_0.<TryStartLoad>b__0 () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ThreadHelper.ThreadStart () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)
[EXC 12:30:33.840] IndexOutOfRangeException: index + length > size
	System.Array.Clear (System.Array array, System.Int32 index, System.Int32 length) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Collections.Generic.List`1[T].Clear () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	PatchedConicSolver.RemoveManeuverNode (ManeuverNode node) (at <55ba45dc3a43403382024deac8dcd0be>:0)
	ManeuverNode.RemoveSelf () (at <55ba45dc3a43403382024deac8dcd0be>:0)
	Astrogator.KerbalTools.ClearManeuverNodes () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette.RecalculatePlaneChanges () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette.ThreadStart (ITargetable newOrigin, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback partialLoaded, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback fullyLoaded, Astrogator.AstrogationLoadBehaviorette+LoadDoneCallback aborted) (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	Astrogator.AstrogationLoadBehaviorette+<>c__DisplayClass33_0.<TryStartLoad>b__0 () (at <b33fb97694854c07a2d9d7891fb234c3>:0)
	System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Threading.ThreadHelper.ThreadStart () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)

MuTech bug in Descending Node maths

Background

Astrogator version: 0.10.4
KSP version: latest
Operating system: windoze
Planet packs installed: stuff

Problem

I was borrowing some of the MuMech maths from Astrographer to calculate time to AN/DN, and hit an issue.

The AN maths (<- correct spelling) seems to have an issue.

The MuMech_OrbitExtensions.DescendingNodeTrueAnomaly function is demonstrably wrong.

I pulled the functions connected to it into kOS-Astrogator to work out the time to the next AN or DN.

I'm testing with a probe around Kerbin, with Mun selected (because of its 0 degree inclination from Kerbin, it shows the AN/DN of any probe around Kerbin as they coincide with that of the Mun's orbit).

The AN node works fine (TimeOfAscendingNode()), I can create a node from the function's value and it lands right on top of the AN in the map view:

image

For the DN, it doesn't work. The time is completely out.
You can see the node some random distance between AN/DN below:

image

The maths for AN/DN are quite easy from the normals, the AN and DN being opposite cross products, so I changed the DescendingNodeTrueAnomaly function from this:

///Gives the true anomaly (in a's orbit) at which a crosses its descending node
///with b's orbit.
///The returned value is always between 0 and 360.
internal static double DescendingNodeTrueAnomaly(this Orbit a, Orbit b)
{
return MuUtils.ClampDegrees360(a.AscendingNodeTrueAnomaly(b) + 180);
}

to this:

        private static double DescendingNodeTrueAnomaly(this Orbit a, Orbit b)
        {
            Vector3d vectorToDN = Vector3d.Cross(b.SwappedOrbitNormal(), a.SwappedOrbitNormal());
            return a.TrueAnomalyFromVector(vectorToDN);
        }

which is just the vectors swapped around in the x-product instead of trying to add 180, and now the calculation to the DN correctly gives this, landing the node directly on the DN point:

image

I haven't yet sat down with a piece of paper and pen as to why the +180 version is wrong yet, but thought I'd report it, as I'm introducing the calculations into kOS-Astrogator, and thought you'd like to update Astrogator as it affects at least one of its functions.

UI scale window position

Background

Astrogator version:
0.9.2

KSP version:
1.7.3.2594 win 64 en-us

Operating system:
WIndows 10 x64

Planet packs installed:
None

Save file:

Problem

I appear to have the UI scaling bug. For some time, I thought the astrogator window just wasn't opening. Not til I perused prior posts here did it occur to me that my symptoms seemed consistent with the UI scaling bug. Reports imply that was fixed 2 years ago. My normal UI scale setting is 170% and I usually don't see the astrogator window at all. (It briefly came back right after a staging in a recent session, but when I came back later it was gone again). Indeed, if I drop the UI scaling to 100%, the astrogator window appears just fine. I pretty much can't read it or anything else on the screen, but I can see that it's there. At 150% UI scaling, the astrogator window is offset a bit low and left, but it is visible. At 170%, it disappears again. I tried manually editing the window position to a few different guesses in astrogator-settings.txt (I tried 0.0,0.0 and 0.25,.25 and 0.75,0.75) but none of them worked and after quitting I see that astrogator had automatically reset to the 0.5,0.35 that it seems to default to when UI scale is 170%. Other UI scales result in it auto-resetting to different values.

The astrogator window occasionally appears, and the position in the settings file changes, when staging. I've been unable to track down when this happens vs when it doesn't. Quitting and restarting the game makes the settings position reset and the window disappear again.

More details, such as other mods installed, are in my post in the KSP forum in the astrogator thread, You suggested I make an issue here.

Display times only use Kerbin days and years

All times are displayed with 6-hour days and 426-day years. Many planet packs change the length of the home planet's day and year, and it would be nice to use those values to display the times.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.