Convert compass heading and other AWAC data
Hi
First i want to start saying thanks for the system integrator manual, has been very usefull
But i have a question. I'm a student of TI and i'm writing a program to work with the data from the .wpr file generated by an AWAC.
I've already detected the sync's and id's of the data structures in the file.
My question is how to convert the compass heading, pitch and some other values because for example, in my data, the 2bytes value of compass in HEX is FD0C but in the .sen file, that value converted is 332.x, and i think that there are some other values that work the same way
So i wanna know if you can help me with this or guide me on how to do it
Thanks in advance
Elmer
Hi Elmer,
Glad to hear that you find the system integrator manual useful.
The data are following little endian format. This means that to convert HEX to ASCII you need to put the lowest significant byte before the most significant byte and the convert. In your example: FD0C->0CFD->3325 (*0.1deg).
If you wonder why, http://en.wikipedia.org/wiki/Endianness might help you out.
Best regards
Jonas Røstad
Thanks for the answer Jonas
I was thinking that maybe the little or big endian format was the answer, but your reply confirm it, thanks again.
I have another doubt, the pitch and roll data has negative values.
For example, F1FF>FFF1>65521*(0.1) is that right? But in the files converted by the AWAC software that value is -1.5
I'm thinking some posibilities but im not sure. Maybe like this? (65521-65536)*0.1, and that way i have that same negative value, but im not sure
I hope you can guide me again
Thanks
Elmer
Dear Elmer,
Welcome to the world of computers... For this value two's complement is used.
The trivial way to look at this is.
- Convert to binary (remember little endian)
- If the first bit is 0 convert to decimal
- If the first bit is 1. Invert all the numbers (0>1 and 1>0), add one and convert to decimal and change the sign to minus.
In your example
F1FF>FFF1>1111111111110001>0000000000001110+1>0000000000001111>-15 (*0.1 degrees)
Not dizzy yet, please check http://en.wikipedia.org/wiki/Two's_complement
Best regards
Jonas

