Table of Contents

Software

Here you will find information about the software used in the seminar. Specifically:

Some Machine Learning information is helpful.

Instalation procedure for player in Ubuntu Linux Desktop version 9.04 (Jaunty)

sudo apt-get update
sudo apt-get install xstow autoconf pkg-config libtool automake build-essential libusb-dev swig python-dev libjpeg62-dev
mkdir local
mkdir local/DIR
mkdir local/src
mkdir local/src/player
mkdir local/src/phidgets
cd
gedit .bashrc

You have to add the following lines at the beginning of the file:

export PYTHON_VERSION=$(readlink $(which python))
export PATH=${HOME}/local/bin:${PATH}
export LD_LIBRARY_PATH=${HOME}/local/lib:${LD_LIBRARY_PATH}
export LIBRARY_PATH=${LD_LIBRARY_PATH}:${LIBRARY_PATH}
export CPATH=${HOME}/local/include:${CPATH}
export LDFLAGS="-L${HOME}/local/lib ${LDFLAGS}"
export PKG_CONFIG_PATH=${HOME}/local/lib/pkgconfig
export CMAKE_INCLUDE_PATH=${CPATH}
export CMAKE_LIBRARY_PATH=${LIBRARY_PATH}
export PYTHONPATH=${HOME}/local/src/yarp2/example/swig/build/:${HOME}/local/src/player/pypc-gen:${HOME}/local/lib/python/site-packages:${HOME}/local/lib/${PYTHON_VERSION}/site-packages:${PYTHONPATH}
export YARP_DIR=${HOME}/local/src/yarp2/build
cd local/src/phidgets
tar -xzf phidget21_b.tar.gz  (Change accordingly if you used the newer library)
cd phidget21/
autoreconf
./configure --prefix=${HOME}/local/DIR/phidgets
make
make install
cd
cd local/DIR
xstow phidgets
cd
cd
sudo cp 030_phidgets.rules.txt /etc/udev/rules.d/030_phidgets.rules
sudo /etc/init.d/udev restart
sudo apt-get install libltdl3-dev libboost-thread-dev libboost-signals-dev libgtk2.0-dev swig python-dev libgeos-dev libgsl0-dev
cd local/src/player
svn co https://playerstage.svn.sourceforge.net/svnroot/playerstage/code/player/trunk player
cd
cd local/src/player
tar -xzf player-svn-29.10.2008.tar.gz (Change accordingly if you used another player compressed file)
cd
cd local/src/player/player
mkdir build
cd build
ccmake ../
make
make install
cd
cd local/DIR
xstow player
cd
sudo chmod -R o+rw /dev/bus/usb/*
player local/src/player/player/config/phidgetIFK.cfg

(Player should run without error messages)

cd local/src/player/player/build/client_libs/libplayerc++/test/
./playerc++_test --speech:0

The test program execute several checks. If you have connected the Phidgets interface kit you will see the message “Hellow world!” and the some numbers in the LCD screen of the phidget.

Setting up QT

cd
sudo apt-get install libqt4-dev kdevelop qt4-designer qt4-dev-tools python-qt4-dev pyqt4-dev-tools libtclap-dev
kdevelop

Setting up your proyect

The skeleton phidget program

Now we are going to put into work the code from the workshop.

tar -xzf skeleton.tar.gz

Connect a slider resistor to the 0 analog input of the phidgetIFK. It should print “**Test* * X.XXV” where X.XX is the voltage measured by the phidgetIFK from the slider. Also you should see the slider progress bar in the GUI changing according to the position of the slider.

Python applications

If you want to run Python clients you first need to get special bindings for player, the included python bindings for player are not recommended. Before starting this section, please update your ”.bashrc“ file with the current environmental variables described at the beggining of this page and restart your session.

cd local/src/player
git clone http://www9.in.tum.de/~kleinehe/pypc-gen.git
export IDIR=/home/user/local/src/player/player
cd pypc-gen
cat kludge.h $IDIR/libplayercore/player.h $IDIR/build/libplayercore/player_interfaces.h $IDIR/client_libs/libplayerc/playerc.h | ./pypc-gen > pyplayerc.py
apt-get install ipython
ipython
import pyplayerc as p
client=p.Client(None, "localhost", 6665)
client.connect()
client.set_replace_rule(-1,-1,-1,-1,True)
client.datamode(p.PLAYERC_DATAMODE_PULL)
aio=p.Aio(client,0)
aio.subscribe(p.PLAYERC_OPEN_MODE)
client.read()
aio.voltages_count
aio.voltages
aio.unsubscribe()
del aio
client.disconnect()

Data collection phidget program for Weka

tar -xzf skeleton_data_collection.tar.gz

This will overwrite the original skeleton. You have to recompile.

java -jar weka.jar

You should look for the correctly classified Instances inside of the Stratified cross-validation. Than value should be a good starting point to evaluate each learning algorithm.

Applying the learning algorithm inside of your program

Take a look in this code You need to install a package called libfann1-dev

YARP

Instalation

sudo apt-get install libace-dev libcv-dev libavdevice-dev ffmpeg
cd
cd local/src
svn co https://yarp0.svn.sourceforge.net/svnroot/yarp0/trunk/yarp2
cd yarp2
mkdir build
cd build
ccmake ../
make
make install
cd
cd local/DIR
xstow yarp2
cd locar/src/yarp2
cd example/swig
mkdir build
cd build
ccmake ../
make
cp _libpyyarp.so _yarp.so

Example Summer

import yarp as y
y.Network.init()
input=y.BufferedPortBottle()
output=y.BufferedPortBottle()
input.open("/summer/in")
output.open("/summer/out")
While True:
  inputbottle=input.read(False)
  if inputbottle:
    outputnumber=inputbottle.get(0).asDouble()+inputbottle.get(1).asDouble()
    outputbottle=output.prepare()
    outputbottle.clear()
    outputbottle.addDouble(outputnumber)
  else:
    y.Time.delay(0.001)