semuconsulting / pyubx2

Python library for parsing and generating UBX GPS/GNSS protocol messages.
BSD 3-Clause "New" or "Revised" License
173 stars 67 forks source link

Amend scale rounding Fixes #55 #57

Closed semuadmin closed 2 years ago

semuadmin commented 2 years ago

pyubx2 Pull Request Template

Description

Currently scaled attributes are rounded to 8 dp after multiplication by the applicable scaling factor. This causes some loss of useful precision in the additive high precision elements of the NAV-HPPOSLLH and NAV-HPPOSECEF messages (e.g. lonHp). This change increases the precision to 12 dp.

Fixes # (issue)

55

Testing

Please test all changes, however trivial, against the supplied unittest suite tests/test_*.py e.g. by executing the tests/testsuite.py module or using your IDE's native Python unittest integration facilities. Please describe any test cases you have amended or added to this suite to maintain >= 99% code coverage.

Checklist:

semuadmin commented 2 years ago

Might it not be more user-friendly to render the separate standard and high precision elements as a single attribute and then scale and round e.g. render lat and latHp as:

lat = round((lat + (latHp * 1e-2)) * 1e-7, 12)

and same for lon, height, hMSL and ecefX/Y/Z?

Agreed and done. The coordinate and height attributes returned by NAV-HPPOSLLH and NAV-HPPOSECEF now represent the high precision value in the units specified in the interface spec (i.e. height is in mm for HPPOSLLH, cm for HPPOSECEF). Release Notes updated