X-Git-Url: http://git.rohieb.name/bachelor-thesis/written-stuff.git/blobdiff_plain/e29146877ebf1c77b2b31ad1fa804547286b2a21..cbbf1119f4b08f1a8d8eef497380c589778c5068:/Ausarbeitung/wiselib.tex

diff --git a/Ausarbeitung/wiselib.tex b/Ausarbeitung/wiselib.tex
index 42bc223..1c4cc6c 100644
--- a/Ausarbeitung/wiselib.tex
+++ b/Ausarbeitung/wiselib.tex
@@ -1,5 +1,5 @@
 \section{Wiselib}
-The \definition{Wiselib}\cite{wiselib} is a C++\index{C++} algorithm library for
+The \definition{Wiselib}\cite{wiselib} is a C++ algorithm library for
 sensor networks, containing for example algorithms for routing, localization and
 time synchronization, and is strongly focused on portability and cross-platform
 development. In particular, it allows the user to develop applications that run
@@ -10,6 +10,7 @@ but there are as well implementations for the diverse x86-compatible Personal
 Computer platforms, and the Shawn sensor network simulator.
 
 \subsection{Architecture}
+\label{sec:wiselib:arch}
 \paragraph{Concepts and Models}
 Wiselib makes strong uses of \definition{concepts} and \definition{models} as
 central design objects. Concepts serve as an informal description of interfaces,
@@ -40,7 +41,7 @@ algorithm uses.
 \end{figure}
 Besides algorithms, and basic concepts and models, the Wiselib also consists of
 two other main parts: the internal interface and the external interface (see
-Figure \ref{fig:wiselib-arch}).
+Figure~\ref{fig:wiselib-arch}).
 
 \paragraph{External Interface}
 The \definition{External Interface} provides access to the underlying \ac{OS},
@@ -60,8 +61,9 @@ restricted platforms; for instance a wireless sensor node without dynamic memory
 management can use a static implementation of lists and other containers,
 whereas a full-grown desktop can use the dynamic implementation provided by the
 C++ \ac{STL}. For this purpose, the Wiselib also contains the
-\acused{pSTL}\definition{\acl{pSTL}} (\acs{pSTL}) which implements a
-subset of the \ac{STL} without the use of dynamic memory allocation.
+\acused{pSTL}\definition{pico Standard Template Library} (\acs{pSTL}) which
+implements a subset of the \ac{STL} without the use of dynamic memory
+allocation.
 
 \paragraph{Stackability}
 Another central design principle used in the Wiselib is
@@ -77,68 +79,70 @@ de- and encryption over the radio.
 \subsection{Roomba Control}
 Even more interesting is the fact that the Wiselib includes code to control an
 iRobot Roomba\index{Roomba} over a serial interface, and getting access to its
-internal sensor data, using the \acl{ROI}\index{\acl{ROI}} mentioned earlier.
-For this purpose, it defines two concepts for Robot Motion:
+internal sensor data, using the \ac{ROI}\index{Roomba Open Interface} mentioned
+earlier. For this purpose, it defines two concepts for Robot Motion:
 
-\paragraph{TurnWalkMotion concept}\index{TurnWalkMotion (concept)}
+\paragraph{\concept{TurnWalkMotion} concept}%\index{TurnWalkMotion (concept)}
 This concept represents a simple robot that can turn on the spot and walk
 straight, without automatic stopping.
 \begin{description}
   \item Types:
     \begin{description}
-      \item[\code{velocity\_t}] Type for velocity measurement
-      \item[\code{angular\_velocity\_t}] Type for angular velocity measurement
+      \item[\fnfont{velocity\_t}] Type for velocity measurement
+      \item[\fnfont{angular\_velocity\_t}] Type for angular velocity measurement
     \end{description}
   \item \todo{clearpage?} Methods:
     \begin{description}
-      \item[\code{int turn(angular\_velocity\_t)}] turn the robot with a
+      \item[\fnfont{int turn(angular\_velocity\_t)}] turn the robot with a
         constant angular velocity
-      \item[\code{int move (velocity\_t)}] move the robot straight with a
+      \item[\fnfont{int move (velocity\_t)}] move the robot straight with a
         constant velocity
-      \item[\code{int stop()}] stop the robot
-      \item[\code{int wait\_for\_stop()}] hold the execution until the robot has
-        stopped
+      \item[\fnfont{int stop()}] stop the robot
+      \item[\fnfont{int wait\_for\_stop()}] hold the execution until the robot
+        has stopped
     \end{description}
 \end{description}
 
-\paragraph{Odometer concept}\index{Odometer (concept)}
+\paragraph{\concept{Odometer} concept}%\index{Odometer (concept)}
 This concept represents an Odometer which tracks motions over time.
 Whenever the object turns or moves, internal counters will adjust their
 guessing of the object's traveled distance and current orientation.
 \begin{description}
   \item Types:
     \begin{description}
-      \item[\code{angle\_t}] Type for angle measurement
-      \item[\code{distance\_t}] Type for distance measurement
+      \item[\fnfont{angle\_t}] Type for angle measurement
+      \item[\fnfont{distance\_t}] Type for distance measurement
     \end{description}
   \item Methods:
     \begin{description}
-      \item[\code{angle\_t angle()}] return the current angle
-      \item[\code{int reset\_angle()}] reset the angle of the object
-      \item[\code{distance\_t distance()}] return the current distance
-      \item[\code{int reset\_distance()}] reset the distance of the object
-      \item[\code{int register\_state\_callback (T *obj)}] register a callback
+      \item[\fnfont{angle\_t angle()}] return the current angle
+      \item[\fnfont{int reset\_angle()}] reset the angle of the object
+      \item[\fnfont{distance\_t distance()}] return the current distance
+      \item[\fnfont{int reset\_distance()}] reset the distance of the object
+      \item[\fnfont{int register\_state\_callback (T *obj)}] register a callback
         that gets called when the state changes
-      \item[\code{int unregister\_state\_callback (int)}] unregister a
+      \item[\fnfont{int unregister\_state\_callback (int)}] unregister a
         previously registered callback
-      \item[\code{int state()}] return the current state
+      \item[\fnfont{int state()}] return the current state
     \end{description}
 \end{description}
 
-\paragraph{ControlledMotion class}\index{ControlledMotion (class)}
-On top of the TurnWalkMotion and Odometer concepts builds the
-\definition{ControlledMotion} model. It takes implementations of each of these
+\paragraph{ControlledMotion model}
+On top of the \concept{TurnWalkMotion} and \concept{Odometer} concepts builds
+the \class{ControlledMotion} model. It takes implementations of each of these
 concepts as template parameters and extends the simple turn-and-walk paradigm by
 a temporal dimension, which let the robot stop after a specific time interval.
 In particular, it provides the following methods:
-\begin{description}
-  \item[\code{int move\_distance(distance\_t, velocity\_t)}] move the robot
+\begin{description}\item
+\begin{description} % to match with the indentation level above
+  \item[\fnfont{int move\_distance(distance\_t, velocity\_t)}] move the robot
     straight by a given distance with a given velocity
-  \item[\code{int turn\_about(angle\_t, angular\_velocity\_t)}] turn the robot
+  \item[\fnfont{int turn\_about(angle\_t, angular\_velocity\_t)}] turn the robot
     about a given angle with a given angular distance
-  \item[\code{int turn\_to(angle\_t, angular\_velocity\_t)}] turn the robot
+  \item[\fnfont{int turn\_to(angle\_t, angular\_velocity\_t)}] turn the robot
     to a given orientation with a given angular distance
 \end{description}
+\end{description}
 
 The class first registers a callback function at the given Odometer instance,
 and then uses its distance and angle values to control the robot over the
@@ -148,48 +152,46 @@ target values given by the user through the functions above, and if the actual
 values exceed the target values, the robot is stopped.
 
 \paragraph{Underlying Roomba Implementation}
-The actual communication with the Roomba is done in the \definition{RoombaModel}
-class. It implements the aforementioned TurnWalkMotion \index{TurnWalkMotion
-(concept)} and Odometer \index{Odometer (concept)} concepts and therewith allows
-the interaction with a ControlledMotion instance. In particular, it manages the
-serial communication with the Roomba and translates the function calls
-\code{turn()}, \code{move()} and \code{stop()} of the TurnWalkMotion concept to
-the according parameters for the \ac{ROI} \cmd{Drive} command, reads a subset of
-the Roomba's sensors and presents the sensor data to the user, and, while
-implementing the Odometer concept, calculates the covered distance and angle
-from the Roomba's right and left wheel rotations.
+The actual communication with the Roomba is done in the
+\class{RoombaModel} class. It implements the
+aforementioned \concept{TurnWalkMotion} and \concept{Odometer} concepts and
+therewith allows the interaction with a \class{ControlledMotion} instance. In
+particular, it manages the serial communication with the Roomba and translates
+the function calls \fnfont{turn()}, \fnfont{move()} and \fnfont{stop()} of the
+TurnWalkMotion concept to the according parameters for the \ac{ROI} \cmd{Drive}
+command, reads a subset of the Roomba's sensors and presents the sensor data to
+the user, and, while implementing the Odometer concept, calculates the covered
+distance and angle from the Roomba's right and left wheel rotations.
 
 The sensor data is read from the Roomba using the \cmd{Stream} command on the
 \ac{ROI}, which results in a sensor data packet (see Section
 \ref{sec:roi-stream-packet}) every 15~ms, and $66.67$ packets per second. At a
 speed of 19,200 baud in mode \ac{8N1}, the maximum size of a data packet is
 $19,200 \div (66.67 \times 9) = 32$ byte, so at the moment only the sensor
-packets \emph{encoder counts left/right} (IDs~\magicnumber{0x2b},
-\magicnumber{0x2c}, 2+2 bytes), \emph{battery voltage/current/charge/capacity}
-(IDs~\magicnumber{0x16}, \magicnumber{0x17}, \magicnumber{0x19},
-\magicnumber{0x1a}, 2+2+2+2 bytes) are streamed, which add up to 18 data bytes +
+packets \emph{encoder counts left/right} (IDs~\magicvalue{0x2b},
+\magicvalue{0x2c}, 2+2 bytes), \emph{battery voltage/current/charge/capacity}
+(IDs~\magicvalue{0x16}, \magicvalue{0x17}, \magicvalue{0x19},
+\magicvalue{0x1a}, 2+2+2+2 bytes) are streamed, which add up to 18 data bytes +
 3 header/checksum bytes. There has currently been no success yet in
 communicating at the higher speed of 115,200 baud.
 
 Also there has been research to use the distance and angle values that the
-Roomba itself provides (sensor packet~IDs \magicnumber{0x13} and
-\magicnumber{0x14}). However, according to the \ac{ROI} Specification these
+Roomba itself provides (sensor packet~IDs \magicvalue{0x13} and
+\magicvalue{0x14}). However, according to the \ac{ROI} Specification these
 values are integer values, and the value is reset to zero every time it is read.
 By using the \cmd{Stream} command on the \ac{ROI} and therefore reading these
 values every 15~ms, the Roomba cannot move fast enough to increment these values
-to \magicnumber{1}, so everytime \magicnumber{0} is read. It is obvious that
+to \magicvalue{1}, so everytime \magicvalue{0} is read. It is obvious that
 these sensor values are not suited for such rapid evaluations, and can only be
 used for larger distances and angles. Nevertheless, since the Wiselib Roomba
 control needs to keep track of the Roomba's current position and orientation as
 fast as possible to maintain a certain accuracy in movement, the distance and
 angle values as provided by the Roomba itself cannot be used. On the other hand,
 working with the Roomba's wheel encoder counts (sensor packet~IDs
-\magicnumber{0x2b} and \magicnumber{0x2c}) has proven itself quite acceptable.
+\magicvalue{0x2b} and \magicvalue{0x2c}) has proven itself quite acceptable.
 After a few test runs, the number of encoder counts per~mm for straight
 walks turned out as $2.27$, and for turning on the spot, $2.27 \times 115 =
 261.05$ encoder counts per radian, which is the number of encoder counts per~mm
 multiplicated with half the Roomba's wheelbase. So when new sensor data is read
-each 15~ms, the RoombaModel implementation calculates the Odometer
-\index{Odometer (concept)} distance and angle from these values.
-
-\todo{cite Wisebed book chapter on Roomba code}
+each 15~ms, the RoombaModel implementation calculates the \concept{Odometer}
+distance and angle from these values.
