====== ROS SETUP ======
[[https://www.ros.org/|ROS]] (Robot Operating System)) is an open source robotics middleware suite, provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. ROS is licensed under an open source, BSD license.
This tutorial is compatible with the **Jetson Nano 4GB**, **Jetson Xavier NX** and **Jetson AGX Xavier**.
Currently (02/21/2021) the recommended ROS distribution for Jetson boards is **ROS Melodic Morenia** because it is optimized to run on **Ubuntu 18 Bionic Beaver**. More current versions of ROS are available as **ROS Noetic Ninjemys** and **ROS 2 Foxy Fitzroy** both for **Ubuntu 20.04 Focal Fossa**. Ubuntu Focal is not yet (02/21/2021) officially CUDA compatible and is not available on Nvidia Jetson boards.
===== ROS installation =====
Open the terminal by pressing ''Ctrl + Alt + T'' or use the application launcher and search for "Terminal".
Setup your //sources.list// to accept software from packages.ros.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Update your Debian package index
sudo apt update
There are many different libraries and tools in ROS, for Jetson boards the recommend is the **ROS-Desktop** package which includes **ROS**, **[[http://wiki.ros.org/rqt|rqt]]**, **[[http://wiki.ros.org/rviz|rviz]]**, and robot-generic libraries. Other ROS packages such as **ROS-Desktop-Full** include 2D and 3D simulation tools which require more storage space and more processing power, these are not necessary in this case.
sudo apt install ros-melodic-desktop
===== Environment variables setup =====
The most convenient way is to add the ROS environment variables to the ''.bashrc'' file so that they are loaded automatically every time a new terminal is launched.
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc && source ~/.bashrc
===== Installation of dependencies =====
to install the dependencies for building ROS packages, run:
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init && rosdep update
At this point ROS is installed and ready to run.
===== Catkin workspace setup =====
To install ROS packages or create our own packages it is necessary to create a **catkin workspace** where the packages will be stored.
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/ && catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
we can check that everything is working correctly by starting the **ROS master** with the command in the terminal.
roscore
Now our Jetson is ready to compile ROS packages that we create ourselves or additional packages that we install.