前言
网络上的安装方法和标定方法乱七八糟五花八门看的我眼睛都花了,这里直接尝试用一用官方教程和一些看上去不错的教程看看。
在安装驱动前必须要安装好ROS的环境或者是ROS2的环境,同时CUDA也需要安装好,我这里安装好了所以不做继续的介绍。
官方文档:https://www.stereolabs.com/docs/ros2
SDK文档:https://www.stereolabs.com/en-cn/developers/release
ZED驱动安装
下载符合自己电脑CUDA版本的SDK,因为我是cuda12,所以我下载4.1版本
根据官方文档https://www.stereolabs.com/docs/installation/linux安装
sudo apt install zstd
chmod +x ZED_SDK_Ubuntu22_cuda11.8_v4.0.0.zstd.run
./ZED_SDK_Ubuntu22_cuda11.8_v4.0.0.zstd.run -- silent
ZED-ROS2-WRAPPER安装
参考官方github:https://github.com/stereolabs/zed-ros2-wrapper
mkdir -p ~/ros2_ws/src/ # create your workspace if it does not exist
cd ~/ros2_ws/src/ #use your current ros2 workspace folder
git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git
cd ..
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -r -y # install dependencies
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) # build the workspace
echo source $(pwd)/install/local_setup.bash >> ~/.bashrc # automatically source the installation in every new bash (optional)
source ~/.bashrc
第一个错误:rosdep无法初始化
运行rosdep update的时候出现错误,试了很多方法没有用,决定用rosdepc代替,用下面的代码一键安装rosdepc,然后所有与rosdep有关的命令用rosdepc替代,不需要换源!否则可能会出现我后面遇见的一大堆遭心问题
wget http://fishros.com/install -O fishros && . fishros
说实话,后面太多问题我晕倒了,大概就是几个主要问题,一个是CUDA版本要安装好,一个就是需要替换一些anaconda的东西,如果没有anaconda会方便很多,遇见什么问题搜什么,一般都可以解决问题。
启动ZED节点
ros2 launch zed_wrapper zed_camera.launch.py camera_model:=zed2i
安装例程包
先去官方网站查询教程https://github.com/stereolabs/zed-ros2-examples
cd ~/ros2_ws/src/ #use your current ros2 workspace folder
git clone https://github.com/stereolabs/zed-ros2-examples.git
cd ../
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
source ~/.bashrc
上述流程应该不会再出现问题了,如果上面的zed_wrapper弄好了的话。
ros2 launch zed_display_rviz2 display_zed_cam.launch.py camera_model:=zed2i