Monday, 3 October 2011

Installing Player/Stage in Ubuntu (Natty Narwhal)

A few months ago I wrote a guide to installing Player/Stage on a clean Natty Narwhal Ubuntu install for the robot lab I work at. This was on a protected wiki, but I think maybe it'd also be beneficial to the world in general, so I'll guide you through the installation process (with pictures!) in this blog entry.

I'm pretty sure this guide will work for any version of Ubuntu that has Ubuntu Software Centre on it, but I've only tested these instructions for Natty. If you followed these instructions to install Player/Stage on a non-Natty version of Ubuntu do leave a comment so that others can know whether it works.

If you have any problems or questions that aren't addressed here then I recommend you email the playerstage users mailing list.
These instructions are for Player 3.0.2 and Stage 4.0.1 which are the most recent versions at the time of writing this guide.
It helps to have a computer which you have sudo rights to. If the computer is networked and you can't install stuff on it then ask the network administrator to install playerstage for you, alternatively you can install Player/Stage into your home director, this is also described below.

Installing Player

This should work first time, even on a fresh install of Ubuntu.
Open a terminal and change directory (cd command) to the folder you extracted player into. This will probably be called something like "player-3.02" or whatever version you downloaded. Then enter the following commands:

mkdir build

cd build

cmake ..

sudo make install

But I don't have sudo!

Well then you'll have to install it into your home directory somewhere. This is a pretty similar process, you just have to change the install prefix.

mkdir build

cd build

ccmake ..

Note that's '''ccmake''' not cmake

in the terminal scroll menu thing that just opened scroll down to CMAKE_INSTALL_PREFIX. If nothing is listed press c, things should appear.

whilst it is selected press enter to edit the option and then change it to the folder you want player installed into.

press enter to confirm edit

press c to configure the settings

if the option appears, press g to generate the make files. If the option doesn't appear press c again until it does.

In the terminal now type make install

Installing Stage

Make sure that pkg-config can find player, otherwise there may be all sorts of troubles later when you try and use Stage. In a terminal type:

pkg-config --modversion playercore

If it gives you a version number it's properly installed. Otherwise, in your home folder make or edit the file called .bashrc, (it probably already exists). If you press ctrl+h while looking at the folder in nautilus it will show up if it's already there. At the end of this file write the following line IF YOU'RE USING A 64-BIT INSTALL:

export PKG_CONFIG_PATH+=/usr/local/lib64/pkgconfig

Write the following line IF YOU'RE USING A 32-BIT INSTALL:

export PKG_CONFIG_PATH+=/usr/local/lib/pkgconfig

Test this again in a new terminal with

pkg-config --modversion playercore

In a new terminal navigate to the stage folder you extracted earlier. this is probably called something like "Stage-4.0.1-Source" or whatever Stage version you installed. In a terminal type the following commands:

mkdir build

cd build

cmake ..

sudo make install

But I don't have sudo!

The install is just the same as for Player if you need to install Stage in your home folder or somewhere.

Follow steps 1,2 and 3 above for configuring pkg-config (otherwise this will not work).

Then in a terminal navigate to the stage folder you extracted earlier. this is probably called something like "Stage-4.0.1-Source" or whatever Stage version you installed. In a terminal type the following commands:

mkdir build

cd build

ccmake ..

in the terminal menu thing that just opened scroll down to CMAKE_INSTALL_PREFIX. If nothing is listed press c, things should appear.

whilst it is selected press enter to edit the option and then change it to the folder you want player installed into.

press enter to confirm edit

press c to configure the settings

if the option appears, press g to generate the make files. If the option doesn't appear press c again until it does.

In the terminal now type:

make install

Testing it works

The stage source code has some handy code that should work if you've got everything installed. To test your install in your terminal go to the /worlds directory in the source code folder. Type player simple.cfg into the terminal. In the unlikely event that that works you've successfully installed Player/Stage!

To fix this open up your .bashrc file and enter the following line IF YOU'RE USING A 64-BIT INSTALL:

export LD_LIBRARY_PATH+=/usr/local/lib64

Write the following line IF YOU'RE USING A 32-BIT INSTALL:

export LD_LIBRARY_PATH+=/usr/local/lib

If you changed CMAKE_INSTALL_PREFIX whilst installing player and or stage then do this:

export LD_LIBRARY_PATH+="whatever install prefix you made"

Now retest your install IN A NEW TERMINAL. I got the following error:
Registering driver Player v.3.0.2
* Part of the Player/Stage/Gazebo Project [http://playerstage.sourceforge.net].
* Copyright (C) 2000 - 2009 Brian Gerkey, Richard Vaughan, Andrew Howard,
* Nate Koenig, and contributors. Released under the GNU General Public License.
* Player comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see COPYING for details.

11 comments:

Very nice! I am still using Player/Stage on Ubuntu 10.04, have not yet ventured into Ubuntu with Unity.Being a GNOME enthusiast Unity is blasphemous. Still, I look forward to Ubuntu 12.04, which will be an LTS release.

[ 16%] Building CXX object client_libs/libplayerc++/CMakeFiles/playerc++.dir/playerclient.oIn file included from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.h:66:0, from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerc++.h:61, from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc:54:/usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp] # warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." ^