-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add CAN FD Support #28
Add CAN FD Support #28
Conversation
Thanks for working on this useful feature! I have tested the current state of the draft with some CAN FD radar sensors. The following modifications were necessary to actually receive CAN FD Messages:
and it should be resized afterwards to take advantage of the bounded data array:
|
@FranzAlbers Thank you so much for testing this and working out some of the bugs! I have implemented your suggestions in this branch. Unfortunately, your testing uncovered something that I expected but hoped was not the case: once a socket has been opened with FD options enabled, it is not possible to send/receive to/from that socket with standard frames and vice-versa. This makes standard and FD mutually-exclusive, which is annoying. I did my best to minimize the API changes but there is one change to avoid awkward syntax that subtly breaks the existing non-ROS API. When creating a Sender, if I were to completely avoid API changes, calling the constructor would look like this for standard:
While doing the same with an FD Sender would look like this:
However, I figured that it is very unlikely that anyone is using the non-ROS library in this package and also using the "default CAN ID" functionality in Sender so I instead implemented the FD version as:
This breaks the API for those using the non-ROS library in a very specific way but, as I said, I doubt this is a large number of users, if any. Please test this branch again and report back, if you can and provide feedback. |
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
This still needs testing but I believe it is good to go otherwise. |
I've mentioned an issue in code review, which you might have overseen @JWhitleyWork: The |
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Sorry I missed this before. Please check again - should be resolved now. |
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.
Receiving CAN FD frames works now as expected. I've successfully received some CAN FD Frames from our radar sensors. the decoded data looks reasonable as well.
Sending CAN FD frames back to the bus also works, though I've only tested it from the command line.
Receiving and sending also still work for usual can_msgs/Frames.
Not sure if I am allowed to approve this, but I think this can be merged.
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Needs review by @wep21 or @kenji-miyake. |
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
@JWhitleyWork Thank you for working on this, and also thank you @FranzAlbers @xbroquer for reviews. 🙏 Please let me confirm one thing just in case. In that case, if it's okay for you and someone familiar with CAN FD, then it's okay for TIER IV and probably for AWF. @mitsudome-r @xmfcx Please comment if you have any thoughts. |
I have tested the feature with virtual can.
It worked fine, but a console always printed the following warning.
Is this a correct behavior? |
That's correct behavior in this case because the gap time of Warnings will be gone if you set the
Or with:
|
@FranzAlbers Thank you for your comment. It worked well with your suggestion. |
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.
Probably it looks to be okay. Waiting for comment on #28 (comment) from @JWhitleyWork.
That is correct. I specifically designed this to not affect existing "traditional" CAN users. In order to enable CANFD, you must add a new parameter and set it to True (it is False by default). I think this is ready to go. |
Signed-off-by: Joshua Whitley <josh@electrifiedautonomy.com>
Thank you. Let's merge it! |
This adds the
enable_can_fd
flag to both the sender and receiver. When enabled, this publishes or subscribes to a new topic suffixed with_fd
for CAN FD messages and sends/receives them to/from the attached SocketCAN device. Closes #21.