Getting started with Carla on the Nvidia Jetson Nano Pt1

nvidia Jetson Nano on a 13" Mac Pro

tl;dr; I have not yet managed it… but if you read on you will see where I am currently up to, and where I think I can go.


I am reading the University of Toronto’s “Self-Driving Cars Specialisation“, one of the tutors is Paul Newman from Oxbotica:

Be at the forefront of the autonomous driving industry. With market researchers predicting a $42-billion market and more than 20 million self-driving cars on the road by 2025, the next big job boom is right around the corner.

This Specialization gives you a comprehensive understanding of state-of-the-art engineering practices used in the self-driving car industry. You’ll get to interact with real data sets from an autonomous vehicle (AV) – all through hands-on projects using the open source simulator CARLA.

Throughout your courses, you’ll hear from industry experts who work at companies like Oxbotica and Zoox as they share insights about autonomous technology and how that is powering job growth within the field.

You’ll learn from a highly realistic driving environment that features 3D pedestrian modelling and environmental conditions. When you complete the Specialization successfully, you’ll be able to build your own self-driving software stack and be ready to apply for jobs in the autonomous vehicle industry.

CARLA - An Open Urban Driving simulator
CARLA – An Open Urban Driving simulator

The application CARLA (CAR Learning to Act) has been compiled for both Windows and Linux (mostly Ubuntu), I run a mac, and tried running CARLA in a VirtualBox Virtual machine; despite CARLA explicitly stating that it would not work virtualised, I thought it would be worth a try, however there is a problem with the graphic drivers that I could not overcome, so that didn’t work out 🙁

About CARLA:

CARLA, an open-source simulator for autonomous driving research. CARLA has been developed from the ground up to support development, training, and validation of autonomous urban driving systems. In addition to open-source code and protocols, CARLA provides open digital assets (urban layouts, buildings, vehicles) that were created for this purpose and can be used freely. The simulation platform supports flexible specification of sensor suites and environmental conditions. We use CARLA to study the performance of three approaches to autonomous driving: a classic modular pipeline, an end- to-end model trained via imitation learning, and an end-to-end model trained via reinforcement learning. The approaches are evaluated in controlled scenarios of increasing difficulty, and their performance is examined via metrics provided by CARLA, illustrating the platform’s utility for autonomous driving research.

Recently Tamarisk acquired a nvidia Jetson Nano to try out.

Tamarisk is currently reading a masters in computer science, and the nvidia Jetson Nano is a good single board computer for performing Machine Learning and other processor intensive computational tasks.

CARLA also seems to integrate with ROS (Robot Operating System), So I should be able to use this with SwarmBot 🙂

The recommend hardware for CARLA is:

  • Quad-core Intel or AMD processor, 2.5 GHz or faster
  • NVIDIA GeForce 470 GTX or AMD Radeon 6870 HD series card or higher
  • 8 GB RAM
  • 10GB of hard drive space for the simulator setup

The specification of the Jetson Nano is

  • GPU: 128-core NVIDIA Maxwell™ architecture-based GPU
  • CPU: Quad-core ARM® A57
  • Memory: 4 GB 64-bit LPDDR4; 25.6 gigabytes/second

I am using a 16 32GB micro SD card1, I may run into issues with storage; however I can use a USB stick to increase local storage, and symlink the $home folder to a USB stick if required.

Nice Case

I printed a nice case for the nvidia Jetson Nano, I found this one in Thingiverse:

Setting up a Jetson Nano
Setting up a Jetson Nano

To Get CARLA working on nvidia Jetson Nano:

  • Download the Ubuntu image from the download link.
  • Follow the guide from the Official nvidia page to get the nvidia Jetson nano set up.
    • If using a Mac with OS X 10.15 on it you may need to run balenaEtcher using the following from the terminal:
      sudo /Applications/balenaEtcher.app/Contents/MacOS/balenaEtcher
  • Because I was having issues with the wired network connection, I plugged in a generic wifi USB stick, as well as a keyboard, mouse and HDMI monitor.
  • Once the Jetson has booted for the first time plugged into a monitor, keyboard and mouse, you will want to run the following in a terminal:
    sudo su
    apt remove --purge libreoffice-* totem thunderbird shotwell aisleriot cheese evince 
    apt dist-upgrade
    apt update
    apt upgrade
    reboot
    sudo su
    apt --purge autoremove
    exit
    • I am doing the terminal parts using SSH from my mac as it allows me to use my mac to keep an eye on everything.
      ssh [email protected]
    • There is a guide at Zafer ARICAN on how to get more free ram by changing the window manager.
  • Because CARLA and the Jetson works better in a GUI (Graphical User Interface)
    • I am yet to get any working VNC connection on my Jetson Nano.
  • Download the CARLA simulator (PDF Instructions for installing CARLA on Ubuntu):
    1. Download CarlaUE4Ubuntu.tar.gz​23 The CARLA simulator used here is a ​modified binary of the version 0.8.4 CARLA​. There are additional maps included as well as the default vehicle model is modified for the purpose of better demonstrating concepts taught in the courses. While it is encouraged to perform your own compilation and installation of CARLA to learn more about the simulator, the course itself must use the provided binaries to evaluate the course assignments.
      wget -c "https://skippy.org.uk/wp-content/uploads/2019/09/CarlaUE4Ubuntu.tar.gz" -O CarlaUE4Ubuntu.tar.gz
      md5sum CarlaUE4Ubuntu.tar.gz
    2. Extract the contents of CarlaUE4Ubuntu.tar.gz
      mkdir -p ~​/opt ​
      tar -vxf CarlaUE4Ubuntu.tar.gz -C ​~/​opt/

      The extraction will create a folder named in the working directory, which hosts the CARLA server and client files required for the projects.

    3. sudo apt install apt-utils python3-pip cmake libfreetype6-dev libfontconfig1-dev xclip libsdl1.2-dev build-essential clang-7 lld-7 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
      sudo apt install clang-3.9 libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev   libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev
      sudo apt install libblas3 liblapack3 liblapack-dev libblas-dev gfortran nano
      pip3 install --user numpy
      pip3 install --user setuptools
      python3 -m pip install -r ~/opt/CarlaSimulator/requirements.txt --user
    4. At this point I found that Carla’s binaries are not compiled for Arm64… As such I need to compile my own. However everything above is not wasted, as we have the prerequisites for the course, and the dependencies for CARLA now on the system

Unreal Engine

Unreal Engine repositories are set to private. In order to gain access you need to add your GitHub username when you sign up at www.unrealengine.com.

  1. Download and compile Unreal Engine 4.22.
    git clone --depth=1 -b 4.22 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.22
    cd ~/UnrealEngine_4.22
  2. Mono
    sudo apt install mono-devel
    cd ~/UnrealEngine_4.22/Engine/Binaries/ThirdParty/Mono/Linux/bin
    rm mono
    ln -s /usr/bin/mono mono
    cd ../lib
    rm -r mono
    ln -s /usr/lib/mono mono
  3. cd ~/UnrealEngine_4.22
    ./Setup.sh

    You will be asked ‘Would you like to overwrite your changes’ the answer is no.

This is the point I get stuck, and looking around this is the same point as everyone gets stuck… so at the moment it looks like there is no easy way to compile Unreal Engine for the ARM64. There seems to be some progress with getting it working on Raspberry Pi, so after I get back from Holiday I will re-visit.

  1. There is not enough free space at the end of the disk to use a 16GB and install CARLA. The disk image as installed is 13 GB
  2. that this may take a while as the simulator file is several gigabytes in size – The MD5 hash for it should be “d8c5737161387ea454fdeeed8e763f59”
  3. Details for this can be found here, should the link break

Leave a Reply

%d bloggers like this: