Skip to content

Instantly share code, notes, and snippets.

@Pyrestone
Created December 23, 2021 11:16
Show Gist options
  • Save Pyrestone/ef683aec160825eee5c252f22218ddb2 to your computer and use it in GitHub Desktop.
Save Pyrestone/ef683aec160825eee5c252f22218ddb2 to your computer and use it in GitHub Desktop.
ROS Noetic Install on NVIDIA Jetson Nano (Ubuntu 18.04)

ROS Noetic Install on jetson nano (Ubuntu 18.04)

This guide is derived from the official Noetic setup page, which can be found here: http://wiki.ros.org/noetic/Installation/Source

This version includes some customizations for missing packages on Ubuntu 18.04 which the jetson nano OS uses. I think this installation should work on most ubuntu 18.04 installations, but I can give no guarantees.

System and python dependencies

sudo apt install build-essential
sudo -H python3 -m pip install -U pip
sudo -H python3 -m pip install -U setuptools
sudo -H python3 -m pip install -U rosdep rosinstall_generator vcstool


sudo rosdep init
rosdep update

mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws

Generate rosinstall file

Note: the default says desktop here, but i don't want all the GUI stuff, so i use the robot and perception packages instead

rosinstall_generator robot perception --rosdistro noetic --deps --tar > noetic-robot-perception.rosinstall
mkdir ./src
vcs import --input noetic-robot-perception.rosinstall ./src

Install ros packages

rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y -r

# not sure if this is necessary:
sudo -H python3 -m pip install -U catkin_pkg

# again not sure if necessary:  
sudo apt install liborocos-kdl-dev

for compilation error about cv_bridge not finding boost:

nano ./src/vision_opencv/cv_bridge/CmakeLists.txt

# change: 
find_package(Boost REQUIRED python37)
# to:
find_package(Boost REQUIRED python3)

Build ros packages

sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 --install-space /opt/ros/noetic

(optional) add setup.bash to bashrc so it's automatically loaded on the start of a terminal session

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
@oscar-lima
Copy link

If you experience the error:

error: option --install-layout not recognized

based on information from : ros/catkin#863 adding the flag -DSETUPTOOLS_DEB_LAYOUT=OFF solves the issue.

The full command is:

sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 --install-space /opt/ros/noetic -DSETUPTOOLS_DEB_LAYOUT=OFF

@patricknks
Copy link

Hi, is it should be :

rosinstall_generator robot perception --rosdistro noetic --deps --tar > noetic-robot-perception.rosinstall
mkdir ./src
vcs import --input noetic-robot-perception.rosinstall ./src

Or, can I use the desktop version instead?

rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall
mkdir ./src
vcs import --input noetic-desktop.rosinstall ./src

@Pyrestone
Copy link
Author

@patricknks

can I use the desktop version instead?

yes. This should probably work.

The filename of the .rosinstall file should not need to be the same as the packages you're selecting, so technically the only change necessary would be the rosinstall_generator line.

you can also just add the desktop package to the ones I listed, i.e. do: rosinstall_generator robot perception desktop --rosdistro noetic ..., which should also install the desktop components.

I have my nano in a headless configuration, so I don't need components such as rviz, but you can absolutely add that to your config and see what happens.
If you do, please report back if it works :)

@patricknks
Copy link

After running rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y -r, I got some error messages like:

apt: command [sudo -H apt-get install -y python3-rospkg-modules] failed
apt: command [sudo -H apt-get install -y python3-catkin-pkg-modules] failed
apt: command [sudo -H apt-get install -y python3-rosdep-modules] failed
apt: Failed to detect successful installation of [python3-rospkg-modules]
apt: Failed to detect successful installation of [python3-catkin-pkg-modules]
apt: Failed to detect successful installation of [python3-rosdep-modules]

Previously, I changed update-alternatives for python3 (3.6 -> 3.9), have you encounter this kind of problem? I'm using the latest Jetpack 4.6.1 btw.

@dfiel
Copy link

dfiel commented Mar 24, 2022

apt: command [sudo -H apt-get install -y python3-rospkg-modules] failed
apt: command [sudo -H apt-get install -y python3-catkin-pkg-modules] failed
apt: command [sudo -H apt-get install -y python3-rosdep-modules] failed
apt: Failed to detect successful installation of [python3-rospkg-modules]
apt: Failed to detect successful installation of [python3-catkin-pkg-modules]
apt: Failed to detect successful installation of [python3-rosdep-modules]

@patricknks I am running into these same issues. Did you find a fix?

@emanuelazfernandes
Copy link

emanuelazfernandes commented Apr 21, 2022

My build gets always stuck on perception_pcl/pcl_ros at 48%, eventually crashes.

@Matt-Tav
Copy link

Matt-Tav commented Aug 8, 2022

@patricknks @dfiel, and anyone else who encounters this -

That problem is resolved by adding the ros noetic package sources, as described by the ros noetic installation: http://wiki.ros.org/noetic/Installation/Ubuntu (make sure to also add the key).

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

You may encounter some issues still with the packages not installing due to issues with (I think) overlapping install paths. You can fix this with dpkg, something like this: sudo dpkg -i --force-overwrite 'path to deb specified by apt errors'

@patricknks
Copy link

patricknks commented Aug 11, 2022

Hi @dfiel and to anyone else, I ended up using ROS Melodic on my Jetson Nano with NVIDIA Jetpack 4.6.1 . I feel this is the better way, because noetic was developed for Ubuntu Focal (20.4). And of course each software or libraries for my project have to be adjusted to fulfill some requirements from others.

The reason why at first I wanted to use ROS Noetic is because we got OpenCV4 inside Jetpack 4.6.1. Thus, to make OpenCV4 works just fine with ROS Melodic I edited a line in cv_bridgeConfig.cmake. You can see the details here ros-perception/vision_opencv#345

@Matt-Tav
Copy link

Hi @dfiel and to anyone else, I ended up using ROS Melodic on my Jetson Nano with NVIDIA Jetpack 4.6.1 . I feel this is the better way, because noetic was developed for Ubuntu Focal (20.4). And of course each software or libraries for my project have to be adjusted to fulfill some requirements from others.

The reason why at first I wanted to use ROS Noetic is because we got OpenCV4 inside Jetpack 4.6.1. Thus, to make OpenCV4 works just fine with ROS Melodic I edited a line in cv_bridgeConfig.cmake. You can see the details here ros-perception/vision_opencv#345

Yeah I think compiling melodic with python3 and the opencv patch is probably the better approach in the end

@coxep
Copy link

coxep commented Oct 27, 2022

My build gets always stuck on perception_pcl/pcl_ros at 48%, eventually crashes.

I had this issue to when building perception. I was using default user for Xavier (nvidia or ubuntu), each of which appears to have 1K stack allocated. pcl_ros (and RViz) both seem to take more than this, and you'll get the dreaded "internal compiler error" failures.

The solution is to increase the stack to 8K, or alternatively, create a new user on the Xavier (new users aren't limited to 1K stack for some reason...)

@Barsay
Copy link

Barsay commented Jan 13, 2023

==> Processing catkin package: 'genpy'
==> Building with env: '/opt/ros/noetic/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/home/thomas/ros_catkin_ws/build_isolated/genpy'
make: *** No rule to make target 'cmake_check_build_system'.  Stop.
<== Failed to process package 'genpy':
  Command '['/opt/ros/noetic/env.sh', 'make', 'cmake_check_build_system']' returned non-zero exit status 2.

Seems like it isn't able to install this genpy package. Any idea on why this happens?

@dataplayer12
Copy link

Thanks for the guide. If anyone else is struggling with failing build on pcl_ros like @emanuelazfernandes, increase swap size to 8 GB and try again.

@kanishkanarch
Copy link

You may encounter some issues still with the packages not installing due to issues with (I think) overlapping install paths. You can fix this with dpkg, something like this: sudo dpkg -i --force-overwrite 'path to deb specified by apt errors'

@Matt-Tav, What deb file are you talking about? Where do I find it in this tutorial?

@Matt-Tav
Copy link

Matt-Tav commented May 7, 2023

@kanishkanarch >

This is only relevant if you are seeing apt errors when you run apt update or something, don't worry about it if you're not seeing any

@kanishkanarch
Copy link

I got these errors in the rosdep install ... command

@kanishkanarch
Copy link

Oh wait, I forgot to setup the keys from ROS installation.

@kanishkanarch
Copy link

image
Even after setting up keys I got these installation errors originally mentioned.

@Matt-Tav
Copy link

Matt-Tav commented May 7, 2023

image Even after setting up keys I got these installation errors originally mentioned.

Did you run this command from my comment? This is exactly what you see when you haven't run the command. The errors I mention later are associated with fixing apt if you run the rosdep install without first adding the key and ppa repository, which it looks like you might have done.

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

@kanishkanarch
Copy link

Yes, I ran the command sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' and setup the key, but I'm still getting same errors.

@Matt-Tav
Copy link

Matt-Tav commented May 7, 2023

Yes, I ran the command sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' and setup the key, but I'm still getting same errors.

You may need to run apt update then try rosdep install again - if that doesn't work I'm not sure what's wrong and it may be a different issue:(

@kanishkanarch
Copy link

Ah yes, thanks that worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment