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

Is it possible to use non-standard bit rates? #90

Open
Ajmoomaw opened this issue Feb 28, 2023 · 3 comments
Open

Is it possible to use non-standard bit rates? #90

Ajmoomaw opened this issue Feb 28, 2023 · 3 comments
Labels

Comments

@Ajmoomaw
Copy link

I am working with a CAN bus that is transmitting at 33300 kbps and when launching the node I get an error for a bad input parameter. I was wondering if it is possible to setup the current code to operate at that transmission rate or if there is a recommended way to edit the code base to implement this bit rate. Any and all assistance if greatly appreciated.

@icolwell-as
Copy link
Member

icolwell-as commented Mar 1, 2023

Did you try changing the can_bit_rate argument in the launch file?
https://github.com/astuff/kvaser_interface/blob/ros1_master/launch/kvaser_can_bridge.launch

@Ajmoomaw
Copy link
Author

Ajmoomaw commented Mar 1, 2023

I have. I believe the issue I am having is due to the code seemingly not supporting bit rates outside of the ones listed below in the screen shot taken from the "kvaser_interface.cpp" file. I have also included a link to the code section I show. I am uncertain if this is truly the issue, however this seems to be where the "bad param" error is originating from.

image

https://github.com/astuff/kvaser_interface/blob/4993cd44efb729a0c4793961847c508e671bae21/src/kvaser_interface.cpp#L81:~:text=switch%20(bitrate),%7D

@icolwell-as
Copy link
Member

Interesting, I didn't know there were preset options like that. I'm not actually familiar with this codebase 😄
Those bitrate constants are defined here in the kvaser canlib source code:
https://github.com/astuff/kvaser-linuxcan/blob/master/include/canlib.h#L393-L428
So maybe it's a limitation of canlib. Regardless, you'd probably want to look through Kvaser's canlib docs to see if/how you can use bitrates other that those defined.

For a quick test, maybe try hardcoding the input parameter freq on this line:
https://github.com/astuff/kvaser_interface/blob/ros1_master/src/kvaser_interface.cpp#L101
to whatever it is you want, 333000?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants