Jump to content

[WIP] Horizontal Situation Indicator - ILS *Update July 5*


kujuman

Recommended Posts

do you know how to get all of these runways into MechJeb by any chance????????

Nope sorry.

Anyhow, here is the kerbinside south pole approach from the south showing the old vs. new calculated hsi angle. I have not altered the bearing calculation so that is still quite a bit off and you can use it to see how must accuracy is lost at this location using spherical coordinates (current latitude -85). The spherical coordinate method thinks the runway is way off to my right, when it is actually just slightly to the left. The displayed centerline dist is the distance in meters to the projection of the runway centerline.

hsi_newalgo.png

Close to the equator, the two coordinate systems are in close agreement and only differ due to differing floating point error.

hsi_newalgo2.png

Edited by Virindi
Link to comment
Share on other sites

The runway heading indicator (the angle of the magenta line) also suffers from a similar problem at the poles: since your heading coordinate varies so much from that of the runway, setting up so that you are pointed at the magenta line does not mean you are parallel to the runway. Currently, the magenta line's heading is the heading of the runway local to the runway. Because of this, near the pole, if you line up so that you are pointed at the magenta marker and the centerline is centered, and you keep flying, you will not end up pointing down the runway. The magenta marker will rotate itself as you move along the curve of the planet.

To fix this, we can project the runway heading vector into the ship's rotational space (the plane at the ship's location normal to the body's surface, we are taking the heading of the runway local to the player rather than local to the runway). This way, if the ship is aligned with the magenta marker it must be parallel to the runway, and if the centerline mark is also aligned then proceeding straight will always get you to the runway with correct alignment. It is thus possible to line up for landing on the opposite side of the pole, and continue straight in across the pole and down onto the runway. In other words, when near the pole, the magenta line stays steady as the compass rotates under it. This vector projection is essentially the opposite of the one used to determine the centerline angle (project runway to ship rather than project ship to runway).

It's tough to get a good screenshot showing the actual orientation of the runway at a decent range. In the images below I have drawn in a white line that approximates the path of the runway. It is much more visible when the scene is moving because you can see the flickering pixels of the runway.

Before, the magenta line is off here by about 90 degrees at 58km (ignore the debug text, it is from an earlier test). The white line indicating the real direction of the runway is visible directly below the aircraft:

runwayheading1.png

Similar location with new projection algorithm, the magenta line now matches the orientation of the runway from the perspective of the aircraft. Note the debug text, this is the angle of the magenta line using the old vs. new algorithm:

runwayheading2.png

Of course, near the equator (and not far around the planet from the runway) the effect of this projection is extremely small. Landing at KSC is nearly identical. Here we're doing a long turn to port out over the ocean. Note similar old vs. new results:

runwayheading3.png

Edited by Virindi
Link to comment
Share on other sites

I have completed these changes and submitted the code as a pull request to the github repo.

The changes are visible here: https://github.com/Virindi-AC/NavInstruments/commit/e681b5c04bffac7469236a526bb14201386ec03f

Sorry about the fact that monodevelop messed up the formatting a bit. Trying to get monodevelop to format like visual studio is like fighting a war. :\

Edited by Virindi
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...