forked from rmeertens/coursePaparazzi
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpart1_installing_and_running_paparazzi.tex
177 lines (134 loc) · 9.03 KB
/
part1_installing_and_running_paparazzi.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
\chapter{Installing and Running Paparazzi}
This chapter will guide you through the installation procedure of Ubuntu and the Paparazzi autopilot.
In the following chapters you will perform your first flight using Paparazzi, make the drone autonomous and implement your own algorithms.
\section{Installing Ubuntu}
For this course you are required to install Ubuntu.
If you are already running Ubuntu 18.04 or 20.04, skip to the next section.
Otherwise, follow the steps here to install Ubuntu in a dual-boot setup with your existing Windows installation.
This allows you to keep using your existing Windows installation next to Ubuntu.
While it is possible to install Ubuntu as a virtual machine, this frequently causes problems with networking, USB and GPU support. Therefore we do not support virtual machines during the course.
The dual-boot installation of Ubuntu requires you to format parts of your drive, therefore there is a small risk of losing important files.
Make sure you have backed up your files before starting the installation!
Follow this tutorial to install Ubuntu next to an existing Windows installation: \url{https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/}. We recommend you install Ubuntu 20.04 \url{https://www.ubuntu.com/download/desktop}. The rest of the course manuals assume that you are running Ubuntu 20.04.
Some useful tips and common issues:
\begin{itemize}
\item It may be useful to look up which function key (or combination of keys) your laptop manufacturer uses to enter the BIOS during start-up
\item Sometimes the system will not let you shrink a partition's volume, even though free space is available. This is caused by immovable files placed towards the end of the volume (see \url{https://en.wikipedia.org/wiki/File\_system\_fragmentation}). Windows or third-party defragmentation utilities can help fix this problem. \textbf{NOTE} that these tools could leave your system unable to boot, so a system backup is strongly advised!
\item If the Secure Boot option is grayed out in the BIOS, set the supervisor password in the BIOS
\item After installing Ubuntu, if your computer boots directly to Windows, check the UEFI settings in your BIOS (usually accessible by pressing F10 or another FN key right after powering on the laptop) and change the boot order from "Windows Boot Manager" to "ubuntu" or "\textit{name of your hard disk}"
\item Some BIOS let you add a delay at start-up to give you time to select which OS you would like to boot from. This can usually be changed in the BIOS Setup.
\item \textbf If you cannot manage to boot from the USB with the Ubuntu installation image it may be necessary to switch from UEFI Native to UEFI Legacy (With CSM) in the BIOS setup. The USB should then become visible in the Boot Device Options at startup (usually F9 during power-on)
\end{itemize}
\section{Installing Paparazzi}\label{sec:install}
Once Ubuntu is running, the next step is to install Paparazzi.
We have prepared a Github branch \href{https://github.com/tudelft/paparazzi/tree/\coursebranch}{here} that contains the Paparazzi autopilot and example files for the course. The rest of this manual will show you how to install Paparazzi.
Most steps require you to use Ubuntu's Command Line Interface (CLI), also known as the \emph{terminal}. You can open a terminal window by pressing Ctrl+Alt+T. Any commands that you need to run are listed as follows:
\begin{lstlisting}[style=Bash]
command 1
command 2
\end{lstlisting}
You need to type or copy these commands \emph{line-by-line} to the terminal, pressing enter after each line. In other words: do not copy \emph{all} commands at once, this can sometimes produce unexpected results. Note that pasting into the terminal uses Ctrl+\emph{Shift}+V, not Ctrl+V.
Use the following steps to download the course branch and install Paparazzi:
\begin{enumerate}
\item{Install Paparazzi UAV by opening a terminal (Ctrl+Alt+T).
\item In the folder you want to download the code, typically your home folder, do: (skip the first line if you already have git)
\begin{lstlisting}[style=Bash]
sudo apt-get install git
git clone https://github.com/tudelft/paparazzi.git
cd ~/paparazzi
./install.sh
\end{lstlisting}
Then install all required items 1 by one. If you run into trouble, also check \url{http://wiki.paparazziuav.org/wiki/Installation}
}
\item{During the course we will use \href{https://git-scm.com/}{git} to keep track of your code changes and to collaborate with your teammates. First, go to \url{https://github.com/} and set up an account if you do not have one already. Then, in the terminal, register your git credentials using
\begin{lstlisting}[style=Bash]
git config --global user.name !\hl{your\_name}!
git config --global user.email !\hl{your\[email protected]}!
\end{lstlisting}
where you should replace \texttt{your\_name} and \texttt{your\[email protected]} with the username and email you have registered at github.com.}
To collaborate with your team, 1 team member should fork the tudelft paparazzi branch on \url{https://github.com/tudelft/paparazzi/} and search for the FORK button. This will create a copy under your own name called \url{https://github.com/YOURNAME/paparazzi/}. Giving access to team mates is done in the settings of this new github copy.
Then the new copy should be added on all team computers with:
\begin{lstlisting}[style=Bash]
git remote add team1 [email protected]/!\hl{YOURNAME}!/paparazzi.git
\end{lstlisting}
Before you can write to this private copy, you need to get permission by installing an SSH key: \url{https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account}
\begin{lstlisting}[style=Bash]
git config --global user.name !\hl{your\_name}!
git config --global user.email !\hl{your\[email protected]}!
\end{lstlisting}
Before you can commit you should setup git correctly:
\begin{lstlisting}[style=Bash]
git config --global user.name !\hl{your\_name}!
git config --global user.email !\hl{your\[email protected]}!
\end{lstlisting}
\item Checkout the \coursebranch{} branch using:
\begin{lstlisting}[style=Bash]
git checkout !\coursebranch!
\end{lstlisting}
\item Initialize, sync and update Paparazzi's submodules. Submodules are other git projects included in this project. Use:
\begin{lstlisting}[style=Bash]
git submodule init
git submodule sync
git submodule update
\end{lstlisting}
\item Build Paparazzi by using:
\begin{lstlisting}[style=Bash]
make clean
make
\end{lstlisting}
\item{Select the conf and control panel files that were prepared for the course by running:
\begin{lstlisting}[style=Bash]
./start.py
\end{lstlisting}
and select as Conf: \fbox{userconf/tudelft/course\_conf.xml}\\
and as Controlpanel: \fbox{userconf/tudelft/course\_control\_panel.xml}.\\
Click `Set active' and close the dialog.}
\item Next to Paparazzi you will need some additional tools. Install ffmpeg, vlc, cmake, jstest-gtk and java using:
\begin{lstlisting}[style=Bash]
sudo apt install ffmpeg vlc cmake jstest-gtk default-jre
\end{lstlisting}
\item Install the Gazebo simulator. Gazebo version 9 is recommended for Ubuntu 18.04 and 20.04. For Ubuntu 22.04 the version is Gazeobo 11.
Install Gazebo 9 using:
\begin{lstlisting}[style=Bash]
sudo apt install gazebo9 libgazebo9-dev
\end{lstlisting}
Install Gazebo 11 (unbuntu 22.04) using:
\begin{lstlisting}[style=Bash]
sudo apt install gazebo libgazebo-dev
\end{lstlisting}
\item Install a good editor like Visual Studio Code.
\begin{enumerate}
\item{Install via Ubuntu Software}
\item{Do ``add folder to workspace'' and open the paparazzi folder.}
\item{Ctrl-p lets you open a file}
\item{Ctrl-Shift-F lets you search in files}
\end{enumerate}
\item Build OpenCV for the Bebop if you plan to use it. Note that OpenCV is heavy and thereby slow compared to self
optimized C-code. That is why the example does not use OpenCV.
\begin{enumerate}
\item Navigate to paparazzi/sw/ext/opencv\_bebop:
\begin{lstlisting}[style=Bash]
cd ~/paparazzi/sw/ext/opencv_bebop
\end{lstlisting}
\item Install the required OpenCV libraries
\begin{lstlisting}[style=Bash]
sudo apt install libjpeg-turbo8-dev libpng-dev libtiff-dev zlib1g-dev libdc1394-22-dev
\end{lstlisting}
\item Make openCV using:
\begin{lstlisting}[style=Bash]
make
\end{lstlisting}
\end{enumerate}
\end{enumerate}
\section{Running your first simulation}
To test your Paparazzi installation, you will perform a short test-flight in simulation.
Navigate to the Paparazzi folder and launch the Paparazzi Center using
\begin{lstlisting}[style=Bash]
cd ~/paparazzi
./paparazzi
\end{lstlisting}
In the top left drop-down box labeled `A/C', select the `bebop\_orange\_avoid' aircraft.
In the top middle under `Target', select `nps', the Paparazzi simulator.
Click `Clean', then `Build' to compile the example code.
Under `Session', select `Simulation - Gazebo' and click `Execute'. You should now see the Ground Control Station and the Gazebo simulator.
Click `Stop/Remove All Processes' in the Paparazzi Center to end the simulation.