kvaser leaf light v2 在Linux 下面的使用方法


 

一、安裝驅動

下載地址: https://www.kvaser.cn/developer-blog/build-install-signed-kvaser-driver-modules/ 

嚴格按照操作手冊說明進行:

位置:  linuxcan/README   以及  linuxcan/doc/faq

 

驗證是否成功:

    Make sure the modules are loaded. The following command should print
    kvcommon and at least one more module:

~/collectprogram/collectws$ lsmod | grep 'kvcommon\|mhydra\|leaf\|usbcanII\|kvpciefd\|kvpcican\|kvpcicanII\|kvvirutalcan'
leaf                   26990  1
kvcommon               58711  1 leaf
 驗證多少路CAN: 30881 是can id.

:~/collectprogram/collectws$ /usr/doc/canlib/examples/listChannels
CANlib version 5.23
Found 1 channel(s).
ch  0: Kvaser Leaf Light v2      73-30130-00685-0, s/n 30881, v3.3.0.769  (leaf v8.23.482)

注意:kvaser leaf light v2 只有一路CAN.

 

二、如何在ros當中編寫驅動程序

參考資料:https://github.com/astuff/kvaser_interface 

1、can_msgs 自己定義,然后生成.h文件引入到程序當中

Header header
int64  id
int16  dlc
bool is_extended
uint8[8]  data

 

2、通過程序當中的 ./install_minimal_linuxcan.sh 生成 .so文件

或者通過上面的linuxcan生成 .so文件。

但是呢,我們需要把下面的幾個文件同時拷貝進來:

libcanlib.so libcanlib.so.1 libcanlib.so.1.5.0

不然會報錯,未查找的引用。

 

3、利用自定義的can_msgs 更改程序當中所有的引用即可

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM