0 环境
- 鲁班猫4开发板(RK3588S)
- Ubuntu 20.04 (lubancat-rk3588-ubuntu20.04-gnome-20230829_update)
- D435i
- T265
- ROS noetic
- Realsense SDK v2.53.1
- Realsense ROS v2.3.2
1 安装ROS
建议使用fishros.com的ROS一键安装
wget http://fishros.com/install -O fishros && . fishros
安装ROS noetic
2 安装Realsense SDK
Realsense SDK 的Linux内核支持是跳跃的,Ubuntu 20 和 Ubuntu 22通常使用的 5.10内核无法通过官方给定的apt或源码编译方法安装。
参考https://github.com/IntelRealSense/librealsense/blob/master/doc/libuvc_installation.md
如果无法修补内核,或者官方安装过程中的任何步骤.md失败,您应该尝试libuvc-backend版本的 librealsense 此方法未经官方验证,但可以在更广泛的平台上运行,包括较旧/较新的内核版本
该脚本需要互联网连接。请确保网络代理设置正确
确保没有连接 RealSense 设备
打开终端,运行:$ wget https://github.com/IntelRealSense/librealsense/blob/v2.53.1/scripts/libuvc_installation.sh $ chmod +x ./libuvc_installation.sh $ ./libuvc_installation.sh
等待
Librealsense script completed
消息显示(可能需要一些时间)
连接实感设备
rs-enumerate-devices
从终端运行以验证安装
目前,该脚本假定 Ubuntu 16 带有图形子系统如果您遇到任何问题或希望将脚本扩展到其他系统,请通过新的 GitHub 问题告知我们
为了安装2.53.1,我修改了这个文件
#!/bin/bash -xe
#Locally suppress stderr to avoid raising not relevant messages
exec 3>&2
exec 2> /dev/null
con_dev=$(ls /dev/video* | wc -l)
exec 2>&3
if [ $con_dev -ne 0 ];
then
echo -e "\e[32m"
read -p "Remove all RealSense cameras attached. Hit any key when ready"
echo -e "\e[0m"
fi
lsb_release -a
echo "Kernel version $(uname -r)"
sudo apt-get update
cd ~/
sudo rm -rf ./librealsense_build
mkdir librealsense_build && cd librealsense_build
if [ $(sudo swapon --show | wc -l) -eq 0 ];
then
echo "No swapon - setting up 1Gb swap file"
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
fi
echo Installing Librealsense-required dev packages
sudo apt-get install git cmake libssl-dev freeglut3-dev libusb-1.0-0-dev pkg-config libgtk-3-dev unzip -y
rm -f ./master.zip
wget https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.53.1.zip
unzip v2.53.1.zip -d .
cd librealsense-2.53.1
echo Install udev-rules
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo cp config/99-realsense-d4xx-mipi-dfu.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
mkdir build && cd build
cmake ../ -DFORCE_LIBUVC=true -DCMAKE_BUILD_TYPE=release
make -j2
sudo make install
echo -e "\e[92m\n\e[1mLibrealsense script completed.\n\e[0m"
3 安装Realsense ROS
使用源码编译安装,注意Realsense ROS与Realsense SDK版本要对应。在这里可以查到版本对应。https://github.com/IntelRealSense/realsense-ros/releases
#安装依赖
sudo apt install ros-noetic-ddynamic-reconfigure
#下载源码
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone -b 2.3.2 https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ..
#编译
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
#source工作空间
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
#验证,使用rqt查看
roslaunch realsense2_camera rs_camera.launch