Installing ROS2 on a Jetson Nano

Using Jetpack 4.4 which runs Ubuntu 18.04. We install ROS2 Foxy. I tried Humble but it requires 20.04 or later. I’m not sure about Galactic.

Initial system updates
sudo curl -sSL -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update
Update CMAKE


sudo apt remove --purge --auto-remove cmake
wget -O - 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository "deb $(lsb_release -cs) main"
sudo apt update
sudo apt install kitware-archive-keyring
sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
sudo apt install cmake
Install prerequisite packages
sudo apt-get install -y --no-install-recommends build-essential cmake git libbullet-dev libpython3-dev python3-colcon-common-extensions python3-flake8 python3-pip python3-pytest-cov python3-rosdep python3-setuptools python3-vcstool python3-rosinstall-generator libasio-dev libtinyxml2-dev libcunit1-dev
Install some pip packages needed for testing
python3 -m pip install -U argcomplete flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes pytest-repeat pytest-rerunfailures pytest

Compile yaml-cpp-0.6, which some ROS packages may use (but is not in the 18.04 apt repo)

git clone --branch yaml-cpp-0.6.0 yaml-cpp-0.6
cd yaml-cpp-0.6
mkdir build
cd build
make -j$(nproc)
sudo cp /usr/lib/aarch64-linux-gnu/
sudo ln -s /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/
Create a workspace and clone all repos
mkdir -p ~/ros2_foxy/src
cd ~/ros2_foxy
vcs import --input src
sudo sh -c 'echo "deb `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget -O - | sudo apt-key add -
sudo apt update
sudo apt install libignition-math6-dev
Generate distro
sudo sh -c "rosinstall_generator --deps --rosdistro foxy ros_base launch_xml launch_yaml example_interfaces > ros2.foxy.ros_base.rosinstall && cat ros2.foxy.ros_base.rosinstall && vcs import src < ros2.foxy.ros_base.rosinstall"
Install dependencies (Foxy)
cd ~/ros2_foxy
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro foxy -y --skip-keys "console_bridge fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers qt_gui"
Build distro
cd ~/ros2_foxy
sudo mkdir -p /opt/ros/foxy
sudo colcon build --merge-install --install-base /opt/ros/foxy

Leave a Comment

Your email address will not be published. Required fields are marked *