1、 ,把系统烧录至SD卡后进入系统中依次完成:语言选择、键盘布局选择、WIFI连接、地区选择、用户设置、内存设置(0或者留空)。
2、 进入系统设置完成语言的完整下载以及等待系统完成更新、设置系统休眠为从不,最后重启系统。
3、 安装中文输入法:
输入:
sudo apt-get install ibus-pinyin
下载输入法
重启
ibus-setup
进入配置界面
选择Intelligent Pinyin
ibus restart
重启ibus
4、 更新源和软件:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
备份原本的源
sudo gedit /etc/apt/sources.list
打开文件
删除所有文件,复制以下内容:
deb http://mirrors.tuna./ubuntu-ports/ bionic main multiverse restricted universedeb http://mirrors.tuna./ubuntu-ports/ bionic-security main multiverse restricted universedeb http://mirrors.tuna./ubuntu-ports/ bionic-updates main multiverse restricted universedeb http://mirrors.tuna./ubuntu-ports/ bionic-backports main multiverse restricted universedeb-src http://mirrors.tuna./ubuntu-ports/ bionic main multiverse restricted universedeb-src http://mirrors.tuna./ubuntu-ports/ bionic-security main multiverse restricted universedeb-src http://mirrors.tuna./ubuntu-ports/ bionic-updates main multiverse restricted universedeb-src http://mirrors.tuna./ubuntu-ports/ bionic-backports main multiverse restricted universe
输入:
sudo apt-get updatesudo apt-get full-upgrade
5、 增加交换空间
检查当前系统的效换空间:sudo swapon –show
检查内存:free -h
创建用于swap的文件:sudo fallocate -l 2G /swapfile
如果fallocate没有安装,将得到fallocate failed:Operation not supported的报错信息。可以用以下命令创建:
sudo dd if=/dev/zero of=/swapfile bs=2048 count=1048576
所有用户都可以读写swap file,设置正确的权限:sudo chmod 666 /swapfile
设置交换空间:sudo mkswap /swapfile
激活交换空间:sudo swapon /swapfile
打开文件:sudo vi /etc/fstab
在文件中按i进入插入模式最后一行添加:/swapfile swap swap defaults 0 0
按esc退出再按:wq!保存。
验证增加空间是否有效:
sudo swapon --showsudo free -h
6、 切换功率
sudo nvpmodel -m 0sudo jetson_clocks
切换到高功率模式运行且把CPU频率固定。
7、 删除无用软件
删除office:
sudo apt-get purge libreoffice*sudo apt-get clean
8、 配置CUDA环境
打开文件:
sudo gedit .bashrc
在文件最后一行插入:
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}export CUDA_ROOT=/usr/local/cuda
保存后输入:source ~/.bashrc
然后用命令查看cuda版本:nvcc -V
9、 安装系统级安装包
sudo apt-get install build-essential make cmake cmake-curses-guisudo apt-get install git g++ pkg-config curlsudo apt-get install libatlas-base-dev gfortran libcanberra-gtk-module libcanberra-gtk3-modulesudo apt-get install libhdf5-serial-dev hdf5-tools sudo apt-get install nano locate screen
接着安装scipy的依赖和系统级别的cython:
sudo apt-get install libfreetype6-dev sudo apt-get install protobuf-compiler libprotobuf-dev opensslsudo apt-get install libssl-dev libcurl4-openssl-devsudo apt-get install cython3
如果要装TensorFlow Object Detection (TFOD) API ,还要装xml的工具:
sudo apt-get install libxml2-dev libxslt1-dev
接着安装opencv的系统级依赖,一些编解码的库:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-devsudo apt-get install libxvidcore-dev libavresample-devsudo apt-get install libtiff-dev libjpeg-dev libpng-devsudo apt-get install build-essential -ysudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev -ysudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev -ysudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev -ysudo apt-get install libxvidcore-dev libx264-dev -ysudo apt-get install libatlas-base-dev gfortran -ysudo apt-get install ffmpeg -y
更新CMake:
wget /files/v3.22/cmake-3.22.0.tar.gz #下载,版本号可到官网上查tar xpvf cmake-3.22.0.tar.gz cmake-3.22.0/ #解压cd cmake-3.22.0/./bootstrap --system-curlmake -j4 #编译echo 'export PATH=~/cmake-3.22.0/bin/:$PATH' >> ~/.bashrcsource ~/.bashrc #更新.bashrc
配置PIP
sudo apt-get install -y python3-dev python3-testresources python3-setuptools wget https://bootstrap.pypa.io/get-pip.pysudo python3 get-pip.pyrm get-pip.pypip install -i https://pypi.tuna./simple pip -Upython3 -m pip install –upgrade pip
利用pip安装一些包
sudo apt-get install python3-scipysudo apt-get install python3-pandassudo apt-get install python3-sklearn
10、 安装vscode
Visual Studio Code官网:/
点击Download for Windows
点击Other downloads
选择.deb中的ARM64
进入到下载目录打开终端输入:sudo dpkg -i code_1.62.0-1635953028_arm64.deb
继续运行:
sudo apt-get install -f # Install dependenciessudo apt install apt-transport-httpssudo apt updatesudo apt install code # or code-insiders
之后输入code进入。
11、 U盘兼容
sudo apt-get install exfat-utils
12、 安装pytorch
pytorch下载链接:
/s/1Nfm9w1DfE2k_cZQ1zTykMQ
提取码:zpsa
在文件目录输入:sudo pip3 install 文件名
1.提前打上我们需要的依赖
sudo apt-get install libopenmpi2sudo apt-get install libopenblas-devsudo apt-get install libjpeg-dev zlib1g-dev
cd torchvision# 进入到这个包的目录下export BUILD_VERSION=0.9.0sudo python3 setup.py install# 安装(估计要20分钟不止吧)
检验一下是否成功安装
python3import torchimport torchvisionprint(torch.cuda.is_available())# 这一步如果输出True那么就成功了!quit()# 最后退出python编译
13、 安装ROS
添加ROS 软件源
sudo sh -c 'echo "deb /ros/ubuntu $(lsb_release -sc) main">/etc/apt/sources.list.d/ros-latest.list'
添加密钥
sudo apt-key adv --keyserver 'hkp://:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
安装ROS
sudo apt updatesudo apt install ros-melodic-desktop-full(重复输入几次,确保完全安装)
初始化rosdep
sudo rosdep initrosdep update
如果出现rosdep未找到命令输入:sudo apt install python-rosdep
rosdep update报错解决办法:
把相关文件下载到本地:git clone /ros/rosdistro.git
改ROS去获取文件的地址:
(1)、查找文件/usr/lib/python2/dist-packages/rosdep2/rep3.py 中的,将 /ros/rosdistro/master 替换成file:///home/用户名/rosdistro(即文件路径)
(2)查找文件/usr/lib/python2/dist-packages/rosdistro/init.py中的,将 /ros/rosdistro/master 替换成file:///home/用户名/rosdistro(即文件路径)
3. 修改/etc/ros/rosdep/sources.list.d/20-default.list
继续改地址,将该文件中的所有 /ros/rosdistro/master 替换成file:///home/用户名/rosdistro(即文件路径)
上述步骤结束后继续执行:rosdep update
设置环境变量:
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrcsource ~/.bashrc
安装rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
验证安装是否成功
Roscore
打开另一个窗口:rosrun turtlesim turtlesim_node
再打开另一个窗口:rosrun turtlesim turtle_teleop_key
小海龟动起来就成功了。
11、安装cartographer
1.安装工具wstool,nijia,rosdep
sudo apt-get updatesudo apt-get install -y python-wstool python-rosdep ninja-build stow
2.加Google服务器域名提高下载速度
sudo gedit /etc/resolv.conf
注释掉之前那一行,并添加以下内容:
nameserver 8.8.8.8 nameserver 8.8.4.4
注意:安装完成后恢复成原来的。
3.打开终端ctrl+alt+t创建工作空间
mkdir cartographer_ws
4.三个pkg,cartographer,cartographer_ros,ceres-slover,
cd cartographer_wswstool init srccd srcgit clone /googlecartographer/cartographer_ros.gitgit clone /googlecartographer/cartographer.gitgit clone /ceres-solver/ceres-solver.git
5.安装依赖
cd cartographer_wssudo rosdep initrosdep updaterosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -ysrc/cartographer/scripts/install_abseil.shsudo apt-get remove ros-${ROS_DISTRO}-abseil-cpp
6.编译
catkin_make_isolated --install --use-ninja
7.跑demo
Demo下载地址:
https://google-cartographer-ros.readthedocs.io/en/latest/data.html#d-cartographer-backpack-deutsches-museum
刷新一下环境变量:source install_isolated/setup.bash
2D的:roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=//你的数据的路径
如果觉得《jetson nano 环境配置(pytorch+ros+rartographer)》对你有帮助,请点赞、收藏,并留下你的观点哦!