ros2与传感器-整合OAK-D相机和ros包
ros2与传感器-整合OAK-D相机
说明:
- 介绍如何在ros2下使用OAK-D相机
- 具体产品,点击淘宝地址
相关设备:
- OAK-D系列双目相机:采购地址
OAK-D介绍
OAK是一个模块化的开放源码生态系统,由麻省理工学院许可的硬件、软件和人工智能训练组成,它允许你将空间人工智能的强大功能和加速的计算机视觉功能嵌入到你的产品中。
OAK提供了一个单一的、内聚的解决方案,否则就需要将不同的硬件和软件组件拼凑在一起。
OpenCV AI Kit-D(OAK-D)是一款具有神经推理和深度处理能力的智能相机。
OAK-D是其前身OpenCV AI Kit(OAK)的一个实际变体,能够实现Spatial AI(空间AI)。空间AI 的能力是在现实世界中应用人工智能,不仅可以识别物体,还可以实时了解物体在三维空间中的位置。
OAK-D可以通过其集成的12MP RGB摄像头运行目标检测,并将其与集成的立体声深度引擎相结合。
步骤:
- 通常国内网络对gihub.com地址不友好,都增加了代理地址方便下载。
- 编译驱动depthai-core
set -e
sudo wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/luxonis/depthai-docs-website/master/source/_static/install_dependencies.sh | bash
cd /tmp
git clone --recursive https://ghproxy.com/https://github.com/luxonis/depthai-core.git --branch main
cmake -Hdepthai-core -Bdepthai-core/build -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local
sudo cmake --build depthai-core/build --target install
cd /tmp
rm -r depthai-core
- 编辑ros包和例子depthai-ros和depthai-ros-examples
mkdir -p ~/ros2_test_ws/src/luxonis
cd ~/ros2_test_ws/src/luxonis
git clone -b main https://ghproxy.com/https://github.com/luxonis/depthai-ros.git
git clone -b main https://ghproxy.com/https://github.com/luxonis/depthai-ros-examples.git
rosdep install --from-paths src --ignore-src -r -y
colcon build
- 加载工作空间
source install/setup.bash
- 启动相机,发布单目话题
ros2 launch depthai_examples mobile_publisher.launch.py
- 查看话题
$ ros2 topic list
/color/camera_info
/color/image
/color/image/compressed
/color/image/compressedDepth
/color/image/theora
/color/mobilenet_detections
/joint_states
/parameter_events
/robot_description
/rosout
/tf
/tf_static
- 利用rqt_image_view订阅话题信息/color/image
ros2 run rqt_image_view rqt_image_view
- 效果图:
- 启动相机,发布双目话题
ros2 launch depthai_examples rgb_stereo_node.launch.py
- 查看话题信息
$ ros2 topic list
/color/image
/color/video/camera_info
/color/video/image
/color/video/image/compressed
/color/video/image/compressedDepth
/color/video/image/theora
/joint_states
/parameter_events
/robot_description
/rosout
/stereo/camera_info
/stereo/depth
/stereo/depth/compressed
/stereo/depth/compressedDepth
/stereo/depth/theora
/tf
/tf_static
- 启动相机,发布双目话题,点云话题
ros2 launch depthai_examples stereo.launch.py
ros2 launch depthai_examples stereo_inertial_node.launch.py
- 弹出的rviz上能正常看到点云信息和图像
- 查看话题:
$ ros2 topic list
/clicked_point
/image/compressed
/image/compressedDepth
/image/theora
/initialpose
/joint_states
/left/camera_info
/left/image_rect
/left/image_rect/compressed
/left/image_rect/compressedDepth
/left/image_rect/theora
/move_base_simple/goal
/parameter_events
/right/camera_info
/right/image_rect
/right/image_rect/compressed
/right/image_rect/compressedDepth
/right/image_rect/theora
/robot_description
/rosout
/stereo/camera_info
/stereo/converted_depth
/stereo/depth
/stereo/depth/compressed
/stereo/depth/compressedDepth
/stereo/depth/theora
/stereo/points
/tf
/tf_static
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号