Install on raspberry

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
(Plug-ins)
 
(101 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Short note on installation of (parts of) mobotware on Raspberry Pi (or Beagle-bone)
+
Back to [[Robobot]]
  
For Beagle-bone skip to "Login" with adduser or installation o, the rest should work, as they are both almost the same processor and operating system. Note this guide is not pt. tested on beagle-bone.
+
Back to [[Flexbot]]
  
=== 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 e.g.: http://elinux.org/RaspberryPiBoardBeginners
+
== Prerequisite ==
  
Assuming this is up and running - with internet access
+
* Raspberry pi - version 3 or 4
 +
* SD-card preferably at least 16Gb
 +
* Monitor with HDMI (version 3) or micro HDMI (version 4) cable
 +
* keyboard - and optional a mouse
 +
* Access to network (wired or wifi)
 +
* Power - either an USB charger or cable to a PC (micro USB (version 3) or USB-C (version 4)
  
==== I2C clock stretching ====
+
It should be possible to start using USB or wifi connection from a PC without extra screen or keyboard, find solutions on internet - I have not tried.
  
NB! pt. (may 2015) the i2c interface driver do not support clock stretching for data,
+
====Make SD card a FAT32 partision, if reusing an old card====
this will often be seen as the MSB is missing (at times), dependent on the speed
+
of the slave device.
+
  
One option is to reduce bus-speed to e.g. 50kHz, or to use a faster slave, that do
+
A new SD-card is fine as is, else
not need clock-stretching.
+
  
Hopefully the I2C driver will be cured soon, as the hardware should support the stretching.
+
see http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/ for instruction to prepare any old or new SD-card
  
=== Configure ===
+
====Add boot-files to SD card====
  
Using ''raspi-config''
+
=====RPI imager =====
Expand Filesystem (if not OK already)
+
Enable Camera
+
Set hostname
+
Enable SSH
+
Enable i2c - load module as default
+
Disable Serial login
+
Update firmware
+
  
=== Update operating system ===
+
Version 10 (buster) is easily installed using the 'Raspberry pi imager',
 +
on Linux install with
  
Ensure you have internet access, then
+
snap install rpi-imager
 +
rpi-imager
  
sudo apt-get update
+
and follow the screen
sudo apt-get dist-upgrade
+
sudo reboot
+
  
=== Login ===
+
=====manual =====
  
login as ''pi'', password ''raspberry''
+
or
  
add a user called ''local''
+
Get the install zip-file from https://www.raspberrypi.org/downloads/noobs/
  
  sudo adduser local
+
Then unpack NOOBS zip-file to the new disk (use the newest version), like
  sudo usermod -a --groups adm,cdrom,sudo,audio,video,plugdev,games,users,netdev,input,spi,gpio,i2c local
+
for the network version
 +
unzip NOOBS_lite_v3_5_1.zip -d /media/xxx/yyyy or
 +
  unzip ~/Downloads/raspberry/NOOBS_lite_v3_5_1.zip  (if you are on the empty flash)
 +
or for the full version
 +
unzip NOOBS_v3_5_1.zip -d /media/xxx/yyyy  or
 +
unzip ~/Downloads/raspberry/NOOBS_v3_5_1.zip  (if you are on the empty flash)
  
switch user to ''local'', and ensure groups are OK, and network is running
+
====Reboot====
  
su - local
+
* Insert SD card on Raspberry,
groups
+
* Mount a heatsink - especially needed on version 4,
ifconfig
+
* Connect monitor, keyboard and (USB) power
  
Note the inet address.
+
That is all, Raspberry should boot on that, and take some time to prepare the SD-Card.
 +
Or see instructions on e.g.: https://www.raspberrypi.org/help/noobs-setup/
  
Now it is possible to login (as ''local'') from network.
+
* Boot the raspberry and install the Raspberry Pi OS full (Debian).
 +
* On the bottom of the screen select keyboard layout and language,
  
=== Get access using hostname ===
+
Settings
  
To get access to the raspberry using hostname mey be convinient if the allocated IP changes.
+
* Leave the pi password as is (for future reuse)
 +
* Select language (prefer English - also for future reuse)
 +
* select wifi access - if not using a cable.
  
Install the avahi-daemon
+
==Usefull Linux commands==
  
sudo apt-get install avahi-daemon
+
Here are some common commands in Linux
sudo service avahi-daemon restart
+
  
Now from another PC on the local network
+
ls    (directory file list)
 +
cd    (change to home directory)
 +
cd some_directory    (change to a subdirectory)
 +
exit  (logout, e.g. of a ssh session)
 +
grep -n string_to_look_for_in_a_file  *.cpp    (find a string in a file, e.g. a variable or a function)
 +
sudo some_command    (execute a command as "root" - root is a superuser with administrator rights to everything)
 +
pkill some_application_name  (stop (or kill) a running process with name "some_application_name")
 +
pgrep some_application_name  (see if a process is running - good to use before a kill)
 +
mv  from_file to_file    (rename a file)
 +
cp  from_file to_file    (copy a file)
 +
rm  some_file            (remove (delete) a file)
 +
nano some_file          (simple text editor)
 +
zip, unzip              (pack or unpack files -  try zip --help  to see how.
 +
top    (see process load and memory usage)
 +
make    (compile all as described in the "Makefile" in the same directory)
 +
make -j4 (compile using up to 4 CPU cores - faster if more files need to be compiled)
  
  ping hostname.local
+
All commands have an online help if you add --help or -h after the command.
 +
If this is not enough, then try
 +
  man ls
 +
to get the manual page for the ls command.
  
where "hostname" is replaced with the hostname you assigned.
+
== Configure ==
+
  
=== Get filesystem on normal PC ===
+
==== Raspberry ====
  
From another (Linux) PC, mount the raspberry filesystem
+
use raspi-config, start a terminal:
  
  mkdir rpi  (where the filesystem will be mounted)
+
  sudo raspi-config
sshfs local@10.59.8.141: rpi    (replace IP number with inet address from above, or use ''sshfs local@hostnale.local: rpi'')
+
  
Then in directory ''rpi'' the user files on the raspberry can be manipulated.
+
Using ''raspi-config''
 +
Enable Camera
 +
Set hostname (one word, no space)
 +
Enable SSH
 +
Disable Serial login
 +
boot as a console with login
 +
Update firmware
 +
Set locale to "en_DK.UTF-8 UTF-8" (danish keyboard, but English language)
  
for other access, use (with IP address as found above, or IP replaced with ''hostname.local'')
+
=== Update operating system ===
  
ssh -X local@10.59.8.141
+
Ensure you have internet access, then
  
=== Packages needed for Mobotware RHD/MRC ===
+
  sudo apt-get update
 
+
  sudo apt-get dist-upgrade
The following packages needs to be installed - e.g. using apt-get like:
+
  sudo reboot
 
+
  sudo apt-get install subversion
+
 
+
Package list for RHD and MRC:
+
 
+
subversion  (to fetch mobotware from SVN)
+
libexpat-dev  (RHD)
+
pciutils-dev  (RHD)
+
libncurses-dev (RHD)
+
bison          (MRC)
+
libsdl-dev    (MRC)
+
telnet        (MRC test)
+
sshfs          (may be a good idea to access filesystem from another PC)
+
  sudo apt-get install subversion libexpat-dev pciutils-dev libncurses-dev bison libsdl-dev telnet sshfs
+
 
+
=== 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
+
 
+
==== Camera driver source ====
+
 
+
To use the raspberry camera (and compile the aupicam plugin) the ''userland'' sourcecode (from https://github.com/raspberrypi/userland):
+
 
+
git clone https://github.com/raspberrypi/userland.git userland-master
+
 
+
This needs to compile and install (NB! I had some PATH issues, and they were probably solved by editing ''CMakeLists.txt'')
+
 
+
cd userland-master
+
mkdir build
+
cd build
+
cmake ..
+
make
+
sudo make install
+
 
+
This will copy the needed header and library files to ''/opt/vc'' and other places.
+
 
+
=== Mount filesystem ===
+
 
+
As an option, mount the home directory on raspberry-pi to your local PC for easy
+
file modification.
+
 
+
On your PC type make a directory for the filesystem
+
 
+
mkdir rpi
+
sshfs local@10.59.8.141: rpi
+
ls rpi
+
 
+
with your IP address or IP replaced by ''hostname.local''.
+
 
+
=== Get Mobotware ===
+
 
+
Get and unpack mobotware - see main page of this wiki for info
+
 
+
Either from SVN - if you have access, or from our lab-computers as a mobotware-XXX.tar.gz file, where XXX is version number.
+
 
+
unpack if a .gz file
+
 
+
tar -xzf mobotware-XXX.tar.gz
+
 
+
this makes a mobotware directory with all the files.
+
 
+
=== Modify makefiles ===
+
 
+
Not all parts of Mobotware runs on a raspberry, so some parts must be removed from the 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
+
 
+
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
+
simstage3
+
 
+
==== Camera server libraries Makefile ====
+
 
+
goto AURS library
+
 
+
cd ~/mobotwareXXX/aurobotservers/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/aurobotservers/trunk/src/
+
nano -w Makefile
+
 
+
Remove qclient, as it requires QT to be installed, and that is all too much.
+
 
+
apps = auclient  auservertest  ucamserver  uclient  ulmsserver  userver qclient
+
to
+
apps = auclient  auservertest  ucamserver  uclient  ulmsserver  userver
+
 
+
==== Plug-ins====
+
 
+
Some plug-ins are excluded from raspberry pi (''kinect'' and point-cloud related plug-ins)
+
in the Makefile in the ''plugin'' directory.
+
 
+
=== Build ===
+
Build mobotware:
+
cd ~/mobotwareXXX
+
make
+
 
+
This should now compile with warnings only
+
 
+
(''augraphplan.h not found'' may appear,
+
but try one more ''make'', then it 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).
+
Look in ''mobotware/build/config'' for specific versions for different robots.
+
 
+
<?xml version="1.0" ?>
+
<!--
+
    Configuration file for
+
    Robot Hardware Daemon
+
-->
+
<!-- Starting RHD Configuration -->
+
<rhd>
+
  <!-- *** Core Components Configuration *** -->
+
  <!-- Sheduler configuration -->
+
  <sheduler>
+
    <period value="12000"/><!--in usec-->
+
    <type value="LXRT"/><!--"usleep","itimer","LXRT" -->
+
  </sheduler>
+
  <!-- Server configuration -->
+
  <server>
+
    <port value="24902"/>
+
    <clients number="10" allwriters="1"/>
+
  </server>
+
  <!-- *** Plugins Configuration *** -->
+
  <plugins basepath="/usr/local/smr/lib/rhdplugin/">
+
    <!--
+
    Add your plugin here after this comment and
+
    leave joycontrol and log - they may be usefull.
+
    -->
+
    <joycontrol enable="true"
+
                    lib="libjoycontrol.so.1"
+
                    critical="false"
+
                    safety="1">
+
      <joystick port="/dev/input/js0"/>
+
      <!-- speed:
+
          maxfwd is max speed reference value send to device
+
          maxturn is max turn-angle angle-vel send to device
+
          fastBut is button number on joypad (0..10)
+
          slowFactor used when fastBut is not pressed (0.1 .. 1.0) 1.0 is default -->
+
      <speed maxfwd="900"
+
          maxturn="900"
+
          fastBut="5"
+
          slowFactor="0.3"/>
+
      <!-- deadband for joy-controll in joy-control units (+/- 32000) -->
+
      <deadband max="767" min="-767"/>
+
      <control enable="true"/>
+
    </joycontrol>
+
    <!-- rhdlog will open a file rhdlog.txt and write all symbol values here as fast as possible.
+
            it may not keep up writeing with the tick interval specified (can be changed online)
+
            interval = 0 (default) for no log - can be set online from rhdtest or MRC.
+
            interval = N if N=1 every tick, N=2 every other, N=3..
+
            File is created in default directory.
+
            After each write operation the data is flushed to disk (using fflush()).
+
            each line starts with a unix timestamp (gettimeofday) - set at tick call -->
+
    <rhdlog enable="true"
+
          lib="rhdlog.so.1"
+
          critical="false"
+
          interval="1"
+
          safety="2"
+
          debug="0">
+
    </rhdlog>
+
  </plugins>
+
</rhd>
+
 
+
=== Test Mobotware ===
+
 
+
==== RHD ====
+
 
+
Hardware abstraction layer (Robot Hardware Daemon)
+
 
+
Start RHD
+
 
+
rhd
+
 
+
It should end saying "RHD is running"
+
 
+
(Stops with ctrl-C)
+
 
+
==== MRC ====
+
 
+
Mobile Robot Control.
+
 
+
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.
+
 
+
Press ''q'' to quit
+
 
+
==== Camera server ====
+
 
+
Start the camera server - and optionally load the camera plug-in.
+
 
+
ucamserver
+
>> module load=aupicam.so.0
+
 
+
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
+

Latest revision as of 09:54, 24 December 2021

Back to Robobot

Back to Flexbot


Contents

[edit] Prerequisite

  • Raspberry pi - version 3 or 4
  • SD-card preferably at least 16Gb
  • Monitor with HDMI (version 3) or micro HDMI (version 4) cable
  • keyboard - and optional a mouse
  • Access to network (wired or wifi)
  • Power - either an USB charger or cable to a PC (micro USB (version 3) or USB-C (version 4)

It should be possible to start using USB or wifi connection from a PC without extra screen or keyboard, find solutions on internet - I have not tried.

[edit] Make SD card a FAT32 partision, if reusing an old card

A new SD-card is fine as is, else

see http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/ for instruction to prepare any old or new SD-card

[edit] Add boot-files to SD card

[edit] RPI imager

Version 10 (buster) is easily installed using the 'Raspberry pi imager', on Linux install with

snap install rpi-imager
rpi-imager

and follow the screen

[edit] manual

or

Get the install zip-file from https://www.raspberrypi.org/downloads/noobs/

Then unpack NOOBS zip-file to the new disk (use the newest version), like for the network version

unzip NOOBS_lite_v3_5_1.zip -d /media/xxx/yyyy  or
unzip ~/Downloads/raspberry/NOOBS_lite_v3_5_1.zip  (if you are on the empty flash)

or for the full version

unzip NOOBS_v3_5_1.zip -d /media/xxx/yyyy  or
unzip ~/Downloads/raspberry/NOOBS_v3_5_1.zip  (if you are on the empty flash)

[edit] Reboot

  • Insert SD card on Raspberry,
  • Mount a heatsink - especially needed on version 4,
  • Connect monitor, keyboard and (USB) power

That is all, Raspberry should boot on that, and take some time to prepare the SD-Card. Or see instructions on e.g.: https://www.raspberrypi.org/help/noobs-setup/

  • Boot the raspberry and install the Raspberry Pi OS full (Debian).
  • On the bottom of the screen select keyboard layout and language,

Settings

  • Leave the pi password as is (for future reuse)
  • Select language (prefer English - also for future reuse)
  • select wifi access - if not using a cable.

[edit] Usefull Linux commands

Here are some common commands in Linux

ls     (directory file list)
cd     (change to home directory)
cd some_directory    (change to a subdirectory)
exit   (logout, e.g. of a ssh session)
grep -n string_to_look_for_in_a_file  *.cpp     (find a string in a file, e.g. a variable or a function)
sudo some_command    (execute a command as "root" - root is a superuser with administrator rights to everything)
pkill some_application_name  (stop (or kill) a running process with name "some_application_name")
pgrep some_application_name  (see if a process is running - good to use before a kill)
mv  from_file to_file    (rename a file)
cp  from_file to_file    (copy a file)
rm  some_file            (remove (delete) a file)
nano some_file           (simple text editor)
zip, unzip               (pack or unpack files -  try zip --help   to see how.
top     (see process load and memory usage)
make    (compile all as described in the "Makefile" in the same directory)
make -j4 (compile using up to 4 CPU cores - faster if more files need to be compiled)

All commands have an online help if you add --help or -h after the command. If this is not enough, then try

man ls

to get the manual page for the ls command.

[edit] Configure

[edit] Raspberry

use raspi-config, start a terminal:

sudo raspi-config

Using raspi-config

Enable Camera
Set hostname (one word, no space)
Enable SSH
Disable Serial login
boot as a console with login
Update firmware
Set locale to "en_DK.UTF-8 UTF-8" (danish keyboard, but English language)

[edit] Update operating system

Ensure you have internet access, then

sudo apt-get update
sudo apt-get dist-upgrade
sudo reboot
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox