Ubuntu 编译安装 Libbarrett
目录
1 系统及软件版本
This version of Libbarrett works with a non-real-time kernel (a low-latency Ubuntu 20.04 kernel) and should only be used when a hard real-time guarantee is not critical for your application.
2 编译安装 libbarrett
2.1 克隆仓库
cd && git clone https://git.barrett.com/software/libbarrett
2.2 安装依赖
cd ~/libbarrett/scripts && ~/libbarrett/scripts/install_dependencies.sh
这个过程中脚本会自动下载安装 lowlatency 内核等依赖,需要保证良好网络链接
脚本结束后重启进入系统,查看内核版本:
uname -r
输出内容应该以 lowlatency
结尾
2.3 安装 PCAN 驱动
sh ~/libbarrett/scripts/install_pcan.sh
PCAN-USB 不需要执行下面内容
For PCAN-ISA only, manually configure the driver (not plug-and-play):
sudo tee /etc/modprobe.d/pcan.conf <<EOF options pcan type=isa,isa io=0x300,0x320 irq=7,5 install pcan modprobe --ignore-install pcan EOF echo 'pcan' |sudo tee -a /etc/modules-load.d/modules.conf
脚本执行完毕重启进入系统,检查 PCAN 驱动情况
执行 cat /proc/pcan
应当有类似以下有关 “can0” 的输出:
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20210119_n (8.11.0) Mar 7 2024 20:57:07 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 1 interfaces @ major 238 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb can0 ffffffff 000 0x001c 00000000 00000000 00000000 00000000 0x0000
2.4 编译安装 libbarrett 驱动
编译
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cd ~/libbarrett && cmake .
make -j$(nproc)
安装
sudo make install
2.5 (可选)编译例程
cd ~/libbarrett/examples && cmake .
make -j$(nproc)