Derek
Derek A site dedicated interesting things like Machine Learning and Mechatronics

Running Autoware with ADE

Running Autoware with ADE

Autoware.ai and Apex.ai has released this 14 week course on how to use Autoware to create your own self driving car virtually. Autoware is an open source self driving car platform that is based off of ROS2. The course teaches you how to use a x86 computer but does not show you how to use any arm64 computer.

This particular tutorial teaches how to load Autoware on a Jetson TX2 (with the latest Jetpack 4.4). I had a lot of trouble to get everything running so I hope this tutorial will solve some of the roadblock and problems others may encounter. This tutorial should be applicable to other arm based Nvidia products like the Xavier and Drive units (however, I cannot confirm this since I do not own one. I would not mind testing and deploying Autoware if someone is willing to send me one).

Solution

To run Autoware on a Jetson TX2, there are multiple tasks that need to be performed.

  1. Flash the TX2 with the latest JetPack (4.4 as of this article)

  2. Setup Gitlab (unlike Github, you have to have an account before you can clone)

  3. Setup ADE (Autoware Development Environment)

  4. Fix Docker Issues

  5. Deploy Autoware image with ADE

Flash the TX2

The documentation for the TX2 is fragmented and its tough to know what tool to use to flash the TX2. With the current release, the main method to flash your TX2 is with Nvidia’s SDK Manager (compared to the flash bash script originally used). A developer account has to be made before you can download it.

I followed this particular medium article by Constance Xu and this Github page by Chris Wernst (but these instructions is obsoleted). Overall, flashing requires the following step:

  1. Go into recovery mode
    • Press and release the Power Button (furthest to the Right, of the 4 buttons onboard)
    • Hold down the Forced Recovery button (says ‘REC’ on the pcb)
    • With REC held down, press and release the reset button (says ‘RST’ on the pcb)
    • Hold REC for 2 more seconds, and release
  2. Install SDK Manager on any 18.04 Ubuntu system
    • sudo apt-get install ./debian_file
  3. Open the SDK manager and choose the appropriate board under Target Hardware (Jetson TX2 in my case)
  4. Build and Install.
    • The SDK Manager will install the required dependencies on your computer and build the TX2 image and flash it.
    • Before you flash, a window will pop up and ask for the credentials of the board. You need to use an monitor and keyboard/mouse to setup the board first.

Setup Gitlab

Autoware is hosted on Gitlab so you will need to make an account first before setting up.

To Setup Gitlab do the following:

  1. Setup SSH
    • SSH into your board - ssh username@board_hostname
    • Create a SSH key on the board - ssh-keygen -t ed25519 -C "<comment>"
    • Copy the public SSH key into your Gitlab profile - cat ~/.ssh/id_ed25519.pub
    • Test your setup - ssh -T git@gitlab.com
  2. Generate Token
    • Create a personal token with api and read_repository acesss
    • Record this token somewhere safe because the token is displayed only once and you will need it later
  3. Clone Autoware and setup source files
    1
    2
    3
    4
    5
    6
    7
    
    cd
    mkdir adehome && cd adehome
    git clone https://gitlab.com/autowarefoundation/autoware.ai/autoware.git
    cd Autoware
    ren .aderc .aderc-x86
    ren .aderc-arm64 .aderc
    source .aderc
    

Setup ADE

ADE is Autoware Development Environment. It’s a custom tool that deploys all the appropriate Docker images that include Autoware, Atom IDE with the correct setup, and the CUDA libraries. ADE seems easier than deploying the docker image yourself but it was hard to debug what was going on because the documentation was not consistent or existent (due to the fact its in v0.1).

Setup ADE by doing the following:

1
2
3
4
wget https://gitlab.com/ApexAI/ade-cli/uploads/41767a42789c2a18b5e88b9857847091/ade+aarch64
mv ade+aarch64 ade
chmod +x ade
sudo mv ade /usr/local/bin/

Fix Docker Issues

I am not entirely sure why the preinstalled Docker from the SDK manager has problems but the default state of Docker will not be able to run ADE and Autoware correctly. In order to run ADE, a couple of permission and authentication error needs to be fixed.

  1. Fix docker permission
    1
    2
    3
    
    sudo usermod -aG docker $USER
    sudo chmod 666 /var/run/docker.sock
    sudo docker login registry.gitlab.com # Use token from Gitlab
    
  2. Fix Docker json access issue
    1
    2
    3
    
    sudo chown $USER:docker ~/.docker
    sudo chown $USER:docker ~/.docker/config.json
    sudo chmod g+rw ~/.docker/config.json
    

Deploy Autoware image with ADE

You’re almost at the final step! The final part will be to enter the Autoware image using ade.

1
2
3
4
cd ~/adehome/Autoware
source .aderc # One more time for good measures
ade start
ade enter