Install on raspberry

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
 
(18 intermediate revisions by one user not shown)
Line 1: Line 1:
Short note on installation of (parts of) mobotware on Raspberry Pi (or Beagle-bone)
+
Back to [[Robobot]]
 +
 
 +
Back to [[Flexbot]]
  
  
Line 10: Line 12:
 
* Access to network (wired or wifi)
 
* 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)
 
* 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.
  
 
====Make SD card a FAT32 partision, if reusing an old card====
 
====Make SD card a FAT32 partision, if reusing an old card====
Line 18: Line 22:
  
 
====Add boot-files to SD card====
 
====Add boot-files to SD card====
 +
 +
=====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
 +
 +
=====manual =====
 +
 +
or
  
 
Get the install zip-file from https://www.raspberrypi.org/downloads/noobs/  
 
Get the install zip-file from https://www.raspberrypi.org/downloads/noobs/  
Line 33: Line 51:
 
* Insert SD card on Raspberry,
 
* Insert SD card on Raspberry,
 
* Mount a heatsink - especially needed on version 4,
 
* Mount a heatsink - especially needed on version 4,
* Connect monitor, keyboard and power
+
* Connect monitor, keyboard and (USB) power
  
 
That is all, Raspberry should boot on that, and take some time to prepare the SD-Card.
 
That is all, Raspberry should boot on that, and take some time to prepare the SD-Card.
Line 40: Line 58:
 
* Boot the raspberry and install the Raspberry Pi OS full (Debian).
 
* Boot the raspberry and install the Raspberry Pi OS full (Debian).
 
* On the bottom of the screen select keyboard layout and language,
 
* 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.
 +
 +
==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.
  
 
== Configure ==
 
== Configure ==
Line 50: Line 100:
  
 
Using ''raspi-config''
 
Using ''raspi-config''
Expand Filesystem (if not OK already)
 
Set keyboard layout
 
 
  Enable Camera
 
  Enable Camera
  Set hostname
+
  Set hostname (one word, no space)
 
  Enable SSH
 
  Enable SSH
Enable i2c - load module as default
 
 
  Disable Serial login
 
  Disable Serial login
 
  boot as a console with login
 
  boot as a console with login
Line 68: Line 115:
 
  sudo apt-get dist-upgrade
 
  sudo apt-get dist-upgrade
 
  sudo reboot
 
  sudo reboot
 
=== Login ===
 
 
login as ''pi'', password ''raspberry'' - password may have changed
 
 
Add a user called local, this leaves the pi user as is.
 
This can save reformatting and reinstall when the Pi is to be reused.
 
 
add a user called ''local''
 
 
sudo adduser local
 
sudo usermod -a --groups adm,cdrom,sudo,audio,video,plugdev,games,users,netdev,input,spi,gpio,i2c,dialout 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 (as ''local'') from network.
 
 
=== Get access using hostname ===
 
 
You may change the hostname by changing the name in /etc/hostname. If you do so, then you should probably restart before the new hostname works.
 
 
Now from another PC on the local network
 
 
ping hostname.local
 
 
where "hostname" is replaced with the hostname in /etc/hostname.
 
 
=== Get filesystem on normal Linux PC ===
 
 
From another (Linux) PC, mount the raspberry filesystem
 
 
mkdir rpi  (where the filesystem will be mounted)
 
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.
 
 
for other access, use (with IP address as found above, or IP replaced with ''hostname.local'')
 
 
ssh -X local@10.59.8.141
 
 
=== Packages needed ===
 
 
sudo apt install cmake
 
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk2.0-dev
 
sudo apt install libatlas-base-dev gfortran alsa-tools jackd1
 
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev subversion libreadline-dev htpdate aptitude
 
# video for linux had some error, maybe this will help
 
cd /usr/include/linux
 
sudo ln -s -f ../libv4l1-videodev.h videodev.h
 
# opencv
 
# sudo apt install libopencv-dev (sorry, installs opencv 2.4 (jan 2020), with no ArUco code support)
 
 
==== NB! Stop here if you install ROBOBOT ====
 
 
==== Opencv ====
 
 
As of June 2019 opencv 3.2 is installed using line above - NO, it is back to 2.4 on noops 3.2.1 (jan 2020/jca)
 
 
Newer version of Opencv could be installed manually if you really need functions not available in 3.2.
 
For newer installation use
 
 
# make a directory for the opencv source
 
cd
 
mkdir -p git
 
cd git
 
# get source
 
wget -O opencv-3.4.zip https://github.com/Itseez/opencv/archive/3.4.zip
 
unzip opencv-3.4.zip
 
wget -O opencv_contrib-3.4.zip https://github.com/Itseez/opencv_contrib/archive/3.4.zip
 
unzip opencv_contrib-3.4.zip
 
# you will need this - if you use python - takes some minutes
 
pip install numpy
 
# prepare compilation
 
cd ~/git/opencv-3.4/
 
mkdir build
 
cd build
 
cmake -D CMAKE_BUILD_TYPE=RELEASE \
 
    -D CMAKE_INSTALL_PREFIX=/usr/local \
 
    -D INSTALL_PYTHON_EXAMPLES=ON \
 
    -D OPENCV_EXTRA_MODULES_PATH=~/git/opencv_contrib-3.4/modules \
 
    -D BUILD_EXAMPLES=ON ..
 
# inspect printout to see if needed features are enabled
 
# use -j2 option not to overload or overheat the processor (j2 means use 2 cores only)
 
# this probably takes an hour or so
 
make -j2
 
# install into /usr/local
 
sudo make install
 
# load environment settings
 
sudo ldconfig
 
 
== Mobotware ==
 
 
[[Mobotware on raspberry]]
 

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