Raspberry and ROS

From Rsewiki

Back to Robobot

Do not use for now

Install Raspberry

Use Raspberry pi imager (download from https://www.raspberrypi.com/software/)

rpi-imager

First configure settings: click the gear icon, and set:

  • enable ssh, hostname, English language, Danish keyboard, possibly SSID, time zone, username (local) and password (remember to spell the password correctly).

then

Select operating system Ubuntu 22.04 64 bit server (for now) and storage, an empty SD-flash of at least 16GB, then write.

When finished mount the SD into the Raspberry

Start Raspberry

If everything is configured as above, then you just need to figure out the IP.

else

You need a screen and keyboard. Connect to the network to get an IP and for updating and date/time.

find your IP address using

sudo apt install net-tools nmap
ifconfig

or from another computer on the same local net (if your local net is 192.168.2.XX)

nmap -sP 192.168.2.0/24  

SSH from another computer

If the Raspberry has an IP of 192.168.2.39, then:

ssh local@192.168.2.39

Putty or other tools could be used too.

Install tools

Install subversion and other tools

ntp               # time setup
ntpdate           # time setup from DTU net
libreadline-dev   # command line memory
libopencv-dev     # openCV
python3-pyqtgraph # fancy graphs in Python
python3-scipy     # scientific functions 
pyqt5-dev         # QT designed GUI
pyqt5-dev-tools   # design QT GUI
festival          # text to sound
sox               # sound format read/write
libsox-fmt-all    # formats for SOX
apt-file          # for finding missing system files (optional)
qv4l2             # for testing camera (optional)
kate              # graphical editor (optional - nano is faster)
sudo apt install ntp ntpdate libreadline-dev subversion libopencv-dev python3-pyqtgraph python3-scipy pyqt5-dev pyqt5-dev-tools festival sox libsox-fmt-all apt-file kate qv4l2

NTP when on DTU net

Network time protocol, to keep clocks in sync. At DTU most clock sources are blocked, the clock source needs to be configured.

At DTU, edit /etc/ntp.conf, add ntp.ait.du.dk to the NTP server pool

...
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
pool ntp.ait.dtu.dk
pool 0.ubuntu.pool.ntp.org iburst
...

This should ensure a proper date, both on a DTU net and when internet is available elsewhere.

Sync time (if on DTU net)

sudo ntpdate -u ntp.ait.dtu.dk
date

Install ROS base

Will use Noetic (if it is ethical to do so).

Follow the instructions in http://wiki.ros.org/noetic/Installation/Ubuntu but it may fail with "The repository 'http://packages.ros.org/ros/ubuntu jammy Release' does not have a Release file."

The repository adds a file /etc/apt/sources.list.d/ros-latest.list. Modify the line in the file to be

deb [trusted=yes] http://packages.ros.org/ros/ubuntu jammy main

and then redo the

sudo apt update

Install ros-desktop-full-dev (or ros-desktop-full-dev) and a bit more to use a Catkin workspace

sudo apt install ros-desktop-full
sudo apt install python3-rosinstall
sudo apt install libmap-msgs-dev

Robobot from SVN

Install the needed Regbot and Fejemis packages. Fejemis is for the bridge, which also is a ROS bridge. Regbot is for the firmware and the user interface for sensor calibration.

We will install these packages in an 'svn' directory, and make an easy link to the relevant parts.

mkdir cvn
cd svn
svn checkout svn://repos.gbar.dtu.dk/jcan/fejemis
svn checkout svn://repos.gbar.dtu.dk/jcan/regbot

and then the links

cd
ln -s svn/regbot/regbot_gui
ln -s svn/fejemis/ROS/catkin_ws

Initialize the ROS environment

Initialize sets up the needed environment variables and makes a script for remaining settings for this project.

cd ~/catkin_ws
rosws init . /usr/share

This outputs a message about the location of a setup script

rosinstall update complete.
Type 'source /home/local/svn/fejemis/ROS/catkin_ws/setup.bash' to change into this environment. Add that source command to the bottom of your ~/.bashrc to set  it up every time you log in.

Put this script into ~/.bashrc, e.g. by

echo "source /home/local/svn/fejemis/ROS/catkin_ws/setup.bash" >> ~/.bashrc

Run catkin_make in the catkin_ws directory

cd ~/catkin_ws
catkin_make

Clone the just installed image

Use SD card clone/copier (on Raspberry??)

- rpi-clone script seems to work, but will not reboot.