I am working on a patch to get data from a Polhemus Fastrak motion tracker.

It returns serial records of the form:

"01 9.44 -0.75 -0.62 -40.90 15.74 29.96"

in which the orientation angles are the last three values. The azimuth value, for example, is always in characters 25 through 31, so I am extracting it like this:

[ list of char bytes(
|
[packel 25 26 27 28 29 30 31]
| | | | | |
[sprintf %c%c%c%c%c%c%c]
|
[value \

which puts the correct value, -40.90, in the number at the bottom.

This works fine, but is there a better way?

http://www.pdpatchrepo.info/hurleur/serial_fastrak.pd