环境:
ubuntu 20.04
ros2 foxy
安装使用参考奥比中光官网文档:
https://developer.orbbec.com.cn/technical_library.html?id=60
一 ROS一键安装
用小鱼的一键安装,是我目前用到的最简单的安装ros的方法
wget http://fishros.com/install -O fishros && . fishros
二 安装依赖
sudo apt install libgflags-dev nlohmann-json3-dev \
ros-foxy-image-transport ros-foxy-image-publisher
安装 glog
wget -c https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz -O glog-0.6.0.tar.gz
tar -xzvf glog-0.6.0.tar.gz
cd glog-0.6.0
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig # Refreshing the link library
安装 magic_enum
wget -c https://github.com/Neargye/magic_enum/archive/refs/tags/v0.8.0.tar.gz -O magic_enum-0.8.0.tar.gz
tar -xzvf magic_enum-0.8.0.tar.gz
cd magic_enum-0.8.0
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig # Refreshing the link library
安装libuvc
git clone https://github.com/libuvc/libuvc.git
cd libuvc
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig # Refreshing the link library
二 安装ros2 sdk
创建ros2工作空间
mkdir -p ~/ros2_ws/src
下载摄像头sdk
下载地址:
https://developer.orbbec.com.cn/download.html?id=180
解压OpenNI_SDK_ROS2_v1.0.2_20220809_b32e47_linux并复制ros2_astra_camera到ros2_ws/src/工作空间下
目录结构
cd ~/ros2_ws/src/ros2_astra_camera/astra_camera/scripts
sudo bash install.sh
sudo udevadm control --reload-rules && sudo udevadm trigger
上面代码的意思是把56-orbbec-usb.rules usb规则文件复制到这个位置
编译
cd ~/ros2_ws
source /opt/ros/foxy/setup.bash
colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release
启动摄像头
source /opt/ros/foxy/setup.bash
source ./install/setup.bash
ros2 launch astra_camera astra_mini.launch.py
打开另一个终端
cd ros2_ws/
source /opt/ros/foxy/setup.bash
source ./install/setup.bash
rviz2 -d src/ros2_astra_camera/astra_camera/rviz/pointcloud.rviz
/camera/color/image_raw 彩色图像没有画面
/camera/depth/image_raw 深度图像有画面
/camera/ir/image_raw 红外图像有画面
ruiz2 时常崩溃,不知道哪里设置不对
[INFO] [1678260262.785682139] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [1678260262.785816992] [rviz2]: OpenGl version: 3 (GLSL 1.3)
[INFO] [1678260262.814228752] [rviz2]: Stereo is NOT SUPPORTED
[ERROR] [1678260262.939095875] [rviz2]: PluginlibFactory: The plugin for class 'rviz_common/Time' failed to load. Error: According to the loaded plugin descriptions the class rviz_common/Time with base class type rviz_common::Panel does not exist. Declared types are
[INFO] [1678260262.994966343] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [1678260263.017062470] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [1678260263.039783179] [rviz2]: Stereo is NOT SUPPORTED
rviz2: /tmp/binarydeb/ros-foxy-rviz-ogre-vendor-8.2.7/.obj-x86_64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/OgreMain/include/OgreAxisAlignedBox.h:225:void Ogre::AxisAlignedBox::setExtents(const Vector3&, const Vector3&): 假设 ‘(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"’ 失败。
已放弃 (核心已转储)
安装测试基本成功,为什么彩图没有出来在继续跟进。