Skip to content

build from source

Simon Trendel edited this page Sep 27, 2016 · 1 revision

The following instructions guide you through the process of building this repo from source.

Dependencies

git

#!bash
sudo apt-get install git

ncurses

#!bash
sudo apt-get install libncurses5-dev 

doxygen[OPTIONAL]

#!bash
sudo apt-get install doxygen

gcc>4.8(for c++11 support).

following the instruction in this forum:

#!bash
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

For detailed description of installation see here. The code also runs with indigo, except for an additional Marker enum in visualization_msgs (ie DELETALL). You can however build the jade version from source, but rviz will probably also need to be rebuild with the new message. The following instructions will guide you through the installation for this project. This has been tested on a clean installation of Ubuntu 14.04.

#!bash
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
sudo apt-get update

install ros desktop and control related stuff

#!bash
sudo apt-get install ros-jade-desktop
sudo apt-get install ros-jade-controller-interface ros-jade-controller-manager ros-jade-control-toolbox ros-jade-transmission-interface ros-jade-joint-limits-interface

install gazebo5 and gazebo-ros-pkgs

#!bash
sudo apt-get install gazebo5 libgazebo5-dev 
sudo apt-get install ros-jade-gazebo-ros-pkgs

You should try to run gazebo now, to make sure its working.

#!bash
source /usr/share/gazebo-5.0/setup.sh
gazebo --verbose

If you seen an output like, 'waiting for namespace'...'giving up'. Gazebo hasn't been able to download the models. You will need to do this manually. Go to the osrf bitbucket, click download repository. Then unzip and move to gazebo models path:

#!bash
cd /path/to/osrf-gazebo_models-*.zip
unzip osrf-gazebo_models-*.zip -d gazebo_models
mv gazebo_models/* ~/.gazebo/models

Now we need to tell gazebo where to find these models. This can be done by setting the GAZEBO_MODEL_PATH env variable. Add the following line to your ~/.bashrc:

#!bash
export GAZEBO_MODEL_PATH=~/.gazebo/models:$GAZEBO_MODEL_PATH

If you run gazebo now it should pop up without complaints and show an empty world.

clone repos

The project also depends on the flexrayusbinterface and common_utilities. The repos can be cloned with the folowing commands, where the submodule command attempts to pull the flexrayusbinterface and common_utilities.

#!bash
git clone https://github.com/Roboy/roboy-ros-control
cd roboy-ros-control
git submodule update --init --recursive

Build

Please follow the installation instructions for flexrayusbinterface before proceeding.

patching WinTypes.h

Additionally you need to patch two typedefs in WinTypes.h, which comes with the ftd2xx driver, because they are conflicting with the gazebo header FreeImage.h.

#!bash
cd path/to/roboy-ros-control/src/myomaster/patches
diff -u /usr/include/WinTypes.h WinTypes.h > WinTypes.diff
sudo patch /usr/include/WinTypes.h < WinTypes.diff

NOTE: in case you want to undo the patch run with -R switch:

#!bash
cd path/to/roboy-ros-control/src/myomaster/patches
sudo patch -R /usr/include/WinTypes.h < WinTypes.diff

Environmental variables and sourceing

Now this is very important. For both build and especially running the code successfully you will need to define some env variables and source some stuff. Add the following lines to your ~/.bashrc (adjusting the paths to your system):

#!bash
source /usr/share/gazebo-5.0/setup.sh
export GAZEBO_MODEL_PATH=/path/to/roboy-ros-control/src/roboy_simulation:$GAZEBO_MODEL_PATH
export GAZEBO_PLUGIN_PATH=/path/to/roboy-ros-control/devel/lib:$GAZEBO_PLUGIN_PATH
source /opt/ros/jade/setup.bash
source /path/to/roboy-ros-control/devel/setup.bash

Then you can build with:

#!bash
source ~/.bashrc
cd path/to/roboy-ros-control
catkin_make --pkg common_utilities
source devel/setup.bash
catkin_make

symlink to meshes

For gazebo to find the meshes, create a symlink:

#!bash
mkdir ~/.gazebo/models
ln -s path/to/roboy-ros-control/src/roboy_models/legs_with_muscles_simplified ~/.gazebo/models/