Skip to content

Fix Set_Input_Pos feed-forward field widths - #57

Merged
samuelsadok merged 1 commit into
odriverobotics:mainfrom
LaPhilosophie:fix/set-input-pos-feedforward-width
Sep 29, 2026
Merged

samuelsadok merged 1 commit into
odriverobotics:mainfrom
LaPhilosophie:fix/set-input-pos-feedforward-width

Conversation

@LaPhilosophie

Copy link
Copy Markdown
Contributor

Set_Input_Pos defines both Vel_FF and Torque_FF as signed 16-bit fields in the CAN protocol, but the position-control callback writes each as int8_t. This leaves the high byte zero: for example, a velocity feed-forward of -0.125 rev/s produces 83 00 (+131 counts) instead of 83 FF (-125 counts).

Use int16_t for both conversions and writes, matching the protocol and the existing Set_Input_Pos_msg_t encoder. The change is limited to these two lines.

Validation: compiled the original and patched callback with the repository's byte_swap.hpp and 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.

Copilot AI balanced review requested due to automatic review settings September 29, 2026 04:45

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CLAassistant

CLAassistant commented Sep 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@samuelsadok samuelsadok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified that the docs (int16) are correct, and thus this change is also correct, thanks!

@samuelsadok
samuelsadok merged commit 182e040 into odriverobotics:main Sep 29, 2026
5 checks passed
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.

4 participants