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

Msgs with dlc < 8 would fail. Fixed. #38

Merged
merged 1 commit into from
Apr 30, 2019
Merged

Conversation

JWhitleyWork
Copy link

@JWhitleyWork JWhitleyWork commented Apr 29, 2019

The data member of the can_msgs/Frame message is currently a fixed-length array of 8 bytes. However, the AS::CAN::CanMsg uses a std::vector<uint8_t> for it's payload storage so we only allocate the bytes we need. The write() function in kvaser_can_bridge was passing the DLC correctly but it would always write all 8 bytes to the vector. Since kvaser_interface now checks the DLC against the vector size, it would fail if the DLC wasn't 8. This PR fixes this issue and also passes the DLC up directly when reading (since can_msgs/Frame doesn't support CAN FD and CAN_FD messages are ignored for ROS publishing right now anyway) instead of using the vector size as the DLC.

@srustanAStuff srustanAStuff merged commit 95e27db into master Apr 30, 2019
@srustanAStuff srustanAStuff deleted the fix/dlc_mismatch branch April 30, 2019 13:55
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.

3 participants