Commit 51020d7a authored by beuchatp's avatar beuchatp
Browse files

Updated wiki with instructions relating to installation, IP addresses, and...

Updated wiki with instructions relating to installation, IP addresses, and network configuration for Raspberry Pi
parent 2089f248
# Table of Content
The wiki is split into the following sections
- [Installation and Setup](install_and_setup/README.md)
- [ROS structure](ros_structure.md)
- [Workflow for students](workflow_for_students.md)
- [FAQs](faq.md)
- [ROS structure](ros_structure/README.md)
- [Workflow for students](workflow_for_students/workflow_for_students.md)
- [FAQs](faq/faq.md)
# Installation ToC:
- [Installation](installation.md)
- [Installation on a computer already running Ubuntu](installation_on_ubuntu.md)
- [Installation of Ubuntu on a RaspberryPi](installation_of_ubuntu_on_raspberry_pi.md)
- [Network configuration of a RaspberryPi](network_configuration_of_raspberry_pi.md)
- [Installation of the ``dfall-system`` on a RaspberryPi](installation_of_dfall_on_raspberry_pi.md)
- [IP address and internet access for on a RaspberryPi](ip_address_and_internet_access_for_raspberry_pi.md)
# Setup ToC:
......
# Raspberry Pi Installation
## Install ROS
Download the appropriate installation script
```
dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh
```
Change the permissions of the file to make it executable using the command
```
chmod +x dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh
```
Run the installation script using the command
```
./dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh
```
## Install the apache web server
```
sudo apt install apache2
```
## Install php
```
sudo apt install php
```
## Permanently Disable IPv6
Taken from: https://www.configserverfirewall.com/ubuntu-linux/ubuntu-disable-ipv6/
Open the ``/etc/sysctl.conf`` file for editing:
```
sudo nano /etc/sysctl.conf
```
Add the following lines at the end of the ``sysctl.conf`` file:
```
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
```
To make the change take effect, enter the command:
```
sysctl -p
```
Then, enter the following command to check the IPv6 status:
```
less /proc/sys/net/ipv6/conf/all/disable_ipv6
```
If the output is 1 then IPv6 is disabled, otherwise, if the output 0 then IPv6 is enabled.
To re enable IPv6 addresses, simply remove the above changes made to the ``sysctl.conf`` file and then enter the ``sysctl -p`` command.
## Clone the ``dfall-system`` repository
Create a shared folder
```
cd /home
sudo mkdir www-share
sudo chmod 777 www-share
cd www-share
sudo -u www-data mkdir dfall
sudo -u www-data chmod 775 dfall
```
Clone the repository:
<br>
NOTE: very important here is that the repository is cloned as ``the www-data`` user.
```
cd /home/www-share/dfall
sudo -u www-data git clone https://gitlab.ethz.ch/dfall/dfall-system
```
Add the necessary line to the ``/etc/sudoers`` file that allows the ``www-data`` user to execute ``git pull`` commands:
```
www-data ALL=(www-data) /usr/bin/git pull
```
Add the ``www-data`` user to the ``plugdev`` group
<br>
NOTE: this is the group nominated in the ``udev rules`` for the CrazyRadio (see the ``install`` folder. This allows a CrazyRadio node that is launched by the web interface to access the CrazyRadio USB dongle.
```
sudo usermod -a -G plugdev www-data
```
To confirm the group allocation, view the ``group`` file using the command:
```
less /etc/group
```
If you need to remove a user from a group, then use the command:
```
deluser www-data plugdev
```
where the syntax here is: ``deluser <username> <groupname>``
## Copy across the 99.crazy.rules
## Make the ``www-data`` user the owner of the ``/var/www/`` folder
This is required so that the web interface can be update by calling a php script that deletes all the contents of the ``/var/www/`` folder and copies the web interface files from the ``dfall-system`` repository that was cloned to above the location ``/home/www-share/dfall``.
Enter the following commands:
```
sudo chown -R www-data /var/www
sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
```
## Copy across the website
Enter the following command:
```
sudo -u www-data cp -R /home/www-share/dfall/dfall-system/web_interface/html/* /var/www/html/
```
## Useful commands
The apache web server can be ``{stop,start,restart,reload}`` using the ``systemctl`` command as follows:
```
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl restart apache2.service
sudo systemctl reload apache2.service
```
# Raspberry Pi Installation
## CREATE THE SD CARD WITH THE PRE-INSTALLED UBUNTU SERVER IMAGE
On this page:
- [Installing Ubuntu server](#installing-ubuntu-server)
- [Standard configuration steps for Ubuntu server](#standard-configuration-steps-for-ubuntu-server)
## INSTALLING UBUNTU SERVER
### Create an SD card with the pre-installed Ubuntu serve image
This step is to flash the Ubuntu 18.04 image onto the SD card for the Raspberry Pi. The following instructions are taken from the Raspberry Pi website:
https://www.raspberrypi.org/documentation/installation/installing-images/
......@@ -19,26 +27,28 @@ Insert the SD card into your computer, open the Disk Utility application, and fo
Format: MS-DOS (FAT)
Scheme: Master Boot Record
Open teminal and use the command ``diskutil list`` to identify which disk coresponds to the SD card, where you are looking for the label of the form ``disk2`` and NOT the label of the form ``disk2s1``
Open terminal and use the command ``diskutil list`` to identify which disk corresponds to the SD card, where you are looking for the label of the form ``disk2`` and NOT the label of the form ``disk2s1``
Unmount all partitions of the SD card using the command
Unmount all partitions of the SD card using the command:
```
diskutil unmountDisk /dev/disk<disk# from diskutil>
```
Copy the Ubuntu image to the SD card using the command
```sudo dd bs=1m if=~/Downloads/image.img of=/dev/rdisk<disk# from diskutil> conv=sync```
Copy the Ubuntu image to the SD card using the command:
```
sudo dd bs=1m if=~/Downloads/image.img of=/dev/rdisk<disk# from diskutil> conv=sync
```
The copying will take a few minutes and not display any status infromation. It is possible to retireive the current progress by pressing ``Ctrl+T`` to send the ``SIGINFO`` signal to the respective terminal where the command is running.
The copying will take a few minutes and not display any status information. It is possible to retrieve the current progress by pressing ``Ctrl+T`` to send the ``SIGINFO`` signal to the respective terminal where the command is running.
Once the copy has completed, eject the SD card using the command:
```sudo diskutil eject /dev/rdisk<disk# from diskutil>```
```
sudo diskutil eject /dev/rdisk<disk# from diskutil>
```
## CHANGE THE BOOT-LOADER FOR RASPBERRY PI 3 B+
### Change the boot-loader for RaspberryPi 3 B+
Insert the SD card into your computer and open the ``config.txt`` file in your favourite editor. Adjust the lines:
```
kernel=...
......@@ -56,56 +66,48 @@ https://www.raspberrypi.org/forums/viewtopic.php?t=233794
## FIRST BOOT OF UBUNTU ON THE RASPBERRY PI
### First boot of Ubuntu on the RaspberryPi
This step is to insert the SD card into the Raspberry Pi, boot it up, and setup the Ubuntu installation. For this first boot it is required to have a wired internet connection that does not require any authentification.
This step is to insert the SD card into the Raspberry Pi, boot it up, and setup the Ubuntu installation. For this first boot it is required to have a wired internet connection that does not require any authentication.
After booting you are prompted to enter the username and password, which are ``ubuntu`` and ``ubuntu`` respectively. You are then asked to change the password.
After entering the new password there is sometimes the error ``Authentication token manipulation error``, the screen clears, and you are again prompted for the username and password. This error relates to some problem with the write access for setting the new password. To overcome this error, shutdown the Raspberry Pi (simply unplug the power), remove the SD card and insert the SD card into your computer. Open the ``cmdline.txt`` using your favourite editor and add the following at the end of the line:
```
init=/bin/sh
```
NOTE: this ``cmdline.txt`` file should be use one line of text, and each command should separated by a space. So if the file orginally looks like:
NOTE: this ``cmdline.txt`` file should be use one line of text, and each command should separated by a space. So if the file originally looks like:
```
previous content of file
```
Then the file after editing should look like:
```
previous content of file init=/bin/sh
```
Put the SD card back into the Raspberry Pi and power it up. A few boot steps are performed and then you are presented with a cursor. At the prompt type the following command (if you are presented with an error message, then simply type the command again):
```
mount -o remount, rw /
```
The results should be a message something like:
```
EXT4-fs (mmcblk0p2): re-mounted. 0pts: (null)
```
Now update the password for the ubuntu user using the command:
```
passwd ubuntu
```
You are prompted to enter the new password twice, and then the following message should be displayed:
```
passwd: password updated successfully
```
Now type the following commands:
```
sync
exec /sbin/init
......@@ -114,7 +116,6 @@ exec /sbin/init
The Raspberry Pi now continues to boot normally, and you can log into with the username ``ubuntu`` and the new password you set.
Shut down the Raspberry Pi using the command:
```
sudo halt
```
......@@ -129,7 +130,10 @@ These steps to reset the password were taken from:
https://www.raspberrypi-spy.co.uk/2014/08/how-to-reset-a-forgotten-raspberry-pi-password/
## UPGRADE ALL SOFTWARE
## STANDARD CONFIGURATION STEPS FOR UBUNTU SERVER
### Upgrade all software
This may be started automatically, and when you try the commands:
......@@ -172,40 +176,34 @@ sudo systemctl disable apt-daily-upgrade.service
## FAILED TO START LOAD KERNEL MODULES ERROR
### Correct the error: ``failed to start load kernel modules``
While booting, one item is listed in red as ``FAILED`` with the message:
```
Failed to start Load Kernel Modules
```
Once logged in, run the following command to list the various system ``units`` and their status:
```
systemctl list-units
```
In the list you should see the unit ``system-modules-load.service`` that is described as ``Load Kernel Modules`` and is indicated as ``loaded`` but the ``active`` and ``sub`` flags are both ``failed``. You can get more information about this error by using the command:
```
systemctl status systemd-modules-load.service
```
The status that is printed out will likely indicate the error as:
```
Failed to find module ib_iser
```
Looking through various forums posts about this error message, it seems the best course of action is to edit the file:
```
nano /lib/modules-load.d/open-iscsi.conf
```
and comment out the ``ib_iser`` line, i.e., change the line to ``#ib_iser``. You can then test if this resolves the error by either a ``reboot``, or by restarting the service and then checking its status with the following commands:
```
systemctl restart systemd-modules-load.service
systemctl status systemd-modules-load.service
......@@ -214,12 +212,12 @@ systemctl status systemd-modules-load.service
Note that even if left un-resolved, this error does not prevent the installation and running of ROS-Melodic and the dfall-system software.
## CREATING AND ENABLING A SWAP FILE
### Creating and enabling a swap file
Whether or not you plan to run resource hungry software (for example web-browsing), it can be useful to create a swap file partition to avoid out-of-memory errors. Although using a swap file for memory is much slower than the on-board RAM, and may cause the SD card to wear out quicker, it does avoid a system crash during those operations that require high memory.
Create the swap file with the following commands
```
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
......@@ -228,22 +226,19 @@ sudo swapon /swapfile
```
Specify that the swap file is to be use by adding the following entry to ``/etc/fstab``:
```
/swapfile swap swap defaults 0 0
```
Using ``sudo nano /etc/fstab`` is a easy wasy to edit the file, and using ``less /etc/fstab`` is an easy way to check that the edits were correctly saved.
Using ``sudo nano /etc/fstab`` is an easy way to edit the file, and using ``less /etc/fstab`` is an easy way to check that the edits were correctly saved.
Reboot the Raspberry Pi (simply use the command ``reboot``). And upon rebooting, check that the swap file is available using the command:
```
sudo swapon --show
```
The outpuut should look something like:
The output should look something like:
```
NAME TYPE SIZE USED PRIO
/swapfile file 1024M 0B -2
......@@ -252,9 +247,10 @@ NAME TYPE SIZE USED PRIO
This step was also taken from:
https://www.raspberrypi.org/forums/viewtopic.php?t=233794
## REMOVING THE CLOUD INIT SERVER CAPABILITY
### Removing the cloud init server capability
As the Ubuntu image is a server image, it comes pre-installed with cloud-init. The boot time of the Raspberry Pi can be slower due to cloud-init, so if you do not plan to actually use the Raspberry Pi as a server, then cloud-init can be safely removed with the following commands:
```
......@@ -267,21 +263,21 @@ https://www.raspberrypi.org/forums/viewtopic.php?t=233794
## INSTALL A GRAPHICAL DESKTOP INTERFACE
### Install a graphical desktop interface
For example:
```
sudo apt-get install lubuntu-desktop
```
```sudo apt-get install lubuntu-desktop```
Other desktops are available, for example ``xubuntu-desktop`` and ``kubuntu-desktop``, but the dfall-system has only been tested to work with ``lubuntu-desktop``. Note that this can take upto an hour to install.
Other desktops are available, for example ``xubuntu-desktop`` and ``kubuntu-desktop``, but the dfall-system has only been tested to work with ``lubuntu-desktop``. Note that this can take up to an hour to install.
## ADD REPOSITORIES FOR MAIN, UNIVERSE, MULTIVERSE, RESTRICTED
### Add repositories for main, universe, multiverse, and restricted
These should already be added by default, but you can check they are added by simply trying to add them (again) using the following commands:
```
sudo add-apt-repository main
sudo add-apt-repository universe
......@@ -289,95 +285,4 @@ sudo add-apt-repository multiverse
sudo add-apt-repository restricted
```
If any of these were not already added, then run ``sudo apt update`` and ``upgrade``.
## INSTALL THE dfall-system
Download the appropriate installation script
```dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh```
Change the permissions of the file to make it executable using the command
```chmod +x dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh```
Run the installation script using the command
```./dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh```
## SETUP THE FIXED IP ADDRESS
The networking is handled by ``netplan`` and hence network specifications are contained in the ``/etc/netplan`` folder. As installed, this folder should contain only one file named ``50-clound-init.yaml``, and the contents of the file should look something like:
```
network:
version: 2
ethernets:
eth0:
dhcp4: true
match:
macaddress: xx:xx:xx:xx:xx:xx
set-name: eth0
```
If using a desktop environment, then you specify that the ``network-manager`` provided by the desktop is in charge of managing connections by editing the file to be:
```
network:
version: 2
renderer: NetworkManager
```
To make this change active, first validate the changes by using the command:
```
sudo netplan try
```
This should return a message informing you whether the new configuration is valid or not. If the configuration is not valid, then the system revert to the previous settings, and the likely cause of the error is a typing mistake.
Once validated, apply the changes using the following command:
```
sudo netplan apply
```
If you did not install a desktop environment, i.e., you are running "headless" Ubuntu, then you can set the fixed IP address by editing the ``50-clound-init.yaml`` file to be the following:
```
network:
version: 2
ethernets:
eth0:
dhcp4: false
addresses: [10.42.0.11/24]
gateway4: 10.42.0.0
nameservers:
addresses: [8.8.8.8,8.8.4.4]
```
The address ``10.42.0.11/24`` should be replaced by the IP address and netmask you desire. The ``/24`` specified the most comment netmask of ``255.255.255.0``. It is also possible to leave out the ``gateway4`` and ``nameservers`` specifications if the defaults are appropriate.
Then ``try`` and ``aply`` the changes as described above.
The following are some useful commands for checking the current connection status:
```
ifconfig
```
```
nmcli c show
```
If any of these were not already added, then run ``sudo apt update`` and ``upgrade``.
# Installation
On this page:
- [For student and teacher](#for-stuent-and-teacher)
- [Vicon Datastream SDK installation](#vicon-datastream-sdk-installation)
- [Additional steps for teacher](#additional-steps-for-teacher)
- [Steps for adding a Crazyflie to the system](#steps-for-adding-a-crazyflie-to-the-system)
## For Student and Teacher
### Install Script
......@@ -103,7 +110,7 @@ If you follow the steps above, then the ``<catkin workspace>`` should be ``~/dfa
If you are not sure at any point you can check out the ``dfall_install.sh`` script.
### Vicon Datastream SDK Installation
## Vicon Datastream SDK Installation
A Vicon motion capture system can be used to provide position and attitude measurements of the Crazyflie and close the feedback loop. The software provided by Vicon is propriety and hence is not included in this piece of Open Source software. In order to make the position and attitude data accessible over the network, the piece of software called the Datastream SDK needs to be downloaded and placed in the correct folder. Complete the following steps to achieve this:
......
# Raspberry Pi Installation
On this page:
- [Finding the IP address of your RaspberryPi](#finding-the-ip-address-of-your-raspberry-pi)
- [Getting internet access on your RaspberryPi](#getting-internet-access-on-your-raspberry-pi)
## FINDING THE IP ADDRESS OF YOUR RASPBERRY PI
As mentioned in the wiki page [Network configuration of a RaspberryPi](network_configuration_of_raspberry_pi.md), if your RaspberryPi is configured to receive a dynamically allocated IP address from the host to which it is connected, then discovering the IP address of the RaspberryPi can be quite a battle.
### Login to the router and look up the list of all connected devices
It is difficult to provide generic instructions for this, but the steps should be something like the following:
**(a)** Locate the sticker on the back of your router which provides the various default settings.
<br>
**(b)** On a computer connected to your router's network, open an internet browser window and visit the IP address indicated on the back of the router. This should bring up a login screen for the router.
<br>
**(c)** Login to the router using the password indicated on the back of the router.
<br>
**(d)** Navigate the settings of the router to display the IP addresses of all connected devices. If the location of this list is not obvious from the menu items, try poking around in something like the "network" or DHCP settings.
<br>
**(e)** The IP address of the RaspberryPi will be one of those listed. If displayed, the "Device Name" of the RaspberryPi will be "ubuntu".
If it is not possible to follow these steps, then try googling instructions for the brand and model of your router.
### Ping the broadcast address of the network
Another way to find the IP addresses of connected devices is to ping the broadcast address of the network. This method will only show the IP address of those connected devices that are configured to respond to a broadcast ping, and thus the RaspberryPi is configured to repond to such broadcast ping (see wiki page [Installation of Ubuntu of RaspberryPi](installation_of_ubuntu_on_raspberry_pi.md)).
The easiest way to find the IP address of the network is to look at the IP configuration of your own computer. The following steps are one amongst many ways to do this:
**(a)** On a computer connected to your router's network, open an terminal window (on Mac or Linux) or a command prompt (on Windows)
<br>
**(b)** Show the IP configuration of your computer using the command ``ifconfig`` (on Mac or Linux) or ``ipconfig`` (on Windows)
<br>
**(c)** In the output look for the entry corresponding to the network connection of interest (WiFi or ethernet) and find the line that provides the broadcast address. This might look something like the following:
```
inet 192.168.0.123 netmask 0xffffff00 broadcast 192.168.0.255
```
**(d)** Hence the broadcast address for this example is ``192.168.0.255``
<br>
**(e)** Still in the terminal or command prompt window, ping the broadcast address with one of the following commands:
> On Mac OS X: ``ping -b 192.168.0.255``
<br>
> On Ubuntu 18.04: ``ping 192.168.0.255``
<br>
> On Windows: ``ping 192.168.0.255``
**(f)** The IP address of the RaspberryPi should be one of the IP addresses from which a response is received. As an example, the output of the ping should look something like the following:
```
PING 192.168.0.255 (192.168.0.255): 56 data bytes
64 bytes from 192.168.0.123: icmp_seq=0 ttl=64 time=0.121 ms
64 bytes from 192.168.0.101: icmp_seq=0 ttl=64 time=116.900 ms
64 bytes from 192.168.0.77: icmp_seq=0 ttl=64 time=525.345 ms
```
**(g)** To figure out which address corresponds to the RaspberryPi, open an internet browser window and visit each address separately until you get the web interface hosted by the RaspberryPi. For the example ping output above, the IP address of the RaspberryPi is either ``192.168.0.123``, ``192.168.0.101``, or ``192.168.0.77``.
## GETTING INTERNET ACCESS ON YOUR RASPBERRY PI
It is useful for the RaspberryPi to have internet access so that you can ``git pull`` the latest version of the ``dfall-system`` repository via the web interface. The information below describes how to give internet access to the RaspberryPi for a few possible network configurations.
### When the RaspberryPi is plugged directly into your home router
By default, most home router will provide internet access to any device that is plugged directly into one of the router's ethernet ports. If that is the case, then this option is by far the easiest, simply plug into your RaspberryPi and you are good to go. Though if the RaspberryPi is configured to receive a dynamically allocated IP address, then you need to follow the hints above to find its IP address.
If you home router does NOT provide internet access to a device that is plugged directly into one of the router's ethernet ports, then you are on your own. But this is fine, because you or someone in your household likely chose this setting, and that person should know how to adjust the setting to allow the RaspberryPi to access the internet. Failing that, ask google about changing the configuration of your router, or press and hold the reset button that is usually hidden on the back of the router.
### When the RaspberryPi is plugged directly into your computer