Install on raspberry

From Rsewiki

Short note on installation of (parts of) mobotware on Raspberry Pi

Prerequisite

First install 2012-10-28-wheezy-raspbian on the raspberry Pi flashdisk and expand the flash-disk to at least 4GB - see the instructions on http://elinux.org/RaspberryPiBoardBeginners

Assuming this is up and running - with internet access

Configure

Using raspi-config enable

Expand Filesystem
Enable Camera
Set hostname
Enable SSH
Enable i2c - load module as default
Disable Serial login
reboot

Login

login as pi, password raspberry

add a user called local

sudo adduser local
sudo usermod -a --groups adm,cdrom,sudo,audio,video,plugdev,games,users,netdev,input,spi,gpio local 

switch user to local, and ensure groups are OK, and network is running

su - local
groups
ifconfig

Note the inet address.

Now it is possible to login from network.

Do NOT login as root

Packages needed for Mobotware RHD/MRC

The following packages needs to be installed - e.g. using apt-get like:

sudo apt-get install subversion

Package list:

subversion  (to fetch mobotware from SVN)
libexpat-dev   (RHD)
pciutils-dev   (RHD)
libncurses-dev (RHD)
bison          (MRC)
libsdl-dev     (MRC)
telnet         (MRC test)
sudo apt-get install subversion libexpat-dev pciutils-dev libncurses-dev bison libsdl-dev telnet

Additional for AURS (e.g. camera server)

Package list

cmake
libopencv-dev
libreadline-dev
libudev-dev
libusb-dev
libv4l-dev
python-dev
libgstreamer0.10-dev
libboost-dev
libboost-system-dev
sudo apt-get install cmake libopencv-dev libreadline-dev libudev-dev libusb-dev libv4l-dev python-dev libgstreamer0.10-dev libboost-dev libboost-system-dev

Get Mobotware

Get and unpack mobotware - you need the following directories only for RHD and MRC:

mobotware/aumat
mobotware/mrc
mobotware/rhd
mobotware/build

The rest of the directories can be deleted, so can rhd/branches

Modify makefiles

Enter the mobotware directory

cd mobotware-XXX

main Makefile

nano -w Makefile

Change this section

APPSUBDIRS = aumat/trunk \
   aurobotservers/trunk/include \
   aurobotservers/trunk/libs \
   mapbase/trunk \
   rhd/trunk \
   mrc/trunk \
   hakoclient/trunk  \
   aurs-plugins/aumanager aurs-plugins/aumrcobst aurs-plugins/auplanner/trunk \
   aurs-plugins/auzoneobst \
   aurobotservers/trunk \
   simulator/trunk

to delete the lines

hakoclient/trunk  (GUI for HAKO tractor)
simulator/trunk   (simulator will not run on raspberry)

so that it looks like

APPSUBDIRS = aumat/trunk \

   aurobotservers/trunk/include \
   aurobotservers/trunk/libs \
   mapbase/trunk \
   rhd/trunk \
   mrc/trunk \
   aurs-plugins/aumanager aurs-plugins/aumrcobst aurs-plugins/auplanner/trunk \
   aurs-plugins/auzoneobst \
   aurobotservers/trunk

Remember to remove the last back-slash

RHD plugins Makefile

cd rhd/trunk/plugins
nano -w Makefile

In this section

PLUGINLIST := auserial gps crossbow fogyro hakocan smrdserial rflex \
             rs232linesensor powercube esm slugs usbiss sf9dof \
             joycontrol gdm8246 buspiratei2c buspiratead \
             herkulex saberandmagenc imu gps2\
             smrarm rhdlog hexakopter gbprofibus roboteq gpsSocket \
             fieldsteer fielddrive fieldfrontenc \
             dynamixel cruizcore simstage3

Remove

gbprofibus
cruizcore simstage3

Camera server libraries Makefile

goto AURS library

cd mobotwareXXX/trunk/libs/
nano -w Makefile

in this section BASELIBS = ../include ../lib \

 ugen4 urob4 umap4 ucam4 \
 liblineext dglib freenect \
 aulibextractfeatures utils \
 ../src/ulmsserver

remove

freenect  (kinect library)

AURS application Makefile

Goto the src directory

cd mobotwareXXX/trunk/src/
nano -w Makefile

Change line

apps = auclient  auservertest  ucamserver  uclient  ulmsserver  userver qclient
to
apps = auclient  auservertest  ucamserver  uclient  ulmsserver  userver

AURS plugins Makefile

Goto plugin directory

cd mobotwareXXX/trunk/plugin/
nano -w Makefile

in the section

Test Gstreamer

Test to get camera working using gstreamer

Package list

alsa-tools gstreamer0.10-alsa gstreamer0.10-ffmpeg
gstreamer0.10-fluendo-mp3 gstreamer0.10-plugins-base
gstreamer0.10-tools 

- did not help - neither auv4lgst nor VLC can capture images

v4l-compatibility seems OK

Build

Build the needed parts of mobotware, e.g.:

cd ~/mobotware/aumat/trunk
make
cd ../../rhd/trunk
make
cd ../../mrc/trunk
make

In this order

Then collect the configuration and binary files in a test directory

Test

make a test directory and fill it with the needed configuration and binary files, e.g.

mkdir live
cd live
cp -r ~/mobotware/build/config/ROBOT_TYPE/* .
ln -s ~/mobotware/rhd/trunc/build/bin/rhd .
ln -s ~/mobotware/rhd/trunk/build/bin/rhdtest .
ln -s ~/mobotware/mrc/trunk/mrc/mrc .
echo "" >calib/wdssparam.dat

You now need to modify the rhdconfig.xml file: Change the path to plugins, using e.g. nano

nano -w rhdconfig.xml

Change the line (assuming you use the default pi user)

from: <plugins basepath="/usr/local/smr/lib/rhdplugin/">
to:   <plugins basepath="/home/pi/mobotware/rhd/trunk/build/lib/rhdplugin/">

In the rhdconfig.xml there is already a number og plugins, this list need to be updated to your configuration.

To test if the RHD is running you may just change the attribute critical="true" to critical="false", the RHD will then continue even if the plugin fails to initialize. If some plugin is not found - e.g. maestro12ch.so.1 (it is not compiled by default) - then delete it from the rhdconfig.xml file, or change enable="true" to enable="false" for this plugin.

The file calib/robot.conf needs update too. You may use the configuration files in mobotware/build/config for inspiration

Now start the RHD (in the live directory):

./rhd

It should end by saying "RHD is running", else check the rhdconfig.xml as above.

Open a new terminal tab and run rhdtest to see if it is alive:

./rhdtest

And type

connect

You should now see a list of variables, where at least the Tick is updating.

Stop the rhdtest with ctrl-c

MRC test

Start the MRC (while the RHD is running) using socket interface:

./mrc -t1

In another terminal window use telnet to connect to the MRC

telnet localhost 31001

MRC commands like

eval $time

Should now be avilable

If all this is OK, then the raspberry Pi is running, and you only need to connect it to your robot througt an appropriate set of rhd plug-ins and make a MRC script to make it run.

Performance

The RHD and MRC running in idle with an update rate of 100 HZ is consuming about 3-4% CPU load each.