Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiplier value for GPS_STATUS.satellite_azimuth where 255 means 360deg #885

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shancock884
Copy link
Contributor

Relates to mavlink/mavlink#2062, point 2.

2/ Satellite Azimuth unit doesn't consider scale factor
The satellite_azimuth field of the GPS_STATUS message has a unit of "deg", but the description says "0: 0 deg, 255: 360 deg".
To be consistent with other units, and allow automatic value decoding, I would propose that a specific unit is used here too.
e.g. "degS8" (meaning "Degree Scaled to 8 bit integer"), or "deg/360*255" or any sensible simplification thereof.
I would also question if 255 is really supposed to be 360deg - as this means a value of 0 and 255 represents the same angle.
Perhaps what was intended is that 255 represents 360-(360/256) = 358.59375 ?

This PR adds the "degS8" unit, and an associated comment to the mavschema.xsd file.

The description specifies that 255 represents 360 deg, therefore multiplier is 360/255
@shancock884 shancock884 changed the title Add degS8 unit for degrees scaled to fit in 8-bit integer Add multiplier value for GPS_STATUS.satellite_azimuth where 255 means 360deg May 1, 2024
@shancock884
Copy link
Contributor Author

Following merging of #894, this now proposes to add a multiplier value of 360/255 to be used by satellite_azimuth, rather than create a new not-a-real-unit.
I specified this literally as "360/255" rather than a value to be more accurate and readable, but happy to change if it doesn't seem right.
@peterbarker, @hamishwillee

@@ -178,6 +178,7 @@
<xs:simpleType name="factor">
<xs:restriction base="xs:string">
<xs:enumeration value="1E-2"/> <!-- actual value = stated value / 100 -->
<xs:enumeration value="360/255"/> <!-- actual value = stated value * 360/255, as used for GPS_STATUS.satellite_azimuth -->
Copy link
Contributor

Choose a reason for hiding this comment

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

@peterbarker How about

Suggested change
<xs:enumeration value="360/255"/> <!-- actual value = stated value * 360/255, as used for GPS_STATUS.satellite_azimuth -->
<xs:enumeration value="360div255"/> <!-- actual value = stated value * 360/255, as used for GPS_STATUS.satellite_azimuth -->

Copy link
Contributor

Choose a reason for hiding this comment

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

Or to put it another way, I have no strong opinions, but good to put this in.

degScaledToByte? degScaled255

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally, I'd prefer "360/255" because, it is both:

  • directly evaluatable in pretty much any programming language for when the actual value is required for maths.
  • humanly understandable as text if printed as-is (e.g. web page, Wireshark dissector, code comments, etc).

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's see what @peterbarker says - I dislike the slash sorry!

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the slash. It means we can continue to just eval these things.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

Marked this for DevCall to make sure tridge is good with this.

@@ -178,6 +178,7 @@
<xs:simpleType name="factor">
<xs:restriction base="xs:string">
<xs:enumeration value="1E-2"/> <!-- actual value = stated value / 100 -->
<xs:enumeration value="360/255"/> <!-- actual value = stated value * 360/255, as used for GPS_STATUS.satellite_azimuth -->
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the slash. It means we can continue to just eval these things.

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

Successfully merging this pull request may close these issues.

None yet

3 participants