MRS System
Unscripted video tutorial - https://www.youtube.com/watch?v=CWyTZV24zFY
Setting up a completely new UAV
- Connect a screen, keyboard and mouse to your computer
- Install Ubuntu 20.04
- After installation is finished, connect to the internet (WiFi or Ethernet, look in the top right corner of the screen for network management)
Something about linux file structure and users
- It is similar to Windows as in it is divided into directories and files.
- There are different users in linux, in our case there are two:
- mrs(or any other name) - the actual user of the computer (you) with limited privileges
- root - the administrator with full privileges
- The mrs user does not have administrator privileges and so by default you cannot do dangerous stuff like deleting all the files on the computer.
- There is a concept of file/directory ownership, in our case some files/directories are owned by the mrs user and some by the root. The mrs user cannot modify files/directories owned by the root user by default.
- The top directory (also called root directory) is simply
/, everything else is located in this directory (similar to C: in Windows) - The directory which belongs to the mrs user is located in
/home/mrs. This directory is often called the "home directory" The mrs user owns everything in this directory, while root owns most of everything else.- All of the user stuff like documents, downloads, stuff on the desktop, git repositories and the MRS UAV System are located in the home directory
- Lower level system stuff and programs are located in different directories owned by the root, like
/etc/bin/dev - There are hidden files, not normally visible to the user, which we have to work with sometimes. The hidden filenames start with a
.e.g..bashrc. These files will not show up normally when you are looking through the filesystem
Basic linux navigation
- Everything important happens in the terminal! On clean Ubuntu, open the terminal by pressing the start key on your keyboard and type "terminal" into the search box. You can also use the shortcut Ctrl-Alt-T
- When you first open up a terminal, it will look like this:
- the mrs is the user, mrs is also the hostname (hence mrs@mrs)
- the
~is the current active directory.~is equivalent to the home directory mentioned above (/home/mrs/) - if you navigate to a different directory, it can look like this:
-
here we changed the directory to
~/git/uav_corewhich is the same as/home/mrs/git/uav_core -
Basic commands to navigate the terminal:
cd directory_namechange directory, example:cd gitorcd git/uav_corecd ..change directory one directory up, example:
-
cdwithout anything else will move you to the home directory (~or/home/mrs/) -
lswill list out the contents of a directory -
llwill do the same thing, but print out more details (like who owns which file) and show hidden files (files beginning with.like.bashrc) -
mv what wherewill move a file (what) from one place to another (where) (it is also used to rename files) example:mv pes.txt ~/Documents/textswill move pes.txt from the current directory to~/Documents/texts -
cp what wherewill copy a file, works the same asmvbut also keeps the original file -
rm whatwill delete a file called what (does not work with directories) example:rm pes.txt -
rmdir whatwill delete a directory called what(only works for empty directories) example:rm Documents -
rm -rf whatwill delete a file/directory with all of its sub-files and sub-directories (use with caution) example:rm -rf Documents -
cat what- prints out file contents -
mkdir what- creates a new directory -
touch what- creates a new file -
You will also need to use a terminal-based text editor, there are two options:
- nano - easy to use by beginners, but that is all
- vim - harder to learn, but much more powerful, used by almost all of the MRS members for most things
-
To edit a file with one of these editors, simply type
nano filenameorvim filename -
If you need to edit a file owned by root, or need to execute a command which requires the administrator privileges, you need to invoke it with
sudo- super user do. You will be prompted for the password (mrs by default)- example:
sudo vim /etc/hoststo edit root-owned files - example:
sudo apt updateto call a command with root privileges
- example:
-
To install a new program/library from the linux package database, call:
sudo apt update- to update the list of available packagessudo apt install what- to install. example:sudo apt install vimwill install vim
Basic system installation
- Install the MRS UAV System Native installation, do not use Singularity on UAVs! - you can follow the readme, but in the end you have to just copy and run this command (in the terminal):
cd /tmp
echo '
GIT_PATH=~/git
mkdir -p $GIT_PATH
cd $GIT_PATH
sudo apt-get -y install git
git clone https://github.com/ctu-mrs/mrs_uav_system
cd mrs_uav_system
git checkout master
git pull
./install.sh -g $GIT_PATH
source ~/.bashrc' > clone.sh && source clone.sh
- You can also install Tomas Baca's linux-setup which will install nice-to-have utilities which will make the work with the UAV easier (customized vim, ranger file explorer etc.). This is not required for the UAV to work and by default, do not put this on UAVs for F4F customers. The installation process is similar to the UAV System, just copy and paste this into the terminal:
cd /tmp
echo "mkdir -p ~/git
cd ~/git
sudo apt-get -y install git
git clone https://github.com/klaxalk/linux-setup.git
cd linux-setup
./install.sh" > run.sh && source run.sh
Configuration after installation
- Network
- we do not use the default Network Manager on UAVs, we use a thing called netplan
- first, we need to fix network interface names. Go to our scripts folder:
cd ~/git/mrs_uav_deployment/miscellaneous/scriptsand run the script which fixes the names:./fix_network_interface_names.sh - While we are here, you should also run
./disable_hubernation.sh - You can also setup the WiFi switcher by running
sudo ~/git/uav_core/miscellaneous/configurator_scripts/setup_configurator_call_with_sudo.sh - now reboot your computer
reboot - After reboot, lets disable the Network Manager. Go to our scripts folder again:
cd ~/git/uav_core/miscellaneous/scriptsand run the script which disables network manager./disable_network_manager.sh - Now go to the netplan config folder
cd /etc/netplan - delete all the files here, we will replace them with our own (
lsto see the files,sudo rm filenameto delete. Note, these files are owned by root, we need sudo to delete them) - Now navigate to a folder with our netplan settings:
cd ~/git/uav_core/miscellaneous/network_settingshere you can calllsand see a file named01-netcfg.yaml - Move this file to
/etc/netplanso:sudo mv 01-netcfg.yaml /etc/netplan - Edit this file to change the WiFi that you want to connect to, the IP addresses etc. When editing this file, you need to use
sudo!
- Now that you have configured the network you can continue to work on the computer remotely, without having the screen/keyboard/mouse attached. This is much more convinient when working with UAVs in the field. First, lets test that we can connect through ssh. Firtly, install ssh on the computer:
sudo apt updatefollowed bysudo apt install ssh. - Now go to your regular laptop/computer and connect to the same WiFi network that the UAV's computer is connected
- Try to ping the UAV's computer
ping ip_addressexample:ping 192.168.69.105If you see an output like this:
then the UAV is responding and everything is set up correctly. If not, check that both your and the UAV's computer are conencted to the same network, and check that the UAV has a correct IP address (get the IP address by calling ip a). - Once you can ping the UAV's computer, lets try connecting over SSH. Type this on your laptop:
ssh mrs@ip_addresswhere mrs is the user name on the UAV's computer and the ip_address is the address of the UAV's computer, so: 'ssh mrs@192.168.69.105'. You will be prompted by a yes/no prompt when connecting for the first time, so just typeyes. You will also be prompted for the password to the UAV's computer, which is usually mrs. - After you fill out the password correctly, you are connected to the UAV over SSH! This is basically a terminal opened on the UAV's computer, but through network, so you can command the terminal on the UAV from your own computer.
- Once you can SSH, feel free to disconnect the screen/keyboard/mouse from the UAV's computer and continue only on your laptop.