Jump to content

Unexplained Orbit Perturbation in 1.0.2 - With Log, Screenshots, Saves, and Reproduction Steps


Recommended Posts

KSP 1.0.2, Linux, 64-bit, Steam edition. Running a normal Ubuntu installation with an nVidia graphics card, using the recommended proprietary drivers.

Expected behavior: An unpowered, single-part craft in a circular orbit well outside the atmosphere will stay in the same, stable orbit when time acceleration is off, i.e. not "on rails." In reality, low earth orbits decay slightly. As I understood it, KSP orbits outside the atmosphere are expected to be perfectly stable.

Actual behavior: Apoapsis, periapsis, and semi-major axis all vary noticeably. In this test, starting in a roughly circular orbit, the orbit does not decay. The apsides change visibly, a meter or two per minute; the SMA (in this test) increases by a few meters per hour; the other orbital parameters change slightly.

Impact: Maneuvers and intercepts are unpredictable unless you're constantly in timewarp. Physics feels broken. Trust issues. Fun level decreases.

Reproduction steps and test case:

Download game from Steam. Launch and immediately begin a new sandbox save. Construct and launch something into orbit.

(You can see in the first screenshot below that I forgot the coupler on the first launch. That vehicle exhibited the same problem, but I wanted a single-part craft for the test, so I launched again. That's why there are two launches in the log.)

(While the batteries are still alive, turn the craft a bit and observe the orbit changing. AFAIK, that's a different, known bug, so that's not what this post is about.)

Disable the reaction wheels and turn off SAS; step away from the controls. Do not turn on time warp. (Physics warp also has different weird effects on the orbit. For this report I left physics warp off at all times.)

Observe the orbit. Here are my observations. The apsides are from the screenshots; SMA is from the save file captured just after each screenshot, available below. (Apo+Peri/2+600 agrees to six figures.) If you look carefully you can see that the longitude of periapsis changes by a few degrees too. If you look in the saves, you'll see that all orbit parameters are changing.

Observation 1: T+07:33, Apo 113,136, Peri 106,336, SMA 709,736.286620452

Observation 2: T+32:57, Apo 113,070, Peri 106,405, SMA 709,737.294459971

Observation 3: T+52:18, Apo 113,194, Peri 106,284, SMA 709,739.000280522

And here are the images. The apsides don't really show up in the Imgur preview, so there's not much to see.

Javascript is disabled. View full album

The KSP.log is here. I don't see anything interesting there; the NREs at the end are presumably because I Alt-F4'd the game at the end of the test. The three save files, in addition to the screenshots and log, are available here. In the save files, find the focused ship by searching for "pid = aa0eed81e6014276a778da4d41b363ea".

I don't know if any of the perturbations are periodic. Some of the effect could potentially be related to the craft's orientation relative to Kerbin or some such. I could run another test tonight if there's interest.

Edited by conklech
Link to comment
Share on other sites

First up, this isnt an unexplained problem to my knowledge. My space-station gaining 10km to its appoapsis every second even with no thrust or torque active is unexplained.

My understanding is that it is because when you aren't time warping, which halts all rotation and puts you "on rails", the craft will always either be applying some force via SAS, altering the orbit, or like you have done here if you disable the SAS and torque, there will be a minute amount of rotation no matter what, combining that with inaccuracies in the way ksp handles floating point calculations and you get some orbital "wobble". Anyway, you could view it as realistic, as in real life spacecraft experience similar effects, as gravity is not perfect or constant around the earth, meaning that there are wobbles in the real world.

Also this problem isn't unique to 1.0.2, This has been here since the early days of ksp, although i seem to remember it got improved somewhat around 0.25?

Link to comment
Share on other sites

there will be a minute amount of rotation no matter what, combining that with inaccuracies in the way ksp handles floating point calculations and you get some orbital "wobble". Anyway, you could view it as realistic, as in real life spacecraft experience similar effects, as gravity is not perfect or constant around the earth, meaning that there are wobbles in the real world.

Your explanation is consistent with my guess; roughly, that there's some accumulating floating-point error involving rotation. The Krakensbane solution didn't completely disconnect the local and accelerating frames of reference, it just factored it out to get some more precision. I wonder if this corner of the sim could be revisited during the Unity 5 transition?

I've done a similar test where I bounced in and out of (non-physics) warp to zero rotation; the same thing happens. The vessel of course rotates in the rotating OBT frame of reference shown on the navball; maybe some calculations are being done in that frame?

It's actually a much bigger problem when you're actually rotating, e.g. to align with a small-delta maneuver node that jumps all over the ball because your orbit is fluctuating by more than the desired change. Setting up synchronous orbits for RemoteTech networks is a pain; I dropped that mod in part because of this bug.

I'd be more willing to write this bug off as "oh, orbits are unstable in real life" if the orbital energy were decreasing rather than increasing. Furthermore, there's now an un-fun incentive to spend as little time off-rails as possible if you want to have reliable maneuver predictions.

This is an old problem, but it got a bit worse in KSP 1.0.2.

I noticed my simple craft, with barely 12 parts was changing AP-PE by 1 meter each 2 seconds... on a 100.000m orbit.

Windows 7, KSP 1.0.2 x86, Steam.

I agree that it's an existing problem that's gotten worse. I remember seeing jitters in 0.90, but I never watched long enough to notice whether there was a systematic error. These changes of a meter every few seconds are really disconcerting, especially in the stock game where you can't see that the semimajor axis is still sort of stable.

Thanks for confirming on Windows x86!

Link to comment
Share on other sites

It's an unavoidable consequence of the way KSP calculates orbits when you're off rails.

When you're on-rails, KSP takes your velocity and distance from the central body, and solves the Keplerian equations as a function of time for the position your spacecraft will be in. As a result, your spacecraft effectively travels a perfect Keplerian orbit, and the parameters that describe your orbit's shape and orientation do not change.

When you're off rails, things work differently. The game takes the position of your Root Part, its distance and direction from the center of the body you're orbiting, and its current velocity, and projects what the Keplerian orbit would be if it went on-rails at that very instant.

Then it assumes that the acceleration due to gravity would be the constant over the next timestep, calculates where your spacecraft would be based on that constant gravity magnitude and direction, and moves your spacecraft to where it would be based on that timestep. And then, it recalculates the orbit. Since your spacecraft is not /actually/ travelling a Perfect Keplerian Orbit, but instead making a large number of tiny jumps that /approximate/ one, the orbital parameters are going to change after each timestep.

Is this a big deal? On the whole...No. Yes, your orbital parameters are changing when you're in normal time. They're not changing much over the typical play time, and if you decide to kick back into timewarp, they'll stop changing. Yes, your Argument of Periapsis (The parameter the persistence file labels LPE ) changes. With an orbit as circular as the one you're using, the minor perturbations introduced by the timestep method are going to shift your line of apsides /because/ the orbit is so nearly circular.

Link to comment
Share on other sites

Thanks for the comprehensive explanation. Why does the orientation of the craft, even with one-piece crafts, seem to cause such large instantaneous changes? And do you agree with the casual observation that things are worse in 1.0.2? I think I have a 0.90 install lying around; maybe I can do a comparison test over the weekend.

Link to comment
Share on other sites

...

When you're off rails, things work differently. The game takes the position of your Root Part, its distance and direction from the center of the body you're orbiting, and its current velocity, and projects what the Keplerian orbit would be if it went on-rails at that very instant.

...

But KSP uses PhysX functions in Unity... it just apply gravty to parts... what I think is affecting orbits is how game reads and apply tranformations to objects each cycle...

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...