Follow the instructions at https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write to install the operating system to the Jetson Nano. Make sure to finish the installation process, e.g. setting the timezone and creating a user account.
Upgrade the system and automatically remove unnecessary packages
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
Before starting the installation process, please ensure that git
and python3-pip
are installed.
sudo apt install nano git python3-pip
Because the standard Jetson Nano operating system comes with a lot of tools which won't be used, we can save valuable space and resources by removing them.
sudo apt purge snapd lx* nautilus* openbox* printer* rhythmbox* gnome* lightdm* xubuntu* xscreensaver* xfce* lxde* x2go* word* thunderbird libreoffice* chromium-* vim* docker* libvisionworks* ubuntu-wallpapers-bionic light-themes adwaita-icon-theme -y && sudo apt autoremove -y
This command will strip the operating system of most unnecessary packages. Please read the command before executing to avoid removing necessary packages.
Clone the project from the GitHub repository.
git clone https://github.com/sieuwe1/Autonomous-Ai-drone-scripts.git
Start by installing the required packages for the installation process.
sudo apt install cmake libpython3-dev python3-numpy
Execute the following commands in sequence to install Jetson Inference.
During the installation, make sure to deselect all models and finally select the
SSD MobileNet V2
model. After the download has completed, please also install PyTorch.
git clone --recursive https://github.com/dusty-nv/jetson-inference
cd jetson-inference
mkdir build
cd build
cmake ../
make -j$(nproc)
sudo make install
sudo ldconfig
Source: https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md
python3 -m pip install --upgrade pip
python3 -m pip install scikit-build cmake opencv-python numpy dronekit pyserial keyboard simple-pid
For viewing sensors, media and other things with a graphical user interface, we can use X11 forwarding to forward the interfaces over SSH.
Enable X11 forwarding in the sshd
configuration file.
sudo nano /etc/ssh/sshd_config
Look for a parameter called X11Forwarding
, ensure that the value is set to yes
. It should look like this.
X11Forwarding yes
To connect to the Jetson Nano with X11 support, use the following command:
ssh -X -Y USERNAME@IP
A common use case for X11 within the drone project is to watch back debugging videos. To review debugging videos from the drone via X11, you can use the mplayer
package, which is a lightweight media player.
Install mplayer
sudo apt install mplayer
Example of mplayer
usage
mplayer video.mp4
Clone the simulator from ArduPilot from the GitHub repository.
git clone https://github.com/ArduPilot/ardupilot --recursive
cd ardupilot
Source: https://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux
Before executing the prerequisite installation script from ArduPilot, please install some additional packages.
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev python3-setuptools python3-dev python3 libportmidi-dev
After that, install all prerequisites using the tool from ArduPilot by executing the following command:
Tools/environment_install/install-prereqs-ubuntu.sh -y
Reload the path (log-out and log-in to make permanent).
. ~/.profile
Before building, ensure that the project is configured.
./waf configure
After the project is configured, build the project.
./waf clean
./waf build
Ensure that the current directory is the scripts directory.
cd Tools/scripts
Start the simulator for a ArduCopter
sim_vehicle.py -v ArduCopter --map --console
Finish by removing all unused packages.
sudo apt autoremove -y