git.haldean.org droidcopter / 3e62c54
Merge branch 'master' of github.com:haldean/droidcopter Benjamin Bardin 9 years ago
2 changed file(s) with 88 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
0 \input{latex_template.tex}
0 \documentclass[letterpaper]{article}
1 \usepackage{amsmath,amssymb,appendix,color,etoolbox,
2 graphicx,index,listings,lscape,natbib,url}
3
4 \usepackage{mathpazo} % math & rm
5 \linespread{1.05} % Palatino needs more leading (space between lines)
6 \usepackage[scaled]{helvet} % ss
7 \normalfont
8 \usepackage[T1]{fontenc}
9
10 \newcommand\figref[1]{Figure \ref{fig:#1}}
11 \newcommand\tabref[1]{Table \ref{tab:#1}}
12 \newcommand\code[1]{\texttt{#1}}
13 \newcommand\pipe[0]{\;|\;}
14 \newcommand\st[0]{\;\mathrm{s.t.}\;}
15 \newcommand\startappendix{\appendix\appendixpage\addappheadtotoc}
16
17 \newcommand\imgfig[4]{
18 \begin{figure}[h]
19 \centering
20 \includegraphics[scale=#2]{figures/#1}
21 \caption{#3}
22 \label{fig:#4}
23 \end{figure}}
24
25 \definecolor{gray}{gray}{0.95}
26
27 \lstset{
28 language=Python,
29 basicstyle=\footnotesize\ttfamily,
30 numbersep=5pt,
31 tabsize=2,
32 extendedchars=true,
33 breaklines=true,
34 stringstyle=\ttfamily,
35 showspaces=false,
36 showtabs=false,
37 xleftmargin=17pt,
38 framexleftmargin=17pt,
39 framexrightmargin=5pt,
40 framexbottommargin=4pt,
41 backgroundcolor=\color{gray},
42 showstringspaces=false
43 }
44
145 \title{Stable Flight and Object Tracking with a Quadricopter using an
246 Android Device}
347 \author{Benjamin Bardin \and William Brown
448 \and Dr. Paul Blaer}
549
650 \begin{document}
7 \todolist
851
952 \maketitle
1053
1861 platform on our first hardware iteration, named Jabberwock.
1962 \end{abstract}
2063 \tableofcontents
64 \pagebreak
2165
2266 \section{Motivation}
2367 \subsection{Objectives}
76120
77121 \section{Pilot Android Application}
78122 \label{sec:pilot}
79 The Pilot program has two core functionalities.‭ ‬The first is the
80 actual robotic control of the quadrocopter itself‭; ‬the second is
81 communication with the control server.‭ ‬The parallel processing
123 The Pilot program has two core functionalities. The first is the
124 actual robotic control of the quadrocopter itself; the second is
125 communication with the control server. The parallel processing
82126 required in these distinct tasks is complicated by the performance
83 requirements of the program.‭ ‬Flight control processing must take place
84 in real time -- or an extremely close approximation.‭ ‬Communication
127 requirements of the program. Flight control processing must take place
128 in real time -- or an extremely close approximation. Communication
85129 with the control server, on the other hand, yields priority to flight
86 control.‭ ‬Consequently,‭ ‬a great deal of effort went into prioritizing
87 inter-thread communications and access of shared data.‭ ‬For flight
88 control algorithms,‭ ‬blocking on locked data is unacceptable,‭ ‬since
89 timely performance is essential‭; ‬instead of blocking,‭ ‬they will use
90 the most recent,‭ ‬locally stored version of the data requested.‭ ‬For
91 communication algorithms,‭ ‬accessing flawed data is unacceptable‭; ‬the
130 control. Consequently, a great deal of effort went into prioritizing
131 inter-thread communications and access of shared data. For flight
132 control algorithms, blocking on locked data is unacceptable, since
133 timely performance is essential; instead of blocking, they will use
134 the most recent, locally stored version of the data requested. For
135 communication algorithms, accessing flawed data is unacceptable; the
92136 control server must not receive out-of-date information portrayed as
93137 current.
94138
95139 \subsection{Flight Control}
96 Flight control itself is divided into two main components:‭ ‬navigation
140 Flight control itself is divided into two main components: navigation
97141 and guidance.
98142
99143 \subsubsection{Navigation}
100 Navigation determines a desired velocity vector for the quadrocopter.‭
101 ‬In‭ “‬manual‭” ‬mode,‭ ‬it simply accepts this vector from the control
102 server.‭ ‬In‭ “‬autopilot‭” ‬mode,‭ ‬or when the connection is lost,‭ ‬autopilot
103 subroutines determine the desired velocity vector.‭ ‬It's determination
104 is based on two factors.‭ ‬The first is its current location.‭ ‬The second
105 is either previously transmitted autopilot instructions,‭ ‬or
106 pre-programmed safeties‭ (‬for low power,‭ ‬bad network,‭ ‬etc.‭).
144 Navigation determines a desired velocity vector for the quadrocopter.
145 In ``manual'' mode, it simply accepts this vector from the control
146 server. In ``autopilot'' mode, or when the connection is lost, autopilot
147 subroutines determine the desired velocity vector. It's determination
148 is based on two factors. The first is its current location. The second
149 is either previously transmitted autopilot instructions, or
150 pre-programmed safeties (for low power, bad network, etc.).
107151
108152 \subsubsection{Guidance}
109 Guidance takes the desired velocity from Navigation,‭ ‬and uses PID
153 Guidance takes the desired velocity from Navigation, and uses PID
110154 loops to adjust individual motor speeds to achieve and maintain that
111 vector.‭ ‬To improve the performance of the PID loop,‭ ‬the system is
112 transformed into an approximately linear one.‭ ‬The transformation
155 vector. To improve the performance of the PID loop, the system is
156 transformed into an approximately linear one. The transformation
113157 accounts both for the quadratic relationship between motor speed and
114 thrust,‭ ‬and for changing effects of motor thrust as its orientation
158 thrust, and for changing effects of motor thrust as its orientation
115159 changes.
116160
117161 \section{Server Software}
201245 color from red to green, denoting the current speed of the motor.
202246
203247 \section{Communication}
204 Communication is composed of two main components:‭ ‬telemetry and
205 commands/data.‭ ‬Each is relayed on separate ports,‭ ‬since commands must
248 Communication is composed of two main components: telemetry and
249 commands/data. Each is relayed on separate ports, since commands must
206250 be relayed as synchronously as possible and telemetry will be
207251 asynchronous.
208252
209253 \subsection{Telemetry}
210254 The telemetry modules continuously run the Android's preview
211 functionality,‭ ‬at‭ ‬5fps.‭ ‬Each frame is saved to a buffer as it is
212 available,‭ ‬overwriting the previous frame.‭ ‬When the Android has
213 finished sending one frame to the control server,‭ ‬it immediately
214 copies the buffer and starts sending the frame.‭ ‬The result is real
215 time telepresence,‭ ‬at approximately two to four fps and a lag of
255 functionality, at 5fps. Each frame is saved to a buffer as it is
256 available, overwriting the previous frame. When the Android has
257 finished sending one frame to the control server, it immediately
258 copies the buffer and starts sending the frame. The result is real
259 time telepresence, at approximately two to four fps and a lag of
216260 less than one second.
217261
218262 \subsection{Commands and Data}
219263 Commands and data are relayed in the form of strings over standard
220 Java sockets.‭ ‬When the connection is lost,‭ ‬the Android device
221 immediately tries to reconnect,‭ ‬continuing to do so indefinitely.‭
222 ‬While the connection is lost, autopilot is enabled and the‭
223 ``‬communication lost‭'' pre-programmed instruction set is engaged.
264 Java sockets. When the connection is lost, the Android device
265 immediately tries to reconnect, continuing to do so indefinitely.
266 While the connection is lost, autopilot is enabled and the
267 ``communication lost'' pre-programmed instruction set is engaged.
224268
225269 \subsection{Message Formats}
226270 \label{sec:msgs}
227271 ‏Messages between the Android and the control server are sent as
228 strings,‭ ‬delimited by colons.‭ ‬The strings from the control server --
229 commands -- contain the instruction itself,‭ ‬prefixed by a sequence of
230 meta-data describing the instruction.‭ ‬Similarly,‭ ‬data from the Android
231 device contain not just the data,‭ ‬but also a prefix tag describing the
232 data.‭ ‬This enables somewhat efficient analysis on each end:‭ ‬messages can
272 strings, delimited by colons. The strings from the control server --
273 commands -- contain the instruction itself, prefixed by a sequence of
274 meta-data describing the instruction. Similarly, data from the Android
275 device contain not just the data, but also a prefix tag describing the
276 data. This enables somewhat efficient analysis on each end: messages can
233277 be routed only to those components that are registered to process a
234278 given prefix tag. Messages are not transmitted directly between the
235 Android device and the control server.‭ ‬Instead,‭ ‬they are routed through
236 a separate,‭ ‬dedicated broker server.‭ ‬This enables the control server
237 itself to operate easily from different IP addresses,‭ ‬and hence from
279 Android device and the control server. Instead, they are routed through
280 a separate, dedicated broker server. This enables the control server
281 itself to operate easily from different IP addresses, and hence from
238282 various locations. It also allows for easy logging and playback of
239283 sessions -- the broker server logs all data and commands, and can replay
240284 a session later for analysis.