Fix Set_Input_Pos feed-forward field widths - #57
Merged
samuelsadok merged 1 commit intoSep 29, 2026
Merged
samuelsadok merged 1 commit into
samuelsadok merged 1 commit into
Conversation
samuelsadok
approved these changes
Sep 29, 2026
samuelsadok
left a comment
Member
There was a problem hiding this comment.
Verified that the docs (int16) are correct, and thus this change is also correct, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Set_Input_Posdefines bothVel_FFandTorque_FFas signed 16-bit fields in the CAN protocol, but the position-control callback writes each asint8_t. This leaves the high byte zero: for example, a velocity feed-forward of -0.125 rev/s produces83 00(+131 counts) instead of83 FF(-125 counts).Use
int16_tfor both conversions and writes, matching the protocol and the existingSet_Input_Pos_msg_tencoder. The change is limited to these two lines.Validation: compiled the original and patched callback with the repository's
byte_swap.hppand a recording CAN transport under GCC 13.3, with undefined-behavior and float-cast-overflow sanitizers. A 255-input sweep produced 127 mismatches before the fix and none afterward. Fourteen additional patched cases varied the fields independently, including values beyond the 8-bit range; both fields decoded correctly and the position field remained unchanged. This was a callback-level test, without a full ROS launch or physical hardware.