How to Install ROS Melodic on the NVIDIA Jetson Nano

cover-ros-melodic

In this tutorial, I will show you everything you need to know to install ROS Melodic on the NVIDIA Jetson Nano. The official tutorial is here and my quick tutorial is here, but I will run through all the steps below.

Prerequisites

You have set up your NVIDIA Jetson Nano Developer Kit.

Directions

In the Start Menu, go to Preferences -> Software & Updates. Then click on it.

Make sure main, universe, restricted, and multiverse are all checked. Then close the window.

2021-04-02-140620

Now open up a new terminal window, and type (or copy and paste) the following command:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

The command above sets your computer up to accept software from packages.ros.org. 

Now we need to set up the secure keys so that our system accepts what we are going to download. 

For the next step, update the package list on your system.

sudo apt update

Now type:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Now do a full desktop install of ROS. The command below installs all the software, tools, algorithms, and robot simulators for ROS. After you type the command and press Enter, press Y and hit Enter when asked if you want to continue. It will take a while to download all this stuff, so feel free to take a break while ROS downloads to your system.

sudo apt-get update
sudo apt install ros-melodic-desktop-full

Type Y and press Enter to complete the installation.

Set up the environment variables.

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

Note that anytime you want to see what environment variables ROS is using, you can type the following command:

export | grep ROS

This command will show you the ROS distribution you are using, the version of Python ROS is using, and a bunch of other stuff.

The two key variables are as follows:

ROS_MASTER_URI: Shows the URL where the roscore is in execution. This is often your own local computer.

ROS_PACKAGE_PATH: Shows the path on your computer where the ROS packages are.

Install some other tools that you will work with in ROS. After you type the command below, press Y and Enter to complete the download process.

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

Press Y and hit Enter.

Now initialize rosdep. This is a tool that is required before you can use ROS.

sudo apt install python-rosdep
sudo rosdep init
rosdep update

Here is the last step of the installation process. Check which version of ROS you have installed. If you see your ROS version as the output, congratulations you have successfully installed ROS!

rosversion -d
2021-04-02-144436