Local co-ordinates from netlog

Hello, CMDRs.

My apologies if this is a) the wrong place to post this, or b) something already known. I did give the forums a once-over but admittedly, it was not a thorough search.

The prefacing TL;DR:

Turning on verbose logging in the appconfig file, and then collecting RelPos lines from the netlog file as they are generated, as your ship moves through space, provides the information necessary to create several interesting tools, probably far beyond my meager suggestions below.


If you turn on Verbose Logging, and look through the netlog files, you'll find that your xyz position is given (in sporadic, non-regular intervals) relative to the closest celestial body.

Example: {19:10:30GMT 140.464s} System:"Pira" StarPos:(139.156,-140.344,78.750)ly Body:15 RelPos:(-1452.99,-108.599,-831.424)km NormalFlight

Breaking that down..

{19:10:30GMT 140.464s} - Timestamp
System:"Pira" - Star System
StarPos:(139.156,-140.344,78.750)ly - Co-ordinates of star on galactic map
Body:15 - Closest celestial body to your current position, starts from Body 0 at main star and increments from there. (celestial bodies in this case including stations)
RelPos:(-1452.99,-108.599,-831.424)km - your ship's XYZ co-ordinates in a (left handed) cartesian co-ordinate system with the Body at its center.
NormalFlight - flightmode, normal space or supercruise. *note: position entries in the netlog are much fewer and far between in supercruise than in normal flight.

Body 0's co-ordinate system seems to be the default, so any time you are showing as in 'deep space' on the lower left display panel of your HUD you are in the Body 0 co-ordinate frame.

Why is this useful? welll that's a great question, and I might not have the entire answer to that. However, one thing this would allow is to measure the position of orbital bodies relative to the star, over time, to then determine orbital state vectors (via Lambert's Problem?), which could then be used to generate an accurate 3D orrery view of a system.

That part is pretty straight forward, so i'll go on to the other potential use.

Triangulating objects seen in the skybox.

Assuming of course that the skybox is static in any given system (that no amount of supercruise travel in a system will change the skybox view), then we could find an object in the skybox, generate a vector by aiming the ship at it and thrusting towards it in normal space, then jump to another system a reasonable distance away and generate a second vector. (and maybe a third and fourth, hey i admit i haven't worked all this out yet).

There is a hurdle, however.

The co-ordinate system for each object is rotated to some degree from every other co-ordinate system. This means that if i aim towards Sol while in the co-ordinate system of the Sirius star i generate a particular vector. However, if i then go visit Mr. Qwent and again aim towards Sol the vector generated is different because of that rotation.

Add to this that the Body 0 co-ordinate system is itself rotated from the galactic co-ordinate system, and i started to get nosebleeds.

This is not insurmountable, through rotation matrices and the saintly strangers on reddit who educated me on how to produce them from collected data. The results of my desperate pleas is the formula below

The local coordinate frame is rotated by some rotation matrix to produce the global coordinates. (or the other way around, depending on your preference i guess)

GlobalAxGlobalBxGlobalCxRotationRotationRotationLocalAxLocalBxLocalCx
GlobalAyGlobalByGLobalCy =RotationRotationRotation XLocalAyLocalByLocalCy
GlobalAzGlobalBzGlobalCzRotationRotationRotationLocalAzLocalBzLocalCz

Please excuse the shameful formatting.



... there's a lot of math i find unpleasant and confusing coming so i'll keep it simplified and then expand on the process later, my apologies.


Lets use the location i'm at, OOb Airg NG-I b37-0 and collect some examples. Also, lets call Oob Airg NG-I b37-0 "Star1" from now on, to mitigate my anxiety of typoes.


Star NameGalactic XGalactic YGalactic Z
Star1-11239.56356-10499.875
Sol000
Colonia-9530.5-910.2812519808.125


I'm also adding Sag A* here, which we'll use to confirm the process by working backwards later.



Sag A*25.21875-20.90625 25899.96875


The vectors, in the galactic co-ordinate system (after being normalized), from Star1 to each system are

to Sol 0.730738491-0.0036408320.682647788
to Colonia0.056271888-0.0318153690.997908441
to Sag A*0.29563914-0.002018370.955297558

And in the local co-ordinate system...

To Sol 0.359695108-0.363691720.859271646
to Colonia0.906858336-0.1953746270.373412256
to Sag A*0.776520545-0.2884219170.560204107


We use these to get two matrices, lets call them Global and Local

Global:

0.7307384910.0562718880.018085475
-0.003640832-0.031815369-0.690796228
0.6826477880.997908441-0.023043839


Local:

0.3596951080.9068583360.032072932
-0.36369172-0.1953746270.644923094
0.8592716460.3734122560.259541571


we know that the local coordinates, times some rotation, equals global coordinates.

[AG,BG,CG] = R X [AL, BL, CL]

so by transposition and inversion we solve for Rotation matrix

Rotation, in this particular case, is

-0.374272219-0.307839488 0.881781877
-0.087153679-0.934707192-0.363065754
0.927085568-0.2082254880.312896094

and Inverse Rotation is

-0.363309301-0.0861596790.923878354
-0.30532563-0.922517895-0.209986797
0.873268272-0.3586313340.318831426


Local vector, by rotation of the global vector...




globalvectorx
Inverse Rotation MatrixXglobalvectory
globalvectorz


in the case of Sag * Global


-0.363309301-0.086159679 0.9238783540.29563914
-0.30532563-0.922517895-0.209986797X-0.00201837
0.873268272-0.3586313340.3188314260.955297558

equals....

0.775344189
-0.289004099
0.563475014

which is... very CLOSE to the observed local vector of

0.776520545
-0.288421917
0.560204107

It's not an exact match, but it's close. Single Value Decomposition can do wonders clearing up the rotation and the results, but... c'mon guys. I'm far outside my math comfort zone here.

So... ultimately, this process can allow us to unify directions with in a system, from any celestial body that has it's own co-ordinate system, with the global, galactic system. Which would allow us to take direct measurements towards a targetted object / star in the skybox and translate that collected vector to a global vector which would in turn help pin-point these skybox-observed objects in the galaxy at large.

I think that there are other uses, as well. Of course the possibility of creating an accurate 3d orrery of any given system, or creating 'heading' and 'orientation' vectors on either a system map or a local-space map. The usefulness of the last two is a bit questionable, given the sporadic way the RelPos lines are generated in the netlog.

... I tell you what, guys. I'm getting tired here. And if anyone is interested in seeing how i got the numbers above, or how i collected the local vector data, i'm THRILLED to oblige. However, at this point I would like to just get this into the public view so that i can find out if this is interesting and potentially useful for others, or if it remains in the realm of "what i do to fend off space-madness"

Thank you all for your time reading this, and fly safe o7
 
*note: position entries in the netlog are much fewer and far between in supercruise than in normal flight.

I wonder if this is the cause of something I've noticed in the nav panel - the "distance to..." number as you're approaching/scanning an object updates in larger increments than on the target HUD, where "distance to..." counts down sequentially.

Good work by the way, +1.
 
It definitely does appear to update on the same type of delay when in supercruise. I tested it by going near a landable planet (under the 1Mm mark), and in normalspace it updates pretty rapidly, so I'd say you're right.
 
The tool TCE mk II makes use of this to tell you how far you are from a poi you added (to TCE) and from stations (can be nice to know without needing to target the station). You may already know that of course, in which case....move along, nothing to see :)
 
The tool TCE mk II makes use of this to tell you how far you are from a poi you added (to TCE) and from stations (can be nice to know without needing to target the station). You may already know that of course, in which case....move along, nothing to see :)

I was not aware of this. I'll look at that tool when i'm in front of ED again
 
Back
Top Bottom