I just started working on an Augmented-Reality project. For this project I have a PTZ-Camera and I can send inquiries for Pan, Tilt, Zoom and so on. The problem I have is that the answer comes packaged in 4 bytes (I am just looking at the Tilt Values right now) and I cannot find a way to reconstruct the actual data.
The Data comes in the following format in an TcpIp-Dat:
90 50 0w 0w 0w 0w 0z 0z 0z 0z FF
(from the documentation found here, search for “CAM_PanTiltPosInq“:
In this package, the wwww represents the Pan-Value and the zzzz the Tilt-Value. In Wireshark it looks like this:
90 50 0f 0e 04 0e 00 05 01 00 ff
In the TcpIp-Dat with bytes enabled it looks like this:
80 15 14 04 14 00 05 01 00 255
I have found that if I take the zzzz (Tilt-Values) from Wireshark in this example and run them through a Hexadecimal to Decimal converter, it gives me a number I can work with. In this example “0510” gives me “1296”. How I decipher this number to some kind of degrees is another question for another day, but I think it divides 360° of theoretical movement in 256²=65536 Steps and that’s logic I think I can handle.
I know that if I take the Tilt-Values (the bytes) in TouchDesigner “00 05 01 00” and converted them to normal integers I could use math (first number times 16³, second number times 16² and so on) to get that same number. But I have not found a way to convert the bytes to integers.
My question is, how I can get this conversion from bytes to integers done in Python or other Dats. Any help would be much appreciated! I will append my file, so that you could look at what I have done so far!
PTZ_Converter1 Forum.2.toe (4.4 KB)