-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix(socket_can_receiver): support variable-length CAN FD frames #50
Conversation
Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the above suggestion
Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>
@mojomex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing because CPPlint enforces <= 100 character lines with at least 2 spaces between code and comments.
Co-authored-by: Max Schmeller <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@xmfcx it seems like I don't have write access in this repo, so I don't count towards the required reviews. Could you review/merge it? |
This PR makes significant changes in how the can frames are parsed. Was this tested on real hardware? |
@xmfcx As explained in the code, the problem is that the original implementation seemed to only accept fd frames of the max size (64 bytes). |
Co-authored-by: M. Fatih Cırıt <[email protected]>
Signed-off-by: M. Fatih Cırıt <[email protected]>
From @knzo25 's branch in https://github.com/knzo25/ros2_socketcan/commits/feat/continental_fd/
Related PR:
Summary
This PR fixes an issue in the
SocketCanReceiver
class where it incorrectly assumed that all CAN FD frames would be the maximum size (64 bytes). This assumption caused errors when handling shorter frames, as observed with SRR520 frames.The fix ensures that the
receive_fd
method can properly handle variable-length CAN FD frames by dynamically calculating the expected frame size based on the actual data length (frame.len
). It also introduces additional safety checks to prevent corrupted or incomplete frames from being processed.Changes
receive_fd
to handle CAN FD frames shorter than 64 bytes.expected_length
based on the fixed header size and the variable data length.Additional Improvements
frame.len
) does not exceed the CAN FD maximum allowed data length (64 bytes).