Jump to content

Orbit from ORBIT config node


Recommended Posts

Okay, I feel like this one should be easier than I'm making it, so going to the forums for some hopefully quick help. I'm trying to load/create an Orbit object from an ORBIT config node such as this one:

ORBIT{
SMA = 1449999.99996286
ECC = 1.07570816555399E-05
INC = 0
LPE = 270.690311604893
LAN = 1.93635924563296
MNA = 1.55872660382504
EPH = 31.3999999999994
REF = 1
}

This is the code that I've tried:

        public static Orbit ParseOrbit(ConfigNode configNode, CelestialBody body)
{
double inc = Convert.ToDouble(configNode.GetValue("INC"));
double e = Convert.ToDouble(configNode.GetValue("ECC"));
double sma = Convert.ToDouble(configNode.GetValue("SMA"));
double lan = Convert.ToDouble(configNode.GetValue("LAN"));
double w = Convert.ToDouble(configNode.GetValue("MNA"));
double mEp = Convert.ToDouble(configNode.GetValue("LPE"));
double t = Convert.ToDouble(configNode.GetValue("EPH"));

return new Orbit(inc, e, sma, lan, w, mEp, t, body);
}

Now, the first 4 parameters are obvious (or at least, I think they are). Based purely on the parameter counts, I'm working on the wild guess that the last 3 just need to be in the right order (vs. representing different things and needing some conversion to get into the right form). Anyway, the code isn't working - when I instantiate a vessel with this orbit I get the "orbit is NaN" error in the logs (and just FYI, the orbit is an 850KM circular equatorial orbit).

Anyway, my questions:

  1. Am I just getting the mapping/ordering on the last 3 parameters wrong?
  2. If not, how do I convert MNA/LPE/EPH to w/mEp/t. And what are w/mEp/t? I figured out the others from this page on the wiki.
  3. Is there a super obvious public class/method in the squad code base that I'm missing. I looked really hard for Orbit.Load() or something that would've made my life easy.

Thanks for the help!

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