Install on raspberry

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
 
(165 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Short note on installation of (parts of) mobotware on Raspberry Pi
+
Back to [[Robobot]]
  
=== Prerequisite ===
+
Back to [[Flexbot]]
  
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
+
== Prerequisite ==
  
=== Configure ===
+
* 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)
  
Using raspi-config enable
+
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.
Expand Filesystem
+
Enable Camera
+
Set hostname
+
Enable SSH
+
Enable i2c - load module as default
+
Disable Serial login
+
  
reboot
+
====Make SD card a FAT32 partision, if reusing an old card====
  
=== Login ===
+
A new SD-card is fine as is, else
  
login as pi, password raspberry
+
see http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/ for instruction to prepare any old or new SD-card
  
add a user called local
+
====Add boot-files to SD card====
  
sudo adduser local
+
=====RPI imager =====
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
+
Version 10 (buster) is easily installed using the 'Raspberry pi imager',
 +
on Linux install with
  
  su - local
+
  snap install rpi-imager
  groups
+
  rpi-imager
ifconfig
+
  
Note the inet address.
+
and follow the screen
  
Now it is possible to login from network.
+
=====manual =====
  
'''Do NOT login as root'''
+
or
  
=== Packages needed for Mobotware RHD/MRC ===
+
Get the install zip-file from https://www.raspberrypi.org/downloads/noobs/  
  
The following packages needs to be installed - e.g. using apt-get like:
+
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)
  
sudo apt-get install subversion
+
====Reboot====
  
Package list:
+
* Insert SD card on Raspberry,
 +
* Mount a heatsink - especially needed on version 4,
 +
* Connect monitor, keyboard and (USB) power
  
subversion  (to fetch mobotware from SVN)
+
That is all, Raspberry should boot on that, and take some time to prepare the SD-Card.
libexpat-dev  (RHD)
+
Or see instructions on e.g.: https://www.raspberrypi.org/help/noobs-setup/
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) ===
+
* Boot the raspberry and install the Raspberry Pi OS full (Debian).
 +
* On the bottom of the screen select keyboard layout and language,
  
Package list
+
Settings
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 ===
+
* 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.
  
 +
==Usefull Linux commands==
  
 +
Here are some common commands in Linux
  
Get and unpack mobotware - you need the following directories only for RHD and MRC:
+
ls    (directory file list)
  mobotware/aumat
+
cd    (change to home directory)
  mobotware/mrc
+
cd some_directory    (change to a subdirectory)
  mobotware/rhd
+
exit  (logout, e.g. of a ssh session)
  mobotware/build
+
grep -n string_to_look_for_in_a_file  *.cpp    (find a string in a file, e.g. a variable or a function)
The rest of the directories can be deleted, so can rhd/branches
+
  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)
  
=== Modify makefiles ===
+
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.
  
Enter the mobotware directory
+
== Configure ==
  
cd mobotware-XXX
+
==== Raspberry ====
  
==== main Makefile ====
+
use raspi-config, start a terminal:
  
  nano -w Makefile
+
  sudo raspi-config
  
Change this section
+
Using ''raspi-config''
 
+
  Enable Camera
APPSUBDIRS = aumat/trunk \
+
  Set hostname (one word, no space)
    aurobotservers/trunk/include \
+
  Enable SSH
    aurobotservers/trunk/libs \
+
  Disable Serial login
    mapbase/trunk \
+
  boot as a console with login
    rhd/trunk \
+
  Update firmware
    mrc/trunk \
+
  Set locale to "en_DK.UTF-8 UTF-8" (danish keyboard, but English language)
    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)
+
autof2 auptgray (12th line)
+
 
+
===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.
+
=== Update operating system ===
  
===Performance===
+
Ensure you have internet access, then
  
The RHD and MRC running in idle with an update rate of 100 HZ is consuming about 3-4% CPU load each.
+
sudo apt-get update
 +
sudo apt-get dist-upgrade
 +
sudo reboot

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