Skip to content

Build setup

Zichong Li edited this page Feb 15, 2023 · 1 revision

All robots need to be pre-flashed with our custom Image before any deployment. Once you have done that, you can clone the NomadZ repository with:

git clone https://github.com/nomadz-ethz/nomadz-code-release.git

Once you have successfully cloned the NomadZ repository onto your machine the next step is to setup the build configuration. To start working with the code base you first need to install multiple packages, and setup the toolchains to compile for the robot as described below.

Installing dependencies

To install everything except OpenCV and Qt the following should work (please edit if other dependencies are required)

Common system dependencies

sudo apt-get install \
    build-essential \
    git \
    git-lfs \
    cmake \
    ccache \
    ninja-build \
    libeigen3-dev \
    libboost-all-dev \
    libjpeg62-dev \
    liblapack-dev \
    libxml2-dev \
    libglew-dev \
    gfortran \
    libasound2-dev \
    libmsgpack-dev \
    libharfbuzz-dev \
    libfreetype6-dev

GFortran

Ubuntu 18.04 and 20.04
sudo apt install libgfortran-8-dev
Ubuntu 22.04
sudo apt install libgfortran-9-dev

Installing Qt

Ubuntu 18.04
sudo apt-get install qt4-default
Ubuntu 20.04
sudo apt-get install qt5-default libqt5svg5-dev qttools5-dev
Ubuntu 22.04
sudo apt-get install qtbase5-dev qt5-qmake qttools5-dev libqt5svg5-dev

Install OpenCV

If you have already OpenCV 4 installed on your system, you can skip this step. To check that, you can use the command opencv_version:

opencv_version

If this returns something like bash: opencv_version: command not found, then you don't have OpenCV installed. Otherwise, it will return which version of OpenCV you have installed on your system. If this is lower than 4.2.0, please install a version equal or higher from source.

Configure the RoboCup Yocto SDK

NOTE: This installs a custom 64-bit SDK, the standard 32-bit SDK should not be used anymore.

Follow the step below to install the SDK:

  1. Download the latest SDK for the V6 from here. It is a shell script that will create the toolchain to cross-compile this project for the NAO's CPU. Your browser may warn you it might be malicious code and request you to approve the download twice, it's ok.
  2. Run the downloaded nomadz-nao-os-toolchain.sh script:
sh nomadz-nao-os-toolchain.sh

and choose the final path to install it (it needs roughly 6.5 GB). Do NOT move it afterwards! Once the installation is complete, you may remove nomadz-nao-os-toolchain.sh.

Building the code

You can either configure VS Code to do this or build the code manually from the command line. If you do not have a preferred text editor that you are comfortable with, using VSCode is highly recommended.

Note: you only have to choose one of the following two options!

Building from the command line

  1. Clone the repository:
git clone https://github.com/nomadz-ethz/nomadz-code-release.git --recurse-submodules
  1. Create directory Build/Host from the root of the NomadZ repository:
cd nomadz-code-release
mkdir -p Build/Host
  1. Run cmake -DNOMADZ_TARGET=host -DYOCTO_SDK=<yocto_sdk_path> ../../ from the path created above, replacing <yocto_sdk_path> with the path where the directory yocto-sdk from step 1 is located. WARNING: it is important to pass a complete absolute path here, you cannot use ~ as shortcut for the home directory. You can find the abs. path of the yocto SDK find by navigating to the directory yocto-sdk from step 1) and executing pwd from a terminal. So for instance if you install the yocto SDK at "/home/user/yocto-sdk", then run:
cd Build/Host
cmake -G Ninja -DNOMADZ_TARGET=host -DYOCTO_SDK=/home/user/yocto-sdk ../../
  1. Run ninja -j<parallel_threads>