schwehr / generic-sensor-format

Sonar Generic Sensor Format (gsf) codec
Other
13 stars 8 forks source link

gsfAttitude decode appears to have a bug with negative heading values #34

Closed schwehr closed 9 years ago

schwehr commented 9 years ago

-2.3 heading became 653.06. The code for heading decode is slightly different than the over parameters.

schwehr commented 9 years ago

Heading is supposedly an unsigned value. From the 3.06 format specification:

range of 0.00 to 360.00 using a 2‐byte unsigned integer.

It's really hard to notice the difference between gsfsShort & gsfuShort on encoding and casting with (signed) or not on the decoding. It would be much better to have functions that make the signed conversion much more obvious.

schwehr commented 9 years ago
Text fields are left justified and are signified in this specification by a "T".

And

An “I” shall identify signed binary integers in this specification; a “U” shall identify unsigned integers.

I think this table was supposed to have be "U" rather than "T" for course, but heave is signed in "Table 4‐3 Swath Bathymetry Ping Record Definition"

Attitude definition table:

Field Name Description Field Type Count
ATTITUDE_TIME Array of attitude measurement times, offset from the base time I N*2
PITCH Array of pitch measurements I N*2
ROLL Array of roll measurements I N*2
HEAVE Array of heave measurements T N*2
HEADING Array of heading measurements T N*2

screen shot 2015-06-26 at 12 11 22 am