Jetson nano B01 study notes -- system environment configuration and ROS installation


1. Introduction to Jetson nano

insert image description here
Jetson Nano is a small and powerful artificial intelligence embedded development board, launched by Nvidia in March 2019. It is pre-installed with Ubuntu 18.04LTS system and equipped with a 128-core Maxwell GPU developed by Nvidia, which can quickly implement AI technology and apply it to various smart devices. Compared with Jetson's previous products (Jetson TK1, Jetson TX1, Jetson TX2, Jetson Xavier), Jetson Nano has greatly reduced the research and development cost of artificial intelligence terminals. Therefore, once launched, it has received widespread attention.

Several advantages of Jetson nano

(1) Small in size, powerful in performance, and affordable in price, it adopts a Raspberry Pi-like hardware design as a whole and supports a series of popular AI frameworks, and Nvidia has invested a lot of research and development effort in creating a matching Jetpack SDK development kit for it. , the development kit can make learning and developing AI products easier and more convenient.

(2) Specially designed for AI, its performance is more powerful than that of Raspberry Pi. Equipped with quad-core Cortex-A57 processor, 128-core Maxwell GPU and 4GB LPDDR memory, it can bring sufficient AI computing power to robot terminals and industrial vision terminals. force.

(3) Provides 472 GFLOPs of computing power, supports high-resolution sensors, can process multiple sensors in parallel, and can run multiple modern neural networks on each sensor stream.

(4) Support NVIDIA JetPack component packages, including board-level support packages for deep learning, computer vision, GPU computing, multimedia processing, etc., CUDA, cuDNN and TensorRT software libraries.

(5) Support a series of popular AI frameworks and algorithms, such as TensorFlow, PyTorch, Caffe/Caffe2, Keras, MXNet, etc., enabling developers to easily and quickly integrate AI models and frameworks into products, and easily realize image recognition, goals Powerful functions such as detection, pose estimation, semantic segmentation, video enhancement and intelligent analysis.

2. System environment configuration

1. System image burning

First click the link to download the official image file for Jetson nano

https://developer.nvidia.com/jetson-nano-sd-card-image-r3221

Prepare the SD card and card reader to burn the system image, use the SD card formatting tool to format the SD,Note that if it is the domestic version of the Jetson nano development kit, you must first flash the firmware for the emmc system before using the SD card as the system boot disk. Remember to ask the seller for the firmware.

SD Card Formatter Tool Download

insert image description here

Open the SD Card Formatter software, select the corresponding SD card drive letter, and select the Quick format mode to format the SD card directly. After formatting, download the balenaEtcher burning tool and prepare to burn the system image

balenaEtcher burning tool download

insert image description here

Select the corresponding system image file, select the corresponding SD card drive letter, and click flash to burn. After burning, eject the card reader and SD card, insert the SD card into the card slot of Jetson nano, power on Jetson nano,It is best to use a 5V4A power adapter to power Jetson nano

2. CUDA environment configuration

Ubuntu18.04LTS provided by Nvidia's official system image, if the system image is successfully burned and started successfully, it will enter the following interface, which is in the case of an external display

insert image description here
First update the software source and upgrade as usual,It is not recommended to update after changing the source, because the adaptation of several domestic mirror sources is not as good as the official source, and some strange errors may be reported

sudo apt-get update
sudo apt-get upgrade

Install some common tools

sudo apt install curl
sudo apt install nano

Install jtop to view the operating information of the system, enter the jtop command in the terminal to view the system information

sudo pip3 install jetson-stats
jtop

CUDA10.2 version has been installed in Jetson-nano

nvcc -V 

At this time, if the operation fails, you need to write the CUDA path into the environment variable./.bashrc is a script used to configure Ubuntu system environment variables

ls /usr/local/cuda/bin
sudo vim ~/.bashrc 

We write through the text editor vim that comes with Ubuntu, and add the following two lines to the end

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_

After exiting to command mode through Esc, start typing commands by pressing:, wq to save and exit, q to exit, q! In order to force exit, you need to source the script to make the environment variable take effect

OpenCV4.1.1 version has been installed in Jetson-nano, use the command to check whether OpenCV is ready to install

pkg-config opencv4 --modversion

cuDNN has been installed in Jetson-nano, and there are examples available to run. Let's run the example to verify the above CUDA. First enter the example directory under the /usr/src/cudnn_samples_v8/mnistCUDNN path, and then compile it

cd /usr/src/cudnn_samples_v8/mnistCUDNN
sudo chmod +777 mnistCUDNN
sudo make

3. ROS installation and environment configuration

ROS is an open source meta-operating system for robots. ROS integrates a large number of tools, libraries, protocols, provides functions similar to those provided by OS, simplifies the control of robots, and provides tools for acquiring, building, and Tools and libraries for writing and running code, ROS is in some ways similar to "Robot Framework",ROS designers describe ROS as "ROS = Plumbing + Tools + Capabilities + Ecosystem", that is, ROS is a collection of communication mechanisms, tool software packages, high-level skills of robots, and robot ecosystems.

insert image description here
First back up the list file of the software source, and then replace it with Tsinghua source.This part mainly speeds up the download and update speed of the software package. There will be no problems in the actual measurement. Of course, if you are afraid of making mistakes, you can directly use the official source

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list

Delete the content of the software source configuration file and copy the following content into the file

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe

After changing the source, update the software package

sudo apt-get update

Add ROS software sources and add keys

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

After changing the source, update the software package

sudo apt-get update

Install ROS. Here we install the melodic version of ROS. The officially recommended ROS versions are: noetic, melodic, kinetic

sudo apt install ros-melodic-desktop-full

First install the relevant tools that build ROS dependencies. These python toolkits will be used to build the subsequent system framework

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

Before using many tools in ROS, the rosdep package is required to be installed first

sudo apt install python3-rosdep

Then initialize rosdep

sudo rosdep init
rosdep update

If you do not surf the Internet scientifically, you may report an error. If you do not have a scientific Internet tool, you can refer to the modification method of the following article

Solution to the failure of rosdep init and rosdep update

Install the software toolkit corresponding to the version of ROS

sudo apt-get install ros-melodic-turtlesim

After configuring the ROS environment variable, you can let the Ubuntu system find it in the future, for example, when you need to use ROS commands

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Open three terminals respectively, one running ROS core master, one running ROS node Turtlesim, and one opening the keyboard control page of ROS little turtle

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

If the little turtle runs successfully, it means that the installation is basically successful
insert image description here


Summarize

The above are the study notes for Jetson nano to install the Ubuntu system and configure the environment, and install ROS at the same time. The blogger tried to install the humble version of ROS2 on the virtual machine Ubuntu during the summer vacation. Relatively speaking, the installation of ROS is relatively easy. Because of the needs of project development, bloggers are learning the deployment of embedded AI technology and ROS to realize the navigation and mapping of robot cars. They need to learn the technology stack related to Slam to realize it. Robot technology is the peak of future technology, waiting for friends who love robot technology to conquer.

Guess you like

Origin blog.csdn.net/m0_55202222/article/details/129911562