步骤如下:
(1)注册服务器的公钥:
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
(2)将服务器添加到软件源列表中:
Ubuntu 16:
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo xenial main" -u
Ubuntu 18:
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u
(3)安装SDK:
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
(4)重新连接RealSense设备并从终端运行:realsense-viewer
验证安装
步骤如下:
(1)下载源码包
git clone https://github.com/IntelRealSense/librealsense.git
*若想下载指定版本的librealsense,可从Releases页面下载。
(2)构建和修补Jetson L4T的内核模块
cd librealsense2
./scripts/patch-realsense-ubuntu-L4T.sh
(3)编译librealsense2 SDK
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev -y
./scripts/setup_udev_rules.sh
mkdir build && cd build
cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=release -DFORCE_RSUSB_BACKEND=false -DBUILD_WITH_CUDA=true && make -j$(($(nproc)-1)) && sudo make install
(4)连接Realsense设备,运行realsense-viewer
并检查结果
这一步要注意与librealsense的版本匹配问题。详见realsense-ros发行说明
推荐采用源码包方式安装,方便修改launch等文件。
步骤如下:
(1)先创建工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
catkin_init_workspace
(2)下载realsense-ros到src里
若最新版本realsense-ros与librealsense版本不匹配,自行到releases里下载。
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1` #检查所下载的版本是否是想要的
cd ..
(3)编译
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
(4)插上相机测试一下
roslaunch realsense2_camera rs_camera.launch
参考SLAM-with-D435i。
sudo apt-get install ros-kinetic-imu-filter-madgwick
sudo apt-get install ros-kinetic-rtabmap-ros
sudo apt-get install ros-kinetic-robot-localization
roslaunch realsense2_camera opensource_tracking.launch
注意到上图中ColorOccupacyGrid插件报错,原因是缺少安装Octomap在ROS中的包。
sudo apt-get install ros-kinetic-octomap*
roslaunch realsense2_camera opensource_tracking.launch