+2

Precision Position (4-Byte)

Greg R 2 years ago in IQANdesign 0

I commonly use position data in my functions and some behaviors require precision latitude/longitude (4-Byte, 10^-7 resolution). This is an issue due to the limitations of floating points in IQAN. I have come up with a solution to this problem. 

Most behaviors require 2 positions (vehicle position and desired waypoint). so you will have 2 sets of Lat and Long to deal with.

First you must keep the 4 bytes of each value split into 2 byte chunks until they are processed into relative position (a function in the below file). once the position is in relative space, the value is small enough to avoid any precision loss in the floating point form. you can change the inputs to make the origin either the vehicle or the waypoint.

The next issue is displaying real Lat/Long values (Not relative). The second function in the file is used to display 32 bit values that are split into 2 byte chunks. Without going into too much detail, it calculates each individual place separately and concatenated them in a text formatting function. 

I'm sure that i am not the only one who may need these functions. I hope this helps anyone that may need them.


32BitFunctions_Position.idex