Skip to content

Fix Pinpoint float endianness in SRSHub#59

Open
raahilparikh wants to merge 1 commit into
v3-pre-worldsfrom
codex/investigate-pinpoint-position-and-velocity-issues
Open

Fix Pinpoint float endianness in SRSHub#59
raahilparikh wants to merge 1 commit into
v3-pre-worldsfrom
codex/investigate-pinpoint-position-and-velocity-issues

Conversation

@raahilparikh

Copy link
Copy Markdown

Motivation

  • The Pinpoint device data is decoded in parseUpdate() using little-endian byte order, but outgoing float payloads were serialized with Java's default (big-endian) order, producing wildly incorrect position/velocity values.
  • This endianness mismatch can produce errors of many orders of magnitude when the device interprets configuration or setPosition writes.

Description

  • Set the ByteBuffer byte order to BYTE_ORDER for the SetPositionCommand payload so xPosition, yPosition, and hOrientation are serialized little-endian (ByteBuffer.allocate(12).order(BYTE_ORDER)).
  • Set the ByteBuffer byte order to BYTE_ORDER for the GoBildaPinpoint constructor config payload so xPodOffset, yPodOffset, and encoderResolution are serialized little-endian (ByteBuffer.allocate(13).order(BYTE_ORDER)).

Testing

  • Ran an environment compile attempt with ./gradlew :TeamCode:compileDebugJavaWithJavac -q which could not complete due to local JDK/Gradle incompatibility: Unsupported class file major version 69 (build failed).
  • No unit tests were executed in this environment; the change is small and self-contained (serialization order only) and should be validated on-device or in a CI environment with compatible Java/Gradle versions by compiling and exercising SetPositionCommand and GoBildaPinpoint interactions with the Pinpoint device.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant