Skip to content

Decode inland AIS draught in centimetres - #268

Open
Solarboaters wants to merge 1 commit into
schwehr:mainfrom
Solarboaters:fix/inland-draught-units
Open

Solarboaters wants to merge 1 commit into
schwehr:mainfrom
Solarboaters:fix/inland-draught-units

Conversation

@Solarboaters

@Solarboaters Solarboaters commented Nov 25, 2026 •

Copy link
Copy Markdown

Fixes #193. Thanks to @cookiemon for identifying the unit mismatch.

Inland AIS 8:200:10 encodes draught in centimetres. Dividing by ten makes a 1.23 m draught appear as 12.3 m. Divide by 100, leaving the decimetre scaling of length and beam unchanged. The field definition is in the Inland AIS specification.

Regression tests alter only the draught bits in an existing message fixture and exercise both the C++ decoder and Python binding at 0, 1, 123 and 2000 cm. The nonzero cases fail against the original implementation; all pass with the fix. All 94 Python tests and 30 CTest executables pass, with AddressSanitizer enabled for the C++ tests. Tested on Linux/Python 3.12; no live AIS receiver or vessel was tested.

Prepared with AI assistance.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change correcting inland AIS draught decoding from centimetres to metres.

No open issues 🎉

What changed in this PR

Corrects inland AIS 8:200:10 draught decoding from centimetres to metres, addressing #193 while preserving length and beam scaling.

Changes:

  • Divides the encoded draught by 100 instead of 10.
  • Adds C++ and Python regression coverage for 0, 1, 123, and 2000 cm, with checks that other decoded fields remain unchanged.
File Description
test/​inland_draught_test.py Tests draught conversion through the Python binding using modified fixture bits.
src/​test/​ais8_200_test.cpp Adds C++ regression cases for centimetre-based draught values.
src/​libais/​ais8_200.cpp Corrects the draught conversion factor to produce metres.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ais8_200_10 draught is off by a factor of 10

2 participants