X-Git-Url: http://git.rohieb.name/bachelor-thesis/written-stuff.git/blobdiff_plain/e29146877ebf1c77b2b31ad1fa804547286b2a21..34498d8190651a7dbf969da9b03d01b8cf085ed4:/Ausarbeitung/implementation.tex diff --git a/Ausarbeitung/implementation.tex b/Ausarbeitung/implementation.tex index 64e3a44..6acf6d9 100644 --- a/Ausarbeitung/implementation.tex +++ b/Ausarbeitung/implementation.tex @@ -2,13 +2,122 @@ \todo{?} This chapter describes the implementation that was used for the aforementioned -experiments. It consists of the measuring program itself, as well as several -scripts to help with analysis of the measured data. +experiments. It consists of the measuring programs themselves, which use the +Wiselib Roomba Control, and are written in C++. Additionally, there are several +Bash scripts to help with the analysis of the measured data. + +All code used for this thesis resides in the Wiselib source tree\footnote{see +\url{https://github.com/ibr-alg/wiselib/}, or the \acs{CDROM} attached at the +end of this book} in the directory \filepath{apps/pc\_apps/roomba\_tests}. \section{Measuring} \label{sec:impl:measuring} -C++ code in wiselib/trunk/pc\_apps/roomba\_tests +The measuring implementation is a set of programs running on a x86-compatible +Linux system which uses the Wiselib to control a Roomba attached to the system +over a serial interface. It features a graphical user interface using the +Qt application framework. Basically, it carries out a movement with specified +parameters (velocity, and destination or angle, depending on the experiment), +then prompts the user to measure and input the actual destination or angle the +Roomba has moved after it has finished the movement. In this context, the user +can choose between two operation modes. In the manual mode, the user can control +the target values for the Roomba movement himself, in automatic mode, the +application uses a list of pre-programmed values for the target values, so the +user only has to input the measured data. + +All measured data is written to a log file in the current directory, whose name +is based on the type of experiment performed. Every line in that log file +describes one measurement made by the user, and consists of key-value pairs +linked together with equality signs and separated of each other by whitespace. +In particular, the data on each line are (with key name, in the order of +appearance on the line): +\begin{enumerate} + \item\texttt{svn:} the SVN or Git revision the program was compiled from + (statically compiled into the program) + \item\texttt{roomba\_id:} the ID of the Roomba the measurement was performed + with (given by the user) + \item\texttt{ground\_type} the ground type used for measurement: + \magicvalue{iz250flur} for laminated floor, \magicvalue{seminarraum} + for carpet floor (given by the user) + \item\texttt{diff\_ticks\_left:} the difference of encoder counts between the + beginning and the end of the movement, on the Roomba's left wheel + (packet~ID \magicvalue{0x2b} in the \ac{ROI} Specification) + \item\texttt{diff\_ticks\_right:} the difference of encoder counts between the + beginning and the end of the movement, on the Roomba's right wheel + (packet~ID \magicvalue{0x2c} in the \ac{ROI} Specification) + \item\texttt{raw\_ticks\_left:} the absolute value of the encoder count of the + Roomba's left wheel (packet~ID \magicvalue{0x2b}) + \item\texttt{raw\_ticks\_right:} the absolute value of the encoder count of + the Roomba's right wheel (packet~ID \magicvalue{0x2c}) + \item\texttt{batt\_charge:} the charge of the Roomba's battery in mAh + (packet~ID~\magicvalue{0x19}) + \item\texttt{batt\_capacity:} the capacity of the Roomba's battery in mAh + (packet~ID~\magicvalue{0x1a}) + \item\texttt{batt\_voltage:} the applied voltage of the Roomba's battery in mV + (packet~ID~\magicvalue{0x16}) + \item\texttt{batt\_voltage:} the current going out of the Roomba's battery in + mA (packet~ID~\magicvalue{0x17}) + \item\texttt{move:} \magicvalue{straight} for straight moves, + \magicvalue{turn} for turn moves + \newcounter{logitems}\setcounter{logitems}{\value{enumi}+1} +\end{enumerate} +For straight moves (\magicvalue{move=straight}) follows: +\begin{enumerate}[start=\value{logitems}] + \item\texttt{input\_distance}: the target distance in mm sent to the Roomba + via the \ac{ROI} \cmd{Drive} command (given by the user in manual mode, + or determined by the program in automatic mode) + \item\texttt{velocity:} (the velocity in mm/s sent to the Roomba over the + \ac{ROI} \cmd{Drive} command (given by the user in manual mode, or + determined by the program in automatic mode) + \item\texttt{measured\_x:} the actual covered distance in mm in the Roomba's + original viewing direction (measured by the user) + \item\texttt{measured\_y:} originally, the distance shift perpendicular to the + viewing direction of the Roomba. Not used anymore. + \item\texttt{deviation\_orientation:} originally, the shift in orientation of + the Roomba. Not used anymore. +\end{enumerate} +For straight moves (\magicvalue{move=turn}) follows: +\begin{enumerate}[start=\value{logitems}] + \item\texttt{turn\_angle:} the turn angle in degree sent to the Roomba via the + \ac{ROI} \cmd{Drive} command (given by the user in manual mode, or + determined by the program in automatic mode) + \item\texttt{measured\_angle:} the actual turned angle of the Roomba in degree + (measured by the user) + \item\texttt{velocity:} (the velocity in mm/s sent to the Roomba over the + \ac{ROI} \cmd{Drive} command (given by the user in manual mode, or + determined by the program in automatic mode) +\end{enumerate} + +\begin{figure} + \centering + \includegraphics[width=\textwidth]{images/Implementation-Diagram.pdf} + \caption[File structure of the measuring implementation]{Simplified file + structure of the measuring implementation\label{fig:impl:struct}\\ + yellow: general files used for all three experiments; green: files for + Experiment~1; blue: files for Experiment~2; red: files for Experiment~3} +\end{figure} + +Figure~\ref{fig:impl:struct} shows the file layout of the measuring +implementation. It reuses components whereever possible, and therefore +consists of three parts specific for the three performed experiments (see +Sections~\ref{sec:exp1}, \ref{sec:exp2} and~\ref{sec:exp3}), as well as a +general part, which contains the elements of the implementation common to the +other three parts. + +\subsection{General part} +The files \file{stuff.cc}, \file{stuff.h}, +\file{target\_value\_input\_dialog.cc} and \file{target\_value\_input\_dialog.h} +build up the general part of the implementation. These are the files shown with +a yellow background in Figure~\ref{fig:impl:struct}, and are included in all +other three parts of the implementation. + +\paragraph{\file{stuff.cc} and \file{stuff.h}} +Both of these files contain global functions for logging text to a file, +according to the format described above. Also there + +\subsection{Implementation for Experiment~1} +\subsection{Implementation for Experiment~2} +\subsection{Implementation for Experiment~3} three single applications with same base: roomba\_test (main.cc), mean\_correction\_test (mean\_correction.cc), soft\_start\_test