【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装

目录

  • ZED 2i驱动安装
    • 安装驱动
    • 自测
    • ROS测试
      • zed2i.launch
      • rostopic list
      • rosnode list
      • display_zed2i.launch
      • zed_rtabmap.launch
  • ORB-SLAM3
    • 安装OpenCV 3
    • 安装Glew
    • 安装Pangolin
    • 安装boost
    • 安装Eigen 3
    • 安装OpenGL
    • 安装openssl
    • 安装ORB-SLAM3
      • 建立swap
      • 准备编译
      • 编译
      • 关闭swap

平台:Jetson Nano
系统版本:4.6.1


ZED 2i驱动安装

安装驱动

在ZED 2i 官方驱动下载驱动,需要与Jetson Nano系统版本对应。
下载速度很慢,这是我备份的:ZED_SDK_Tegra_JP46_v3.7.0.run(ZED2 Jetson Nano驱动包)
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第1张图片
在这里插入图片描述
将下好的驱动发送到Nano里:

scp ./ZED_SDK_Tegra_JP46_v3.7.0.run [email protected]:~/

在这里插入图片描述
如下图,驱动已经传输过来了:
在这里插入图片描述
加权限后运行

sudo chmod +x ./ZED_SDK_Tegra_JP46_v3.7.0.run
./ZED_SDK_Tegra_JP46_v3.7.0.run

之后都选择y同意

自测

/usr/local/zed/tools中有一些测试小工具:
在这里插入图片描述
如ZED_Sensor_Viewer:

如ZED_Depth_Viewer:

ROS测试

参考博文:安装zed-ros-wrapper 并解决一些报错—— 努力~自律~开心

sudo apt-get install ros-melodic-sensor-msgs
sudo apt-get install ros-melodic-tf2-sensor-msgs
sudo cp /usr/lib/python2.7/dist-packages/em.py /opt/ros/melodic/lib/python2.7/dist-packages/
source /opt/ros/melodic/setup.bash
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3
source devel/setup.bash
cd ~/catkin_ws/src
git clone --recursive https://gitee.com/chr12/zed-ros-wrapper.git
git clone https://gitee.com/zhanghao132/zed-ros-examples.git
cd ~/catkin_ws
rosdep install --from-paths src --ignore-src -r -y
catkin_make -DCMAKE_BUILD_TYPE=Release

zed2i.launch

source ./devel/setup.bash
roslaunch zed_wrapper zed2i.launch

第一次运行会在这里卡住下载东西:
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第2张图片
漫长的等待后
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第3张图片

rostopic list

rostopic list

使用rqt_image_view可以查看不同节点的命令
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第4张图片

/diagnostics
/rosout
/rosout_agg
/tf
/tf_static
/zed2i/joint_states
/zed2i/zed_node/atm_press
/zed2i/zed_node/confidence/confidence_map
/zed2i/zed_node/depth/camera_info
/zed2i/zed_node/depth/depth_registered
/zed2i/zed_node/depth/depth_registered/compressed
/zed2i/zed_node/depth/depth_registered/compressed/parameter_descriptions
/zed2i/zed_node/depth/depth_registered/compressed/parameter_updates
/zed2i/zed_node/depth/depth_registered/compressedDepth
/zed2i/zed_node/depth/depth_registered/compressedDepth/parameter_descriptions
/zed2i/zed_node/depth/depth_registered/compressedDepth/parameter_updates
/zed2i/zed_node/depth/depth_registered/theora
/zed2i/zed_node/depth/depth_registered/theora/parameter_descriptions
/zed2i/zed_node/depth/depth_registered/theora/parameter_updates
/zed2i/zed_node/disparity/disparity_image
/zed2i/zed_node/imu/data
/zed2i/zed_node/imu/data_raw
/zed2i/zed_node/imu/mag
/zed2i/zed_node/left/camera_info
/zed2i/zed_node/left/image_rect_color
/zed2i/zed_node/left/image_rect_color/compressed
/zed2i/zed_node/left/image_rect_color/compressed/parameter_descriptions
/zed2i/zed_node/left/image_rect_color/compressed/parameter_updates
/zed2i/zed_node/left/image_rect_color/compressedDepth
/zed2i/zed_node/left/image_rect_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/left/image_rect_color/compressedDepth/parameter_updates
/zed2i/zed_node/left/image_rect_color/theora
/zed2i/zed_node/left/image_rect_color/theora/parameter_descriptions
/zed2i/zed_node/left/image_rect_color/theora/parameter_updates
/zed2i/zed_node/left/image_rect_gray
/zed2i/zed_node/left/image_rect_gray/compressed
/zed2i/zed_node/left/image_rect_gray/compressed/parameter_descriptions
/zed2i/zed_node/left/image_rect_gray/compressed/parameter_updates
/zed2i/zed_node/left/image_rect_gray/compressedDepth
/zed2i/zed_node/left/image_rect_gray/compressedDepth/parameter_descriptions
/zed2i/zed_node/left/image_rect_gray/compressedDepth/parameter_updates
/zed2i/zed_node/left/image_rect_gray/theora
/zed2i/zed_node/left/image_rect_gray/theora/parameter_descriptions
/zed2i/zed_node/left/image_rect_gray/theora/parameter_updates
/zed2i/zed_node/left_cam_imu_transform
/zed2i/zed_node/left_raw/camera_info
/zed2i/zed_node/left_raw/image_raw_color
/zed2i/zed_node/left_raw/image_raw_color/compressed
/zed2i/zed_node/left_raw/image_raw_color/compressed/parameter_descriptions
/zed2i/zed_node/left_raw/image_raw_color/compressed/parameter_updates
/zed2i/zed_node/left_raw/image_raw_color/compressedDepth
/zed2i/zed_node/left_raw/image_raw_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/left_raw/image_raw_color/compressedDepth/parameter_updates
/zed2i/zed_node/left_raw/image_raw_color/theora
/zed2i/zed_node/left_raw/image_raw_color/theora/parameter_descriptions
/zed2i/zed_node/left_raw/image_raw_color/theora/parameter_updates
/zed2i/zed_node/left_raw/image_raw_gray
/zed2i/zed_node/left_raw/image_raw_gray/compressed
/zed2i/zed_node/left_raw/image_raw_gray/compressed/parameter_descriptions
/zed2i/zed_node/left_raw/image_raw_gray/compressed/parameter_updates
/zed2i/zed_node/left_raw/image_raw_gray/compressedDepth
/zed2i/zed_node/left_raw/image_raw_gray/compressedDepth/parameter_descriptions
/zed2i/zed_node/left_raw/image_raw_gray/compressedDepth/parameter_updates
/zed2i/zed_node/left_raw/image_raw_gray/theora
/zed2i/zed_node/left_raw/image_raw_gray/theora/parameter_descriptions
/zed2i/zed_node/left_raw/image_raw_gray/theora/parameter_updates
/zed2i/zed_node/odom
/zed2i/zed_node/parameter_descriptions
/zed2i/zed_node/parameter_updates
/zed2i/zed_node/path_map
/zed2i/zed_node/path_odom
/zed2i/zed_node/point_cloud/cloud_registered
/zed2i/zed_node/pose
/zed2i/zed_node/pose_with_covariance
/zed2i/zed_node/rgb/camera_info
/zed2i/zed_node/rgb/image_rect_color
/zed2i/zed_node/rgb/image_rect_color/compressed
/zed2i/zed_node/rgb/image_rect_color/compressed/parameter_descriptions
/zed2i/zed_node/rgb/image_rect_color/compressed/parameter_updates
/zed2i/zed_node/rgb/image_rect_color/compressedDepth
/zed2i/zed_node/rgb/image_rect_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/rgb/image_rect_color/compressedDepth/parameter_updates
/zed2i/zed_node/rgb/image_rect_color/theora
/zed2i/zed_node/rgb/image_rect_color/theora/parameter_descriptions
/zed2i/zed_node/rgb/image_rect_color/theora/parameter_updates
/zed2i/zed_node/rgb/image_rect_gray
/zed2i/zed_node/rgb/image_rect_gray/compressed
/zed2i/zed_node/rgb/image_rect_gray/compressed/parameter_descriptions
/zed2i/zed_node/rgb/image_rect_gray/compressed/parameter_updates
/zed2i/zed_node/rgb/image_rect_gray/compressedDepth
/zed2i/zed_node/rgb/image_rect_gray/compressedDepth/parameter_descriptions
/zed2i/zed_node/rgb/image_rect_gray/compressedDepth/parameter_updates
/zed2i/zed_node/rgb/image_rect_gray/theora
/zed2i/zed_node/rgb/image_rect_gray/theora/parameter_descriptions
/zed2i/zed_node/rgb/image_rect_gray/theora/parameter_updates
/zed2i/zed_node/rgb_raw/camera_info
/zed2i/zed_node/rgb_raw/image_raw_color
/zed2i/zed_node/rgb_raw/image_raw_color/compressed
/zed2i/zed_node/rgb_raw/image_raw_color/compressed/parameter_descriptions
/zed2i/zed_node/rgb_raw/image_raw_color/compressed/parameter_updates
/zed2i/zed_node/rgb_raw/image_raw_color/compressedDepth
/zed2i/zed_node/rgb_raw/image_raw_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/rgb_raw/image_raw_color/compressedDepth/parameter_updates
/zed2i/zed_node/rgb_raw/image_raw_color/theora
/zed2i/zed_node/rgb_raw/image_raw_color/theora/parameter_descriptions
/zed2i/zed_node/rgb_raw/image_raw_color/theora/parameter_updates
/zed2i/zed_node/rgb_raw/image_raw_gray
/zed2i/zed_node/rgb_raw/image_raw_gray/compressed
/zed2i/zed_node/rgb_raw/image_raw_gray/compressed/parameter_descriptions
/zed2i/zed_node/rgb_raw/image_raw_gray/compressed/parameter_updates
/zed2i/zed_node/rgb_raw/image_raw_gray/compressedDepth
/zed2i/zed_node/rgb_raw/image_raw_gray/compressedDepth/parameter_descriptions
/zed2i/zed_node/rgb_raw/image_raw_gray/compressedDepth/parameter_updates
/zed2i/zed_node/rgb_raw/image_raw_gray/theora
/zed2i/zed_node/rgb_raw/image_raw_gray/theora/parameter_descriptions
/zed2i/zed_node/rgb_raw/image_raw_gray/theora/parameter_updates
/zed2i/zed_node/right/camera_info
/zed2i/zed_node/right/image_rect_color
/zed2i/zed_node/right/image_rect_color/compressed
/zed2i/zed_node/right/image_rect_color/compressed/parameter_descriptions
/zed2i/zed_node/right/image_rect_color/compressed/parameter_updates
/zed2i/zed_node/right/image_rect_color/compressedDepth
/zed2i/zed_node/right/image_rect_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/right/image_rect_color/compressedDepth/parameter_updates
/zed2i/zed_node/right/image_rect_color/theora
/zed2i/zed_node/right/image_rect_color/theora/parameter_descriptions
/zed2i/zed_node/right/image_rect_color/theora/parameter_updates
/zed2i/zed_node/right/image_rect_gray
/zed2i/zed_node/right/image_rect_gray/compressed
/zed2i/zed_node/right/image_rect_gray/compressed/parameter_descriptions
/zed2i/zed_node/right/image_rect_gray/compressed/parameter_updates
/zed2i/zed_node/right/image_rect_gray/compressedDepth
/zed2i/zed_node/right/image_rect_gray/compressedDepth/parameter_descriptions
/zed2i/zed_node/right/image_rect_gray/compressedDepth/parameter_updates
/zed2i/zed_node/right/image_rect_gray/theora
/zed2i/zed_node/right/image_rect_gray/theora/parameter_descriptions
/zed2i/zed_node/right/image_rect_gray/theora/parameter_updates
/zed2i/zed_node/right_raw/camera_info
/zed2i/zed_node/right_raw/image_raw_color
/zed2i/zed_node/right_raw/image_raw_color/compressed
/zed2i/zed_node/right_raw/image_raw_color/compressed/parameter_descriptions
/zed2i/zed_node/right_raw/image_raw_color/compressed/parameter_updates
/zed2i/zed_node/right_raw/image_raw_color/compressedDepth
/zed2i/zed_node/right_raw/image_raw_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/right_raw/image_raw_color/compressedDepth/parameter_updates
/zed2i/zed_node/right_raw/image_raw_color/theora
/zed2i/zed_node/right_raw/image_raw_color/theora/parameter_descriptions
/zed2i/zed_node/right_raw/image_raw_color/theora/parameter_updates
/zed2i/zed_node/right_raw/image_raw_gray
/zed2i/zed_node/right_raw/image_raw_gray/compressed
/zed2i/zed_node/right_raw/image_raw_gray/compressed/parameter_descriptions
/zed2i/zed_node/right_raw/image_raw_gray/compressed/parameter_updates
/zed2i/zed_node/right_raw/image_raw_gray/compressedDepth
/zed2i/zed_node/right_raw/image_raw_gray/compressedDepth/parameter_descriptions
/zed2i/zed_node/right_raw/image_raw_gray/compressedDepth/parameter_updates
/zed2i/zed_node/right_raw/image_raw_gray/theora
/zed2i/zed_node/right_raw/image_raw_gray/theora/parameter_descriptions
/zed2i/zed_node/right_raw/image_raw_gray/theora/parameter_updates
/zed2i/zed_node/stereo/image_rect_color
/zed2i/zed_node/stereo/image_rect_color/compressed
/zed2i/zed_node/stereo/image_rect_color/compressed/parameter_descriptions
/zed2i/zed_node/stereo/image_rect_color/compressed/parameter_updates
/zed2i/zed_node/stereo/image_rect_color/compressedDepth
/zed2i/zed_node/stereo/image_rect_color/compressedDepth/parameter_descriptions

/zed2i/zed_node/stereo/image_rect_color/compressedDepth/parameter_updates
/zed2i/zed_node/stereo/image_rect_color/theora
/zed2i/zed_node/stereo/image_rect_color/theora/parameter_descriptions
/zed2i/zed_node/stereo/image_rect_color/theora/parameter_updates
/zed2i/zed_node/stereo_raw/image_raw_color
/zed2i/zed_node/stereo_raw/image_raw_color/compressed
/zed2i/zed_node/stereo_raw/image_raw_color/compressed/parameter_descriptions
/zed2i/zed_node/stereo_raw/image_raw_color/compressed/parameter_updates
/zed2i/zed_node/stereo_raw/image_raw_color/compressedDepth
/zed2i/zed_node/stereo_raw/image_raw_color/compressedDepth/parameter_descriptions
/zed2i/zed_node/stereo_raw/image_raw_color/compressedDepth/parameter_updates
/zed2i/zed_node/stereo_raw/image_raw_color/theora
/zed2i/zed_node/stereo_raw/image_raw_color/theora/parameter_descriptions
/zed2i/zed_node/stereo_raw/image_raw_color/theora/parameter_updates
/zed2i/zed_node/temperature/imu
/zed2i/zed_node/temperature/left
/zed2i/zed_node/temperature/right

rosnode list

rosnode list

在这里插入图片描述

/rosout
/zed2i/zed2i_state_publisher
/zed2i/zed_node

display_zed2i.launch

source ~/catkin_ws/devel/setup.bash
roslaunch zed_display_rviz display_zed2i.launch


zed_rtabmap.launch

source ~/catkin_ws/devel/setup.bash
roslaunch zed_rtabmap_example zed_rtabmap.launch

ORB-SLAM3

旧记录见【RK3399Pro学习笔记】十七、Debian安装ORB-SLAM3和单目demo的运行
之前用的Fastgit来加速下载,但由于旧的镜像站不能用了,新镜像站速度也很慢,所以寄了。
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第5张图片

安装OpenCV 3

安装各种依赖包

// 安装build-essential、cmake、git和pkg-config
sudo apt install build-essential cmake git pkg-config 

// 安装tif格式图像工具包
sudo apt install libtiff5-dev 

//安装视频I/O包
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

//安装gtk2.0
sudo apt install aptitude
sudo aptitude install libgtk2.0-dev

//优化函数包
sudo apt install libatlas-base-dev gfortran

安装opencv及contrib

# Install minimal prerequisites (Ubuntu 18.04 as reference)
sudo apt update && sudo apt install -y cmake g++ wget unzip
# Download and unpack sources 速度很慢,在windows电脑下快些
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.16.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.16.zip

直接复制链接用下载软件下载:
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第6张图片
使用scp命令发送到Nano中
在这里插入图片描述

unzip opencv.zip
unzip opencv_contrib.zip
# Create build directory and switch into it
mkdir -p build && cd build
# Configure
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.16/modules ../opencv-3.4.16
# Build
cmake --build .
# 安装
sudo make install
# 更新动态链接库
sudo ldconfig

在执行

cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.16/modules ../opencv-3.4.16

时可能会警告下载某些文件超时,可在cmake的日志中获取其下载链接和放置路径

cat ~/build/CMakeDownloadLog.txt

在这里插入图片描述

#do_copy "boostdesc_bgm.i" "0ea90e7a8f3f7876d450e4149c97c74f" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i" "/home/nano/build/downloads/xfeatures2d"
#missing "/home/nano/build/downloads/xfeatures2d/boostdesc_bgm.i"
#cmake_download "/home/nano/opencv-3.4.16/.cache/xfeatures2d/boostdesc/0ea90e7a8f3f7876d450e4149c97c74f-boostdesc_bgm.i" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i"

【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第7张图片

【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第8张图片
自行补全后再次

cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.16/modules ../opencv-3.4.16

【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第9张图片

安装Glew

sudo apt install libglew-dev

安装Pangolin

git clone https://gitee.com/cuixuyang615/Pangolin_new.git
cd Pangolin_new
sudo nano ./src/CMakeLists.txt

注释掉如下内容
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第10张图片

sudo nano ./src/display/device/display_x11.cpp

注释如下两行:
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第11张图片

mkdir build && cd build
cmake ..
make
cmake --build .
sudo make install

安装boost

wget -O boost_1_78_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz

下载后发给Nano也行
【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第12张图片

tar -zxvf boost_1_78_0.tar.gz
cd boost_1_78_0/
./bootstrap.sh
sudo ./b2 install

安装Eigen 3

git clone https://gitee.com/kobin24/eigen-git-mirror.git
cd eigen-git-mirror
mkdir build
cd build
cmake ..
sudo make install

执行完命令后,需要找到Eigen的安装路径,将Eigen文件夹复制到/usr/include。在Nano上用的是以下命令完成(引自Ubuntu16.04环境下安装配置ORB-SLAM3 —— Hannnnnnnk)

sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include 

安装OpenGL

sudo apt-get install build-essential libgl1-mesa-dev
sudo apt-get install freeglut3-dev
sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev

安装openssl

sudo apt-get install libssl-dev

安装ORB-SLAM3

git clone https://gitee.com/changlc/ORB_SLAM3_detailed_comments.git
cd ORB_SLAM3_detailed_comments
sudo chmod +x ./build.sh
sudo chmod +x ./build_ros.sh

建立swap

查看剩余空间

df -h

【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装_第13张图片
建立20G的swap空间

sudo dd if=/dev/zero of=/swapfile bs=1024 count=20971520
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

在这里插入图片描述
在这里插入图片描述

准备编译

删掉
CMakeLists.txt
Thirdparty/g2o/CMakeLists.txt
Thirdparty/DBoW2/CMakeLists.txt
Examples/ROS/ORB_SLAM3/CMakeLists.txt

SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march native")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march native")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march native")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march native")

结尾的-march native(见ORB_SLAM3运行时segment fault —— iri_descent),
以及统一这些文件中的OpenCV版本需求(见ORB-SLAM3 安装运行 —— 寒、)
有的为

find_package(OpenCV 4.0 QUIET)
if(NOT OpenCV_FOUND)
   find_package(OpenCV 3.0 QUIET)
   if(NOT OpenCV_FOUND)
      message(FATAL_ERROR "OpenCV > 3.0 not found.")
   endif()
endif()

有的为

find_package(OpenCV 3.0 QUIET)
if(NOT OpenCV_FOUND)
   find_package(OpenCV 2.4.3 QUIET)
   if(NOT OpenCV_FOUND)
      message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
   endif()
endif()

建议统一之后再开始编译

编译

./build.sh
sudo nano ~/.bashrc
# ~/ORB_SLAM3_detailed_comments为自己电脑中ORB_SLAM3存放的路径

在末尾加入

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/ORB_SLAM3_detailed_comments/Examples/ROS

保存后再

source ~/.bashrc

./build_ros.sh

关闭swap

sudo swapoff /swapfile

你可能感兴趣的:(#,Jetson,Nano,slam,ros,ubuntu,linux,计算机视觉)