+specific distance, he has to calculate the time the robot needs to travel that
+distance, measure the time, and stop the robot after that time interval has
+passed. When using incorrect clocks, or when using inaccurate timers, this can
+lead to errors in movement. Because of that, it is appropriate to monitor the
+Roomba's movement, for example with its internal sensors.
+
+\paragraph{Input commands}
+The Roomba~500 series features a total of 49 different sensor values. Among the
+sensors mentioned above, there are also some internal values concerning battery
+charge, capacity, and temperature, motor currents, and even some more (or less)
+useful variables like the characters read from the infrared remote control, the
+current \ac{ROI} mode or the currently playing song. Nevertheless, there is
+also the possibility to query the travelled distance, the turned angle and the
+internal encoder counts ("`ticks"') for the left and right wheel. Each sensor
+value is 1 or 2 bytes long and is assigned a specific \definition{packet ID}.
+Some packet IDs also describe groups of multiple sensor values sent together.
+
+Sensor values can be retrieved either by explicit polling or by enabling a
+stream of values that is sent every 15~ms. Explicit polling works through the
+\cmd{Sensors} command (\opcode{0x8e}), which takes the packet ID of a single
+sensor as parameter, or through the \cmd{Query List} (\opcode{0x95}) command,
+which takes multiple packet IDs headed by the total number of requested packets
+as parameter. Both of these functions send back the requested values directly.
+
+By using the \cmd{Stream} command (\opcode{0x94}), it is possible to receive
+the requested sensor values every 15~ms. This is very convenient for real-time
+behaviour, when the sensor values have to be evaluated very often. As the
+\cmd{Query List} command, the \cmd{Stream} command takes the total number of
+packet IDs followed by the requested packet IDs as parameter. It sends back the
+sensor values in packets using the following format:\\
+\verb|0x13|, $n, p_1, v(p_1), p_2, v(p_2), \ldots, p_n, v(p_n), c$\\
+where:
+\begin{description}
+ \item[$n$] is the number of bytes sent back, excluding $n$ and $c$,
+ \item[$p_i$] is a requested packet ID, $i = 1, \ldots, n$
+ \item[$v(p_i)$] is the value of the packet with the packet ID $p_i$
+ \item[$c$] is a checksum, with
+ $\sum_{i=1}^n\left(p_1 + v(p_1)\right) + c + n \equiv 0 \mod 256$
+\end{description}
+
+Example: The following byte sequence requests data from the left cliff
+signal (packet~ID \magicnumber{0x1d}) and virtual wall sensor (packet~ID
+\magicnumber{0x0d}):
+\begin{verbatim}
+0x94, // Stream command
+0x02, // parameter: 2 packets following
+0x1d, 0x0d // parameter: request packets 0x1d and 0x0d
+\end{verbatim}
+
+The Roomba then returns the following bytes every 15~ms:
+\begin{verbatim}
+0x13, // Header byte
+0x05, // 5 bytes following, except checksum
+0x1d, // Packet ID 0x1d following
+0x02, 0x19, // Data for Packet ID 0x1d (2 byte)
+0x0d, // Packet ID 0x1d following
+0x00, // Data for Packet ID 0x0d (1 byte)
+0xb6 // checksum: 0x5 + 0x1d + 0x2 + 0x19 + 0xd + 0x0 + 0xb6 = 256
+\end{verbatim}