Install on raspberry: Difference between revisions
(→= RHD) |
(→RHD) |
||
Line 323: | Line 323: | ||
It should end saying "RHD is running" | It should end saying "RHD is running" | ||
(Stops with ctrl-C) | |||
==== MRC ==== | ==== MRC ==== |
Revision as of 16:34, 1 May 2015
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
plugins := auavoid auavoidk auball auballkl audrivepos augps \
aukeep aulaserifscan aupar aurhdif \ austereo auvarmrc ucamif \ aucamcog aucron auefline augraphplan \ aukinect aulobst aumapobst aupoly auroaddrive \ ausmr locater ulmspassable \ aucamfocus audisp aufile auimu \ aulaserif aulocalize2 \ auobj3d aupplfinder aurule \ ausockbin autof mapbase ulmsv360 aucamrectify aupipi \ aulaserbox aufzclass auviewer aupcp aupcltest auv4lgst \ aucroprow autof2 auptgrey \ aulocalize
remove
aukinect (5th line) auviewer aupcp aupcltest (11th line) auptgray (12th line)
Build
Build the needed parts of mobotware, e.g.:
cd ~/mobotwareXXX make
This should now compile with warnings only
(augraphplan.h not found may complain, but try a make more, then t usually works @todo - find out why)
install
The easyest way to use Mobotware is then to install into /usr/local/smr.
This is done by
sudo make install
setup path
Add the mobotware bin-directory into default PATH in /etc/profile
sudo nano -w /etc/profile
append the 2 PATH lines with :/usr/local/smr/bin, like:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/smr/bin"
And add mobotware AURS library path into .bashrc
nano -w ~/.bashrc
append a line like this
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/smr/lib"
Make a Mobotware test configuration
Logout and login to ensure that the PATH settings gets implemented
Make a directory to run from
mkdir ~/live cd ~/live
Copy a robot configuration file
cp -r /usr/local/etc/mobotware/calib .
make a rhdconfig.xml file with this content (loads a joystick and log plugin only):
<?xml version="1.0" ?> <rhd> <sheduler> <period value="12000"/> <type value="LXRT"/> </sheduler> <server> <port value="24902"/> <clients number="10" allwriters="1"/> </server> <plugins basepath="/usr/local/smr/lib/rhdplugin/"> <joycontrol enable="true" lib="libjoycontrol.so.1" critical="false" safety="1"> <joystick port="/dev/input/js0"/> <speed maxfwd="900" maxturn="900" fastBut="5" slowFactor="0.3"/> <deadband max="767" min="-767"/> <control enable="true"/> </joycontrol> <rhdlog enable="true" lib="rhdlog.so.1" critical="false" interval="1" safety="2" debug="0"> </rhdlog> </plugins> </rhd>
Test Mobotware
RHD
Start RHD
rhd
It should end saying "RHD is running"
(Stops with ctrl-C)
MRC
While the RHD is running (in another terminal)
start the MRC
cd ~/live mrc
This should show a list of options
-press 5 to quit
Laser scanner server
Start laser scanner server
ulmsserver
There will be some errors as there is no laserscanner ...
Press enter a few times to get a prompt ">>"
Type help, this should show a list of loaded plugins, like
... Available commands (from currently loaded modules): - push q server help shelp module do BASH alive quit exit - scanGet scanPush scanSet - odoPose odoPosePush - mapPose mapPosePush - utmPose utmPosePush - var varPush - poly - mapbase - settable addline setinitpose setinitcov localizeMHF localize resetlocalizer outputdist odoposeupdate resample localizeUKF ...
Try e.g. scanget fake=3, this should show a lot of HEX numbers and a few more errors.
Camera server
Start the camera server
ucamserver
This should end with something like this
Camera_server 2.1966 (May 1 2015 13:42:21 jca@oersted.dtu.dk) - on port 24920 - type h for help, q for quit
Pres q to quit
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.