RealsenseD455 + ubuntu18.04 + ROS-Melodic的使用

系统:Ubuntu18.04
ros: melodic
相机:intel RealSense D455

 一、安装依赖和 Realsense SDK

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg

sudo apt-get update
sudo apt-get upgrade

 二、启动

realsense-viewer

注意: 连接相机至电脑USB3.0接口并打开摄像头显示界面  若是虚拟机如下图

RealsenseD455 + ubuntu18.04 + ROS-Melodic的使用_第1张图片

RealsenseD455 + ubuntu18.04 + ROS-Melodic的使用_第2张图片

 三、ROS系统下使用D455

cd ~/catkin_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 ..
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install

sudo apt-get install ros-melodic-rgbd-launch

 四、ROS下运行realsense d455 

roscore         #新开一个终端
roslaunch realsense2_camera rs_rgbd.launch  #另新开一个终端
rivz         #另新开一个终端

左上角Displays 中 Fixed Frame 选项中,下拉菜单选择 camera_link

点击该框中的Add -> 上方点击 By topic -> /depth_registered 下的 /points 下的/PointCloud2

点击该框中的Add -> 上方点击 By topic -> /color 下的 /image_raw 下的image

如果没有反应可重新插拔深度相机USB

五、ROS下用D455跑通ORB_SLAM2

进入D455_ws/src目录下
git clone https://github.com/appliedAI-Initiative/orb_slam_2_ros.git

gedit /D455_ws/src/orb_slam_2_ros/ros/launch/orb_slam2_d455_rgbd.launch

=================  /D455_ws + orb_slam2 =========================
1)roslaunch realsense2_camera rs_rgbd.launch

2)rosrun tf static_transform_publisher 0.011 0.048 0.015 0 0 0 base_link camera_link 100

3)roslaunch orb_slam2_ros orb_slam2_d455_rgbd.launch

4)rviz

5)rosrun rqt_tf_tree rqt_tf_tree

6)rostopic list

7)rostopic echo /orb_slam2_rgbd/pose

 RealsenseD455 + ubuntu18.04 + ROS-Melodic的使用_第3张图片

 

 六、realsense d455 + yolov5 实现目标检测 

1) cd D455_ws/src
2) git clone  https://github.com/killnice/yolov5-D435i.git
3) catkin_make
4) cd yolov5-D435i
5) pip install -r requirements.txt
6) pip install pyrealsense2
7) python main_debug.py

 运行成功的结果

 第一次运行时,官网https://github.com/ultralytics/ultralytics  
下载ultralytics包 然后在yolov5-D435i目录下,新建同名文件夹ultralytics
然后,进入到下载好的ultralytics包,里面有个ultralytics文件夹,把里面的东西拷贝到在yolov5-D435i目录下,新建同名文件夹ultralytics中,然后直接运行 python3 main_debug.py  程序回去自动下载官网已经训练好的模型 yolov5i6.pt

 注意:如果用pip install -r requirements.txt  报错,显示找不到相应版本的模块,改用

5) pip3 install -r requirements.txt
6) pip3 install pyrealsense2
7) python3 main_debug.py

参考文献:

ubuntu18.04 + realsence-sdk安装_ubuntu realsense_Yuannau_jk的博客-CSDN博客

你可能感兴趣的:(计算机视觉,SLAM建图导航,深度相机)