1.下载安装realsense SDK
1.1 安装依赖
sudo apt install libudev-dev pkg-config libgtk-3-dev
sudo apt install libusb-1.0-0-dev pkg-config
sudo apt install libglfw3-dev
sudo apt install libssl-dev
1.2 权限
cd librealsense/
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger
1.3 编译
bash
mkdir build
cd build
cmake ..
make -j4
sudo make install
1.4 验证是否成功
bash
cd librealsense/
realsense-viewer
显示如下界面则表示安装成功。
使用docker安装的时候需要在运行docker容器的时候将对应的video加进去(docker run -it的时候加上--device=/dev/videoX:/dev/videoX,X是数字,例如--device=/dev/video4:/dev/video4),不然可能找不到相机。
2.安装RealSense-ROS
1.下载安装
bash
mkdir -p realsense_ws/src
cd realsense_ws/src
git clone https://github.com/IntelRealSense/realsense-ros.git
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git
cd ..
catkin_make
ERROR: CMake Error at /opt/ros/noetic/share/catkin/cmake/catkin_workspace.cmake:100 (message):
This workspace contains non-catkin packages in it, and catkin cannot build
a non-homogeneous workspace without isolation. Try the
'catkin_make_isolated' command instead.
这个错误表示realsense2_camera_msgs、realsense2_description、realsense2_camera不能被catkin_make编译,找了半天原因才发现是因为git clone下的realsense-ros是ros2支持的,要切换成ros分支才行,可使用git branch查看在哪个分支。
bash
mkdir -p realsense_ws/src
cd realsense_ws/src
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 ..
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git
cd ..
catkin_make
catkin_make install
2.测试是否安装成功
bash
cd realsense_ws/
source devel/setup.bash
roslaunch realsense2_camera rs_camera.launch
或者新开终端使用rostopic list查看是否有相机信息,需要可视化的话可以用rviz查看。