Jump to content

Help with the orbit coordinate system


Recommended Posts

I'm working on yet another landing guidance plugin. I'm almost ready to share an early version, but I'm having trouble with the coordinate system. In particular, I'm trying to find the latitude and longitude of the active vessel on its current orbit at some arbitrary time in the future, taking into account the rotation of the planet.

The code looks something like this (with a nod to KER for inspiration): 

Vector3d position = vessel.GetOrbit().getPositionAtUT(currentTime + deltaT);

double bodyRot = 360 * (deltaT) / body.rotationPeriod;
double lat = body.GetLatitude(position);
double lon = NormAngle(body.GetLongitude(position) - bodyRot); //NormAngle normalises the angle between -180, 180.

When I continue on the current orbit and sample the actual lat and long at UT = currentTime + deltaT, I find:

a ) Lat and long are both a bit off (0-2 degrees), thought long is usually more wrong than lat (possibly suggesting that my bodyRot is incorrect).

b ) The error is greater the further in advance I try to calculate the lat and long (if I calculate no more than a few minutes into the future the error is negligible).

I suspect that my understanding of the value returned by Orbit.getPositionAtUT() might be incorrect. It seems to return a value which is sort of "the position that the vessel would be in at time UT if the main body stopped moving", which I think would make my logic consistent. But either of those assumptions may be wrong.

Can anyone offer any advice, or an alternative method?

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