【Jetson Tx2 视觉slam开发】入门配置二

来源:互联网 发布:淘宝满减怎么免费设置 编辑:程序博客网 时间:2024/06/05 09:06

Jetson Tx2安装ROS
https://github.com/jetsonhacks/installROSTX2
updateRepositories.sh This is an optional step. Adds the repositories universe, multiverse, and restricted and then apt-get update. These repositories are in the standard 27.1 install, so probably not needed.

installROS.sh Adds the ROS sources list, sets the keys and then loads ros-kinetic-ros-base. Edit this file to add other ROS packages for your installation. After loading, rosdep is initialized.

setupCatkinWorkspace.sh Usage:

$ ./setupCatkinWorkspace.sh [optionalWorkspaceName]

具体操作:
安装可以参照 http://wiki.ros.org/kinetic/Installation/Ubuntu,或者根据下面所示进行安装。

#!/bin/bash# Install Robot Operating System (ROS) on NVIDIA Jetson TX2# Maintainer of ARM builds for ROS is http://answers.ros.org/users/1034/ahendrix/# Information from:# http://wiki.ros.org/kinetic/Installation/UbuntuARM# Setup sources.lstsudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'# Setup keyssudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116# Installationsudo apt-get updatesudo apt-get install ros-kinetic-ros-base -y or sudo apt-get install ros-kinetic-ros-desktop -y# Add Individual Packages here# You can install a specific ROS package (replace underscores with dashes of the package name):# sudo apt-get install ros-kinetic-PACKAGE# e.g.# sudo apt-get install ros-kinetic-navigation## To find available packages:# apt-cache search ros-kinetic# # Initialize rosdepsudo apt-get install python-rosdep -y# Certificates are messed upsudo c_rehash /etc/ssl/certs# Initialize rosdepsudo rosdep init# To find available packages, use:rosdep update# Environment Setupecho "source /opt/ros/kinetic/setup.bash" >> ~/.bashrcsource ~/.bashrc# Install rosinstallsudo apt-get install python-rosinstall -y

这里写图片描述

按照以上教程安装完成即可。

启动自带摄像头
打开Jetson TX2的终端

写入命令:nvgstcapture-1.0 ,摄像头就会起来了
1. –prev_res 预览视屏的分辨率,高度和宽度,用的是CSI摄像头的话范围是 2 to 12 (5632x4224)

nvgstcapture-1.0 --prev-res=3
  1. –cus-prev-res 自定义预览分辨率,宽度和高度,仅支持CSI摄像头
nvgstcapture-1.0 --cus-prev-res=1920x1080

多个命令同时使用的话用!隔开,想关掉摄像头的额话,直接在终端输入q再按回车,想捕获图片的话,在终端输入j再按回车,图片将保存当前目录下。

Tensorflow安装

http://www.ncnynl.com/archives/201706/1754.html

git clone https://github.com/ncnynl/installTensorFlowTX2.gitcd installTensorFlowTX2

安装依赖:

chmod +x installPrerequisites.sh ./installPrerequisites.sh

下载tensorflow代码:

 ./cloneTensorFlow.sh

设置环境变量:

 ./setTensorFlowEV.sh

问题:提示junit.4.12.jar不能下载

解决:修改vim ~/tensorflow/tensorflow/workspace.bzl 更换地址,并去掉校验

 native.http_jar(      name = "junit_jar",      #url = "https://github.com/junit-team/junit4/releases/download/r4.12/junit-4.12.jar",      url = "https://github.com/orrsella/bazel-example/blob/master/third_party/junit/junit-4.12.jar",      #sha256 = "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a",      #sha256 = "fe3d4c56388dc3d74049abae83f4520f6703062e174e16bb5551cdf439ca4f81",  )

编译TensorFlow:

./buildTensorFlow.sh

打包成whl文件,放在$HOME目录下,如:tensorflow-1.0.1-cp27-cp27mu-linux_aarch64.whl

./packageTensorFlow.sh

安装whl文件

pip install $HOME/tensorflow-1.0.1-cp27-cp27mu-linux_aarch64.whl

提示权限错误的时候前边加上sudo即可

Caffee安装(安装成功)
参考:http://blog.csdn.net/jiongnima/article/details/70040262亲测可用

sudo gedit /etc/bash.bashrc

在文件的末尾加入如下

export PATH=/usr/local/cuda-8.0/bin:$PATHexport LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH

然后cuda就配置完毕了,运行

nvcc -V

这里写图片描述
首先安装一般依赖项

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compilersudo apt-get install --no-install-recommends libboost-all-dev

再安装BLAS依赖项

sudo apt-get install libatlas-base-dev

然后是python和其余依赖项,安装python及其头文件

sudo apt-get install pythonsudo apt-get install python-dev

安装python的其他依赖

sudo apt-get install python-numpysudo apt-get install ipythonsudo apt-get install ipython-notebooksudo apt-get install python-sklearnsudo apt-get install python-skimagesudo apt-get install python-protobuf

然后是谷歌glog和gflags和lmdb依赖项

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

接着安装git,并且下载代码

sudo apt-get install gitgit clone https://github.com/BVLC/caffe.git

然后进入到源码目录

cd caffe

编译Caffe

cp Makefile.config.example Makefile.config

需要使用cuDNN的朋友可以将Makefile.config中USE_CUDNN := 1这一行之前的井号注释去掉,
同时,为了匹配cuda8.0的计算能力,请把Makefile.config中CUDA_ARCH中的前两行去掉,如下图所示(保留也行,编译的时候会弹出警告)
这里写图片描述
值得注意的是,笔者在第一次编译的时候遇到了如下问题:
./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
解决方法笔者参阅了http://blog.csdn.net/hongye000000/article/details/51043913点击打开链接,在链接博客中,解决方法如下:
在Makefile.config文件中,添加 /usr/include/hdf5/serial/ 到 INCLUDE_DIRS,也就是把下面第一行代码改为第二行代码。

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/includeINCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/

在Makefile文件中,把 hdf5_hl 和hdf5修改为hdf5_serial_hl 和 hdf5_serial,也就是把下面第一行代码改为第二行代码。

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

上述解决方法笔者亲测有效,感谢博主,然后

make cleanmake all -j8

即可编译成功。

处江湖之远,再见哦!bianxu7730@163.com

原创粉丝点击