硬件配置:HP ProDesk 480 G6 MT
系统内存:8G
处理器:Intel i7-8700 CPU
操作系统:Ubuntu 18.04
相机配置:Intel Realsense D435i
创建的ROS工作空间:catkin_ws
一、安装Intel Realsense SDK
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、将服务器添加到存储库列表中
sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u
3、安装库
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
4、安装可选的开发人员和调试包
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
二、安装ROS Wrapper for Intel RealSense
1、安装相机相关驱动
sudo apt-get install ros-melodic-realsense2-camera
2、进入ros工作空间
cd ~/catkin_ws/src/
3、克隆最新的英特尔RealSense ROS
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
cd ..
4、确保安装了所有相关的ros包
sudo apt install ros-melodic-cv-bridge ros-melodic-image-transport ros-melodic-tf ros-melodic-diagnostic-updater ros-melodic-ddynamic-reconfigure
4、回到工作空间根目录,编译工作空间,修改环境变量
cd ..
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo source $(pwd)/devel/setup.bash >> ~/.bashrc
source ~/.bashrc
5、通过usb连接相机到电脑,检验是否能在ros使用realsense相机
sudo apt install ros-melodic-rgbd-launch
roslaunch realsense2_camera rs_rgbd.launch
rostopic list
7、通过ROS的rqt_image_view或rviz工具查看相机运行状态
rqt_image_view
rviz
修改左上角 Displays 中 Fixed Frame 选项中,下拉菜单选择 camera_link,点击该框中的Add -> 上方点击 By topic选择要添加的功能