建立工作空间

1
2
mkdir -p ~/realsense_ws/src
cd ~/realsense_ws/src/

下载需要的包

1
2
git clone https://github.com/IntelRealSense/realsense-ros.git
git clone https://github.com/pal-robotics/ddynamic_reconfigure

更改文件

1
sudo gedit /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake

​ 在/opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113大概是94和96行附近,/use/include/opencv改成/use/include/opencv4即可,否则后续编译报错

编译

1
2
3
catkin_init_workspace 
cd ~/catkin_ws
catkin_make

配置环境变量

1
2
echo "source ~/catkin_ws/devel/setup.bash">>~/.bashrc 
source ~/.bashrc

运行

运行后你可以看到t265输出的位姿信息

1
roslaunch realsense2_camera demo_t265.launch

在编译过程中你可能会遇到各种各样的问题,可以在下方留言或者自行百度解决。