Skip to content

TOL Revolve install instructions

Milan Jelisavcic edited this page Feb 28, 2017 · 20 revisions

TOL-Revolve install instructions

Installing prerequisites

Install on Ubuntu

This part of manual is for Ubuntu 14.04.2 (Trusty) or newer, but probably will work without problems on other debian based distributions. First, make sure that the Ubuntu pre-compiled binaries are removed.

sudo apt-get purge '.*gazebo.*' '.*sdformat.*' '.*ignition-math.*'

Install prerequisites. A clean system will need:

wget https://bitbucket.org/osrf/release-tools/raw/default/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh
ROS_DISTRO=dummy . /tmp/dependencies.sh
sudo apt-get install $(sed 's:\\ ::g' <<< $GAZEBO_BASE_DEPENDENCIES) $(sed 's:\\ ::g' <<< $BASE_DEPENDENCIES)
sudo apt-get install python

pip install virtualenv

If DART http://dartsim.github.io/ is planed to be used, you can install it with: (not to be confused with http://dartlang.org)

# Only needed on Trusty. Ubuntu packages since 
sudo apt-add-repository ppa:libccd-debs
sudo apt-add-repository ppa:fcl-debs

# Main repository
sudo apt-add-repository ppa:dartsim
sudo apt-get update
sudo apt-get install libdart-core5-dev

For other optional dependencies:

sudo apt-get install ruby-ronn
sudo apt-get install robot-player-dev*

SDFormat and Gazebo depend on the ignition math library.

hg clone https://bitbucket.org/ignitionrobotics/ign-math /tmp/ign-math
cd /tmp/ign-math
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make -j4
sudo make install

Gazebo depends on the SDFormat package.

cd /tmp
wget http://osrf-distributions.s3.amazonaws.com/sdformat/releases/sdformat-3.1.1.tar.bz2
tar -xaf /tmp/sdformat-3.1.1.tar.bz2
cd /tmp/sdformat-3.1.1
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE="Release" \
         -DCMAKE_INSTALL_PREFIX=/usr
make -j4
sudo make install

Install on Mac OS X

First, if not alredy available, install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
xcode-select --install

Install XQuartz, which provides X11 support and is required by Gazebo and OGRE. XQuartz is available on http://www.xquartz.org/

If you want the Dart engine enbled, follow these commands: (These steps needs to be verified)

# Add dartsim/dart tap so formulae of dart and the dependencies will be found
brew tap dartsim/dart
# Also add homebrew/science tap for libccd formula and flann formula
brew tap homebrew/science

# Install brew (core only)
brew install dartsim5 --core-only

After that, run the following commands:

brew install boost bullet doxygen ffmpeg freeimage gdal gts libtar protobuf protobuf-c python qt tbb tinyxml
pip install virtualenv

brew tap osrf/simulation
brew install ignition-math2 ogre player sdformat3 simbody

brew update
brew upgrade

Building and installing Gazebo

Before cloning repositories, make new empty directory, eg. @~/projects/revolve-simulator@ and clone repos there:

mkdir -p ~/projects/revolve-simulator
cd ~/projects/revolve-simulator

git clone https://github.com/ci-group/gazebo.git -b gazebo6-revolve
git clone https://github.com/ci-group/revolve.git -b working
git clone https://github.com/ci-group/tol-revolve.git
git clone https://github.com/ci-group/revolve-brain.git

Cloning Gazebo repository may take a while. Next step is to checkout to @gazebo6-revolve@ branch.

cd gazebo

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE="Release" \
         -DCMAKE_INSTALL_PREFIX=/usr/local \
         -DENABLE_SSE4=True \
         -DENABLE_TESTS_COMPILATION:BOOL=False
make -j4 
make install

NOTE: After installation, if @gazebo@ could not be found, @-DCMAKE_INSTALL_PREFIX=/usr@ should be added to @cmake@ command and then @make -j4 install@ again. When this is done @gazebo@ command should be able to run in a terminal and get the default world.

NOTE: If this type of error occurred during build-time:

ld: library not found for -lintl clang: error: linker command failed with exit code 1 (use -v to see invocation)

gettext is not linked in /usr/include, so the following command will solve the problem:

brew link --force gettext

NOTE: If you get an error compiling the video section of gazebo, apply this patch

https://bitbucket.org/osrf/gazebo/commits/df5f96a6695f8dbe8d05bb885aed2913a09170b9

Building and installing Revolve

Next up is compiling Revolve. Go into the @revolve@ directory and do:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE="Release" -DLOCAL_BUILD_DIR=1 ../cpp
make -j4

NOTE: The LOCAL_BUILD_DIR=1 enables a dirty hack that makes the build directory look like an include path until I get the installation sorted out. Assuming Gazebo and all dependencies are correctly installed this should compile Revolve without issue. If it can't find gazebo try installing Gazebo again with the install prefix as mentioned above.

Building and installing TOL-Revolve

The next step is compiling TOL-Revolve. Go into that directory, and:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE="Release"  -DREVOLVE_BUILD_PATH="`pwd`/../../revolve/build" ../cpp
make -j4

Set the path to your value of course. This should compile the tol resources. To test whether all is working as expected, go into the tol/tools directory and run ./runbenchmark. Although this loads an empty world, it should display "World plugin loaded" if the tol plugin is successfully compiled and loaded.

The final steps is to get the Python dependencies for tol-revolve ready so we can run that. For this you need virtualenv; I've no idea how to install that on Mac but it shouldn't be difficult (brew install virtualenv or something might work). Then:

cd tol-revolve
virtualenv .venv
. .venv/bin/activate
pip install -r requirements.txt

Oh, if virtualenv installs a different version than Python 2.x by default you'll have to change that. It's 2.7.6 for me atm.

Running tests and demo

Alright, with all that installed you should be able to run the basic demos. The tol-revolve/tools directory is a mess but contains some useful scripts. Running ./nemodemo from there should launch the interactive evolution demo for instance. Note that this will in fact launch three separate things:

  • Gazebo (server + client)
  • The body analyzer (a separate instance of gzserver to analyze body intersections)
  • The Python managing code

Anyhow, that's just to verify things work, you can play around with it of course. Let's get to the main issue, performance, the slowing down with repeated insertion / deleting in particular. I got rid of some memory leaks earlier but this does not seem to have solved it. I've written a script showing the current problem. To run it, use two terminals, in the first:

cd tol-revolve/tools
./runbenchmark

In the second:

cd tol-revolve

# If not activated already
. .venv/bin/activate
python scripts/slowdown.py

This script will do nothing more than insert a robot consisting of one simple block into the world, wait for approximately 5 seconds simulation time, remove the block and repeat. For each sequence it records the wallclock time required for these 5 simulation seconds. It prints four values: the time taken, the average time over the last max 10, the "real time factor" (rtf) (i.e. sim time / time) and the average real time factor. A typical run starts at an rtf of about 50 for me but rapidly decreases as more robots are deleted / added. But there must be something that isn't cleaned up properly. I wish I could be of more help here but I haven't had the time to investigate this properly myself.

_________________
/ Premature      \
| optimization   |
| is the root of |
| all evil.      |
|                |
\ -- D.E. Knuth  /
-----------------
    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||
Clone this wiki locally