Jump to content

How to restore a messed-up orbit?


Recommended Posts

I've got a problem where an asteroid changed its orbit without apparent reason. Which would have gone unnoticed if it wasn't for an asteroid redirect mission that is now going nowhere. There is no reasonable in-game explanation. The asteroid was trailing Kerbin by ~15° and should not have caught up by much in the meantime -- certainly not enough to get a timewarp pseudo-encounter.

I do have savegames from before and after. However, several hours of gameplay happened between the change and my becoming aware of it. I'm not exactly looking forward to doing it all over again. How do I edit the savegame so the asteroid is put back on the track and position where it's supposed to be at this point in time?

Orbit in a savegame looks like this (note that this is not the asteroid that's bugging me, it's just one set of orbital parameters I pulled from a savegame):


lat = -2.83448079789533
lon = 181.081293330851
alt = 14594725647.149
[...]
ORBIT
{
SMA = 15240603816.5306
ECC = 0.109160279581076
INC = 2.8722369411542
LPE = 2.11729314595258
LAN = 261.773336336443
MNA = 6.22770556444832
EPH = 2043585.73608398
REF = 0
}

I guess the ORBIT{} has to be copied from the old save, and lat/lon/alt need to be updated according to time. Are there any tools or helpers that could calculate this for me? Any launch window planner has to do that sort of prediction... but I Know Too Little to do it myself.

Edited by Laie
Link to comment
Share on other sites

Having tried my hand at a bit of save file editing recently (I have zero coding experience, so it's all a learning curve), I had to find out what each of those categories actually is. The top 3 (SMA, ECC, INC) are obvious, but the others less so.

  • SMA : Semimajor axis – the average of the periapsis and apoapsis distances from the orbiting body center
  • ECC : Eccentricity – shape of the ellipse, describing how much it elongated compared to a circle.
  • INC : Inclination – vertical tilt of the ellipse with respect to the reference plane, measured at the ascending node.
  • LPE : Longitude of periapsis – horizontally orients the periapsis of the ellipse.
  • LAN : Longitude of the ascending node – horizontally orients the ascending node of the ellipse.
  • MNA : Mean anomaly at epoch – defines the position of the orbiting body along the ellipse at a specific time.
  • EPH : epoch – the reference time for the orbit.
  • REF : reference body – the ID of the body around which the orbit occurs. 0 is the sun, 1 is Kerbin, 2 is Mun, 3 is Minmus.
  • OBJ : Some sort of object reference (I wouldn't change this number). It appears that 0 corresponds to probes, and 1 corresponds to debris.

So, I guess you would need to change the MNA and EPH, as the top 5 would remain the same regardless of where the roid is on its orbit

As for how much these need to be changed by, I have no idea I'm afraid, and would be interested to see a formula for calculating how these would change in relation to each other as the body moves on its orbit.

Link to comment
Share on other sites

@Wanderfound: see OP.

Use Hyperedit to enter the correct orbital parameters manually, the lat/long/altitude will take care of themselves.
It is the mean anomaly at "epoch", which means at Day 1 0:00:00. MNA doesn't change as the object follows its orbit.

....and right you are, it is really that simple. Just copy the ORBIT{} block from the old savegame, put it into the current save, and you have your old orbit back.

Tried and works.

By the way: looking through my old saves, the figures for lat/lon/alt apparently have never changed. Maybe they serve no real purpose or only come into play once I get into physics range, I don't know.

Edited by Laie
Link to comment
Share on other sites

Maybe they're only used when landed.

Most likely this. Although they are updated (on some occasions) while in orbit, I know for sure they are not used when in orbit (you can change them at will with no effect). I don't think they are used during suborbital flight, but I haven't confirmed that.

Cheers,

-Claw

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...