JetsonHacks

Developing on NVIDIA® Jetson™ for AI on the Edge

Robot Operating System (ROS) on NVIDIA Jetson AGX Xavier Developer Kit

For robotics application, one of the leading set of tools is Robot Operating System (ROS). The version of ROS that runs on the Jetson AGX Xavier is ROS Melodic. Installing ROS on the Jetson Xavier is simple. Looky here:

Background

ROS was originally developed at Stanford University as a platform to integrate methods drawn from all areas of artificial intelligence, including machine learning, vision, navigation, planning, reasoning, and speech/natural language processing.

From 2008 until 2013, development on ROS was performed primarily at the robotics research company Willow Garage who open sourced the code. During that time, researchers at over 20 different institutions collaborated with Willow Garage and contributed to the code base. In 2013, ROS stewardship transitioned to the Open Source Robotics Foundation.

From the ROS website:

The Robot Operating System (ROS) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms.

Why? Because creating truly robust, general-purpose robot software is hard. From the robot’s perspective, problems that seem trivial to humans often vary wildly between instances of tasks and environments. Dealing with these variations is so hard that no single individual, laboratory, or institution can hope to do it on their own.

Core Components

At the lowest level, ROS offers a message passing interface that provides inter-process communication. Like most message passing systems, ROS has a publish/subscribe mechanism along with request/response procedure calls. An important thing to remember about ROS, and one of the reason that it is so powerful, is that you can run the system on a heterogeneous group of computers. This allows you to distribute tasks across different systems easily.

For example, you may want to have the Jetson running as the main node, and controlling other processors as control subsystems. A concrete example is to have the Jetson doing a high level task like path planning, and instructing micro controllers to perform lower level tasks like controlling motors to drive the robot to a goal.

At a higher level, ROS provides facilities and tools for a Robot Description Language, diagnostics, pose estimation, localization, navigation and visualization.

You can read more about the Core Components here.

Installation

There is a repository on the JetsonHacks account on Github named installROSXavier.
The main script, installROS.sh, is a straightforward implementation of the install instructions taken from the ROS Wiki. The instructions install ROS Melodic on the Jetson Xavier.

You can clone the repository on the Jetson:

$ git clone https://github.com/jetsonhacks/installROSXavier.git
$ cd installROSXavier

installROS.sh

The install script installROS.sh will install the prerequisites and ROS packages specified. Usage:

Usage: ./installROS.sh  [[-p package] | [-h]]
 -p | --package <packagename>  ROS package to install
                               Multiple Usage allowed
                               The first package should be a base package. One of the following:
                                 ros-melodic-ros-base
                                 ros-melodic-desktop
                                 ros-melodic-desktop-full
 

Default is ros-melodic-ros-base if no packages are specified.

Example Usage:

$ ./installROS.sh -p ros-melodic-desktop -p ros-melodic-rgbd-launch

This script installs a baseline ROS environment. There are several tasks:

  • Enable repositories universe, multiverse, and restricted
  • Adds the ROS sources list
  • Sets the needed keys
  • Loads specified ROS packages (defaults to ros-melodic-base-ros if none specified)
  • Initializes rosdep

You can edit this file to add the ROS packages for your application.

setupCatkinWorkspace.sh

setupCatkinWorkspace.sh builds a Catkin Workspace.

Usage:

$ ./setupCatkinWorkspace.sh [optionalWorkspaceName]

where optionalWorkspaceName is the name and path of the workspace to be used. The default workspace name is catkin_ws. If a path is not specified, the default path is the current home directory. This script also sets up some ROS environment variables.

The script sets placeholders for some ROS environment variables in the file .bashrc
.bashrc is located in the home directory. The names of the variables are (they should be towards the bottom of the .bashrc file):

  • ROS_MASTER_URI
  • ROS_IP

The script sets ROS_MASTER_URI to the local host, and basically lists the network interfaces after the ROS_IP entry. You will need to configure these variables for your robots network configuration. Refer to the script for further details.

Notes

  • In the video, the Jetson AGX Xavier was flashed with L4T 31.0.2 using JetPack 4.1. L4T 31.0.2 is an Ubuntu 18.04 derivative.
Facebook
Twitter
LinkedIn
Reddit
Email
Print

16 Responses

  1. Is there Any way to go around this error?
    using gazebo;

    gzclient: symbol lookup error: /usr/lib/aarch64-linux-gnu/libavdevice.so.57: undefined symbol: drmModeFreeFB

      1. it is different from your search. Have you tried it on a machine? Does this solve the issue? No. I tried it a month ago and that thread on forum is unrelated to the core of the problem.

        If it works, could you send a screenshot link here as reply?

        1. $ sudo apt_get install libgazebo9-dev
          $ sudo rm /usr/lib/aarch64-linux-gnu/libdrm.so.2
          $ sudo -H ln -s /usr/lib/aarch64-linux-gnu/libdrm.so /usr/lib/aarch64-linux-gnu/libdrm.so.2

          Works for me.
          Did you try that exactly and it does not work?
          You can follow the thread on the Jetson AGX Forum: https://devtalk.nvidia.com/default/topic/1042381/jetson-agx-xavier/problem-with-gazebo-/post/5287315/#5287315
          Other people have gotten it to work with described workaround.

  2. This appears to be an issue with some of the symbolic links. Try:

    $ sudo rm /usr/lib/aarch64-linux-gnu/libdrm.so.2
    $ sudo -H ln -s /usr/lib/aarch64-linux-gnu/libdrm.so /usr/lib/aarch64-linux-gnu/libdrm.so.2

    Note that this will probably be changed later in the release cycle

  3. That changes with release as Nvidia does not want to support ffmpeg officially. Your suggestion is a weak solution. Once upgraded to new jetpack, other problems might arise as well.

    The gazebo works well if ffmpeg is installed from source and replace affected dynamic libraries with the previous ones. gazebo 8 just works on old ffmpeg libraries. that is another problem too.

    1. Thank you for sharing your opinion. You forgot to point out that L4T 31.0.2 is a developers preview, which means that it is not released software. The point of the developers preview is to provide developers early access, and find issues before the software ships. This appears to be an issue.

  4. Hi evryone I am building an agricultural Robot with a less price but good components , Which card have I to chose beetween the TX1 , TX2 , Xavier and multiple Jetson nano ?

    Thanks

  5. Hi,
    I attempted to run the scripts on NVIDIA Jetson AGX Xavier, with the latest available Jetpack (Ubuntu 20.04.6 LTS (GNU/Linux 5.10.216-tegra aarch64)), and it didn’t work. The log follows.

    It would be nice if I could use my Jetson for a robotic project, if there is a solution.

    Thank you,
    Nikos
    ======

    Here is how it goes:

    ./installROS.sh -p ros-melodic-desktop
    Packages to install: ros-melodic-desktop
    Adding repository and source list
    ‘universe’ distribution component is already enabled for all sources.
    ‘multiverse’ distribution component is already enabled for all sources.
    ‘restricted’ distribution component is already enabled for all sources.
    Executing: /tmp/apt-key-gpghome.gBGNC0V07R/gpg.1.sh –keyserver hkp://keyserver.ubuntu.com:80 –recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
    gpg: key F42ED6FBAB17C654: “Open Robotics ” not changed
    gpg: Total number processed: 1
    gpg: unchanged: 1
    Updating apt-get
    Get:1 https://repo.download.nvidia.com/jetson/common r35.6 InRelease [2,555 B]
    Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease
    Get:3 https://repo.download.nvidia.com/jetson/t194 r35.6 InRelease [2,550 B]
    Hit:4 https://repo.download.nvidia.com/jetson/ffmpeg r35.6 InRelease
    Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
    Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
    Hit:7 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
    Hit:8 https://esm.ubuntu.com/apps/ubuntu focal-apps-security InRelease
    Hit:9 https://esm.ubuntu.com/apps/ubuntu focal-apps-updates InRelease
    Hit:10 https://esm.ubuntu.com/infra/ubuntu focal-infra-security InRelease
    Hit:11 https://esm.ubuntu.com/infra/ubuntu focal-infra-updates InRelease
    Hit:12 https://esm.ubuntu.com/ros/ubuntu focal-security InRelease
    Hit:13 http://packages.ros.org/ros/ubuntu focal InRelease
    Fetched 5,105 B in 8s (671 B/s)
    Reading package lists… Done
    Installing ROS
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package ros-melodic-desktop
    Installing rosdep
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package python-rosdep is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘python-rosdep’ has no installation candidate
    Initializaing rosdep
    sudo: rosdep: command not found
    ./installROS.sh: line 132: rosdep: command not found
    Installing rosinstall tools
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package python-rosinstall is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    python3-rosinstall

    Package python-rosinstall-generator is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    python3-rosinstall-generator

    Package python-wstool is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    python3-wstool

    E: Package ‘python-rosinstall’ has no installation candidate
    E: Package ‘python-rosinstall-generator’ has no installation candidate
    E: Package ‘python-wstool’ has no installation candidate
    Installation complete!

    1. I believe that ROS Melodic is for version 18.04, ROS Noetic is for 20.04. They don’t have ROS Bionic in the Ubuntu 20.04 repository. You can apt search for ‘noetic’ to make sure it’s there. Thanks for reading!

Leave a Reply

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

Disclaimer

Some links here are affiliate links. If you purchase through these links I will receive a small commission at no additional cost to you. As an Amazon Associate, I earn from qualifying purchases.

Books, Ideas & Other Curiosities