Shared Memory and Current Position
-
I am trying to get the current position using shared memory. The closest I see to it is, the x and y position on the FlighData.h file, that according to the .h file is the Ownship North (Ft) and Ownship East (Ft).
If I understand correctly they are the feet north of the Ecuator and east of Greenwich.
But trying to convert that to degrees and compare those values to the ICP INS current position page, they don’t look the same.Anybody can help me out?
-
Here’s a quick example in C++ to convert these values to coordinates. You need the coordinates of the SW corner of the theater you are currently in. There are some tools to obtain this information (e.g. TerrainEditor). For default Korea, the values are in the code.
#include <math.h> #define FT_PER_DEGREE 365221.8846f #define RTD 57.2957795f //Radians to Degrees #define DTR 0.01745329f //Degrees to Radians #define EARTH_RADIUS_FEET 20925700f float StartCoord_Lat = 33.84375; //The Latitude of the SW corner of the theater in Degrees. Stored in MAP theater file float StartCoord_Long = 123; //The Longitude of the SW corner of the theater in Degrees. Stored in MAP theater file float ownship_North = 0; //Your input value in feet float ownship_East = 0; //Your input value in feet float cosLat = 0; //Temporary var float outCoordLat = 0; //Output Latitude float outCoordLong = 0; //Output Longitude //Latitude in Radians outCoordLat = ( StartCoord_Lat * FT_PER_DEGREE + ownship_North ) / EARTH_RADIUS_FEET //Cosine of Latitude cosLat = cos( outCoordLat ) //Longitude in Radians outCoordLong = ( ( StartCoord_Long * DTR * EARTH_RADIUS_FEET * cosLat ) + ownship_East ) / ( EARTH_RADIUS_FEET * cosLat ) //Converting to Degrees outCoordLat = outCoordLat * RTD outCoordLong = outCoordLong * RTD</math.h>
-
Thanks. I’ll give it a try