Nano上配置realsense D435相机

步骤:html

  • cmake

1)下载cmake-3.8.2.tar.gz : https://cmake.org/files/c++

or http://www.javashuo.com/article/p-wlbqohvd-ku.htmlgit

2) 在主文件夹下新建tools/文件夹,将cmake-3.8.2.tar.gz解压以后放在tools/中,为了防止出现权限不足问题,直接对文件更改权限:
解压:sudo tar -zxvf cmake-3.8.2.tar.gz
赋权限:sudo chmod -R 777 cmake-3.8.2github

3)a安装gcc-c++:
sudo apt-get install build-essential
或者直接执行这两条命令bootstrap

sudo apt-get install gcc
sudo apt-get install g++ubuntu

4)进入文件夹下执行如下命令:ide

 sudo ./bootstrap
 sudo make
 sudo make installpost

5)查看是否安装成功以及安装版本:测试

cmake --versionui

  • 下载SDK源码:
mkdir -p  ~/tools/
cd ~/tools/
git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
  • 安装依赖:
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
  • 先拔掉相机的USB线
  • 执行权限设置,创建别名
./scripts/setup_udev_rules.sh
  • 增长模块
echo 'hid_sensor_custom' | sudo tee -a /etc/modules
  • 添加变量到环境
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
  • 编译
  • 增长cuda支持
mkdir build 
cd build
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_WITH_CUDA=true
sudo make uninstall && make clean && make && sudo make install

一直卡在了:

Building with TM2

https://github.com/IntelRealSense/librealsense/issues/3125

https://github.com/IntelRealSense/librealsense/issues/3182

https://github.com/IntelRealSense/librealsense/issues/2737

https://github.com/IntelRealSense/librealsense/issues/2719#issuecomment-474823042

打开cmakelist.txt

显示

Internet connection identified
Info: REALSENSE_VERSION_STRING=2.29.0
Setting Unix configurations
using RS2_USE_V4L2_BACKEND
GLFW 3.3 not found; using internal version
Could NOT find Vulkan (missing:  VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
Using X11 for window creation
Could NOT find apriltag (missing:  APRILTAG_INC APRILTAG_LIB) 
Unable to find apriltag library, skipping pose-apriltag example
Fetching recommended firmwares:
D4XX_RC_VERSION: 5.11.15.0
D4XX_FW_VERSION: 5.11.15.0
SR3XX_FW_VERSION: 3.26.1.0
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_FW_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_RC_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for SR3XX_FW_Image-3.26.1.0.bin
Configuring done
Generating done
这里会有一点慢 

Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_FW_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_RC_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for SR3XX_FW_Image-3.26.1.0.bin
勾选Python选项

换成其余Python,带有torch环境的,后续检测+深度

https://blog.csdn.net/qq_22598167/article/details/89948089

https://www.cnblogs.com/z1141000271/p/10554341.html

勾选example

mkdir build && cd build
cmake ../ -DBUILD_EXAMPLES=true
sudo make uninstall && make clean && make -j8 && sudo make install

  • 安装完成后,相应目录位于:
The shared object will be installed in /usr/local/lib
header files in /usr/local/include.
The binary demos, tutorials and test files will be copied into /usr/local/bin

测试:

  • 测试例子:
cd ~/tools/librealsense/build/examples/capture
./rs-capture
  • 效果以下:

d435-rs-capture.pnguploading.gif转存失败从新上传取消请输入图片描述

参考:

  • https://github.com/IntelRealSense/librealsense/blob/development/doc/installation.md
  • https://github.com/jetsonhacks/buildLibrealsense2Xavier
  • https://devtalk.nvidia.com/default/topic/1051016/jetson-nano/use-intel-reg-realsense-trade-d435-series-depth-camera-on-nano/post/5335681/#5335681
  • https://www.ncnynl.com/archives/201905/3090.html

 期间遇到的问题在此记录一下:

一、

sudo apt install libssl-dev 时报错,报错信息以下

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.0g-2ubuntu4) but 1.1.0g-2ubuntu4.3 is to be installed
              Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

cmake ../ -DBUILD_EXAMPLES=true -DBUILD_WITH_CUDA=true 这一步时出现了下面的错误

-- GLFW 3.3 not found; using internal version
-- Could NOT find Vulkan (missing:  VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
-- 

-- Configuring incomplete, errors occurred!

而后我又下载编译GLFW也不行,编译时也报错中断,网上搜索时,看到了这个提问,很是感谢

https://.com/questions/620601/-install-libsdl2-dev-or-cmake-glfw-libxinerama-dev-problem

在命令行执行sudo apt-get install libxinerama-dev

Using X11 for window creation  CMake Error at third-party/glfw/CMakeLists.txt:235 (message):

The Xinerama headers were not found错误得以解决

再次配置编译GLFW,参考此文章:https://blog.csdn.net/xyh930929/article/details/83745958

关于glfw,可观看次文章:https://blog.csdn.net/zjz520yy/article/details/83000081

以前报的GLFW 3.3 not found; using internal version错误得以解决