Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Getting Started

seanharris edited this page Dec 22, 2014 · 5 revisions

Robot Setup

Initial robot setup instructions can be found [here] (Robot Setup).

Setting up your OS

The OS that currently works without any problems or further changes is Ubuntu 12.04 32-bit (the long-term release one). Use anything else at your own risk!

You can run the OS natively on its own partition, or in a VM, although initial setup of networking on the VM will be a bit fiddly. On Windows, good VM's are VMWare Workstation (which CSE students get for free) and VirtualBox.

Setting up a github account

  • Create yourself a github account: https://github.com/signup/free

  • Install your ssh public key into your github account at https://github.com/account/ssh.

    Note: If you don't have one you can make one by running: "ssh-keygen -t rsa" (without ") The key will be placed in ~/.ssh/id_rsa.pub

  • Set up your git settings to correspond to your github account

    git config --global user.name "Firstname Lastname"

    git config --global user.email "[email protected]"

Setting up the build environment

Before you begin you need to have a few dependencies installed namely: cmake and developer versions of zlib & glib. Try:

apt-get install cmake zlib1g-dev libglib2.0-dev

Get our repository and run the build script by copy and pasting the following:

git clone [email protected]:UNSWComputing/rUNSWift2014CodeRelease.git runswift
cd runswift
bin/build_setup.sh

This will:

  • Set up your .bashrc with some robocup environment variables.
  • Add your ssh key to the image on the robots.
  • Download the cross toolchain (CTC) and generate some Makefiles.
  • Do an initial release and debug build.

This can take a long time, maybe half an hour, so now is a good time to go do something else.

Note: On a 64 bit machine you will need to install the 32 bit versions of a whole bunch of libraries. In arch you will need to enable multilib in /etc/pacmac.conf.

# For example on Debian
dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386 zlib1g:i386 libstdc++6:i386 libbz2-1.0:i386 libfreetype6:i386 libglib2.0-0:i386 libsm6:i386 libxrandr2:i386 libfontconfig1:i386

# On Ubuntu
sudo apt-get install libc6-i386 lib32z1-dev libstdc++6:i386 libbz2-1.0:i386 libfreetype6:i386 libglib2.0-0:i386 libsm6:i386 libxrandr2:i386 libfontconfig1:i386

I have found that if the script fails once e.g. with the message: Unknown CMake command "qi_persistent_append_uniq". You can possibly rerun the script and for some reason it works the second time.

Setting up an Eclipse IDE Project

You can edit the code from Eclipse CDT. The benefit is it is easier to navigate around the code and you get pre-compiled error warnings as you write the code. The steps are:

  • Download and install Eclipse CDT (http://www.eclipse.org/downloads/ choose the Eclipse for C/C++ Developers).
  • Run eclipse CDT.
  • Choose File - Import - C/C++ Existing Code as Makefile Project - Select Linux GCC as Toolchain - Choose the runswift code project path
  • Done!

Syncing with the robot

The basic command is:

nao_sync <args> <robotname>

or

nao_sync <args> -b build-relwithdebinfo <robotname>

The first is for normal execution, the second is if you want debugging symbols (it will sync from the build-relwithdebinfo directory instead, so make sure you run 'make' there instead of in your build-release directory). You should learn more about the other nao_sync flags with nao_sync --help. Typically, you will run nao_sync -r apollo to sync runswift to the robot named "apollo".

Running the code

You can either:

  • ssh into the robot with ssh [email protected] and run the 'runswift' command, or
  • Load runswift by triple tapping the robot's chest

Either way, after doing this you will need to double tap the chest to make it stiffen its body, and then toggle to penalized/playing modes with single taps of the chest.

There is more information on the button press interface and indicator lights at Button Presses For Nao.

Summary

So basically, from now on your build process will be something like:

  1. <Make changes to code>
  2. cd build-release; make;
  3. nao_sync -r tank
  4. Launch the robot through button presses

Changing to Debug Build (or changing build type generally)

If you want a build type other than the defaults (like a full debug build), you can change the build type using the below command. Changing "Debug" to "Release" will create a release build, etc. Note that if you have used the 2014 version of build_setup.sh, you already have a RelWithDebInfo build directory (will have some debug info, but line numbers may not match up exactly).

cmake .. -DCMAKE_TOOLCHAIN_FILE="$RUNSWIFT_CHECKOUT_DIR"/toolchain-1.14.cmake -DCMAKE_BUILD_TYPE=Debug make