1 \documentclass[a4paper,
11pt,notitlepage
]{article
}
3 \usepackage[dvipdfm
]{graphicx}
5 \usepackage[left =
1.125in , right =
1in, top =
1in, bottom =
1in
]{geometry
}
13 \setlength{\parindent}{0pt
} \setlength{\parskip}{1ex plus
1ex
}
15 \author{\footnotesize{Christopher Ethan Hack (ceh58@cam.ac.uk), Churchill College
}}
17 \title{\textbf{Automatic Speed Control for Dasher
}}
23 \chead{\textit{Automatic Speed Control for Dasher
}}
35 \renewcommand{\headrulewidth}{0pt
}
37 \renewcommand{\footrulewidth}{0pt
}
44 An automatic speed control for Dasher was implemented to enhance user
45 experience. A user's stress level is measured by looking at the
46 variation of the angle between the positive $x$-axis and the line
47 joining the crosshair to the cursor position. The higher the variance,
48 the higher the user stress; this indicates Dasher is running too
49 fast. User trials backed up this idea, so speed control was
50 implemented along these lines. So far, it has performed well in
54 \section{Introduction
}\label{sec:Intro
}
56 The maximum bit rate (speed) at which Dasher runs can always be set by the
57 speed control slider, which appears optionally at the bottom of the main
58 window. The maximum speed at which a user can use Dasher depends to a large
59 extent on the user's skill. Very experienced users will be able to write
60 successfully at higher bit rates. However, if a user is operating Dasher at a
61 bit rate which is inappropriate for them, their experience will certainly be
62 less enjoyable and they will probably end up writing more slowly. Furthermore,
63 users may not bother experimenting with the speed slider to work out a
64 comfortable bit rate for themselves. Worse still, users may even be
65 \emph{unable
} to play around with the speed slider. This could make using
66 Dasher frustrating, so an automatic speed control is a desirable feature.
68 In order to implement automatic speed contorl for Dasher, why not ask
69 the question ``how can we tell how well a user is doing'' or perhaps
70 ``how can we tell how stressful a user is finding using Dasher''? If
71 a user was doing badly or finding the experience stressful we could
72 slow Dasher down. If a user seemed bored, we could speed up.
74 In Dasher
1.6.8 this problem was tackled by looking at the mean $x$
75 coordinate of the mouse. Being far to the right of the screen on
76 average indicated boredom, to the left (near the crosshair), stress,
77 with a safe comfort zone in the middle. In general this may be
78 unsatisfactory; you can imagine user behaviour patterns where you
79 might want to write at high speed with very small gestures causing
80 the mouse to be kept very near the crosshair for example.
82 Our hypothesis is that a better indicator is
\emph{the variation of
83 the angle between the positive $x$-axis and the line joining the
84 crosshair to the cursor position
}. If this variance is high, it would
85 indicate a high level of user distress. Mathematically, our variance,
88 \begin{equation
}\label{equ:var
}
89 \sigma=-
\log{\left(
\langle \cos \theta \rangle^
2 +
\langle \sin \theta \rangle^
2 \right)
}
92 $
\theta$ is the angle and $
\langle\ldots\rangle$ indicates some kind
93 of time averaging. This definition was chosen because it is
94 robust. Any definition based on a simple statistical variance of the
95 angle has the weakness that any measure of the angle must be
96 discontinuous at some point round the circle.
100 In order to test this hypothesis, we carried out a series of simple
101 user trials.
4 intermediate ability Dasher (direct mode) users carried
102 out short text composition tasks at a range of different
103 speeds
\footnote{See Keith Vertanen's paper, `An Empirical Evaluation
104 of Keyboard-less Text Composition'.
}. Their behaviour was
105 logged. Users were also asked to give a qualitative description of
106 their Dasher experience after each trial.
108 We also had one test subject perform similar experiments using a
109 breath-mouse and
1-dimensional mode Dasher, and using an eyetracker.
113 The results (not included here) were definitive (though not really
114 inherently interesting). A running variance (see
115 Section
\ref{sec:Intro
}) was calculated. There was a clear link between
116 user distress (indicated in qualitative feedback) when Dasher was
117 running at too high a speed for them and the variance as we calculated
118 it. This provided enough stimulus to continue to develop an automatic
119 speed control based on this measure of user performance. This held
120 true for direct mode and for other input modes.
122 By looking more closely at such results, we could also see what sort
123 of values the variance takes during periods of boredom and
124 stress. This will be instructive when it comes to designing our
127 \section{Design Requirements for an Automatic Speed Control
}
129 \emph{This isn't as easy as it sounds.
}
131 \subsection{Timescales
}\label{item:time
}
133 Our automatic speed control can be thought of in terms of two
134 timescales. One is the timescale over which the variance is updated,
135 $
\tau_v$, the other is the timescale over which changes are made to
136 the bit rate, $
\tau_c$. If $
\tau_v \gg \tau_c$, this is bad
137 news
\footnote{DJCM
}! This means the speed is changing more quickly
138 than our measure of user stress adapts and the change will
139 ``overshoot''. Making sure that our system avoids this is very
140 important. We should aim for $
\tau_c \gg \tau_g$. However, if the
141 speed changes
\emph{too slowly
}, the system will be of limited use.
143 \subsection{Misleading Scenarios
}\label{item:back
}
145 We should exclude backwards data (i.e. when the user is deleting
146 characters). This is because when a user is backing up, their
147 behaviour probably isn't giving us useful information on their
148 performance while writing (which hopefully is the majority of the
149 time!). Furthermore, movement of the mouse backwards and forwards
150 creates annoying spikes in any measure of the variance. Though this
151 may well be a sign that Dasher is running to fast for the user, it may
152 also be that they have changed their mind about what to write. We
153 don't want to give too much emphasis to this. Furthermore, a user in
154 trouble may spend a lot of time `scrolling' vertically. Typically,
155 this will result in a low variance and could be mistaken for
156 \emph{good
} performance! To avoid this, we should also exclude data in
157 the forward-vertical-scrolling region.
159 \subsection{Sampling
}\label{item:samp
}
161 The design also involves sampling. Dasher does not guarantee that any
162 function will be called consistently at fixed intervals. In order to
163 make the design invariant to the clock rate of the machine it runs on,
164 we want to make sure the
\emph{time period over which we measure the
165 variance is constant for varying clock rates
}. This means sampling
166 more frequently when Dasher is running on a fast machine.
168 \subsection{Invariance to User Skill
}\label{item:bitr
}
170 We also want to make the design invariant to a user's ability level,
171 which is tied in to the bit rate they use Dasher at. A more skilled
172 user working at a higher bit rate will inherently have a greater
173 variance (over a fixed time period) compared to a poor user working at
174 low bit rates. Essentially, this means the length of time over which
175 we sample should be inversely proportional to the current bit rate.
177 \subsection{Minimum Radius
}\label{item:minr
}
179 Data where the mouse position is very near the central crosshair
180 should be excluded. There are two reasons for this. First, a user may
181 rest near the crosshair as they consider what to write next so this
182 data is not useful for speed control. Second, small changes in mouse
183 position near the crosshair will result in big changes of angle. This
184 would be bad for the model we have in mind. Some sort of minimum
185 exclusion radius must be included. It should also be adaptive; if a
186 user tends to spend all their time a long way from the crosshair, it
189 \subsection{The Graphical User Interface
}\label{item:gui
}
191 Automatic speed control must also be seamlessly integrated into the
192 Dasher user interface, as an option that can be turned on and off. A
193 check box and speed slider control should be added to the Preferences
196 \subsection{Bonus Features
}
198 We will also implement boost and brake buttons for Dasher, such that
199 it speeds up or slows down when the respective button is being held
202 \section{Implementation
}
204 Automatic speed control is implemented as part of the
205 \texttt{CDasherViewSquare
} class. The code can be found in the files
206 `DasherViewSquare.h' (declarations) and `DasherViewSquare.inl'
207 (implementations) in the `dasher/Src/DasherCore'
208 directory. Initialisation of relevant class members is carried out in
209 the class constructor in `DasherViewSquare.cpp'. In order to slightly
210 modularise speed control, the functionality has been split up into
211 several functions. Nearly all the free numerical parameters of the
212 model are specified as class member variables and initialised in the
213 constructor. There are a lot of them!
215 Ideally, we want a single automatic speed control to work for all
216 modes of Dasher. Hence we use internal Dasher coordinates for
217 calculating an internal `Dasher angle' rather than screen
218 coordinates. This is because in eyetracker and one-dimensional modes
219 the mouse position in screen coordinates isn't always meaningful.
221 \textbf{\texttt{void CDasherViewSquare::SpeedControl(myint iDasherX,
222 myint iDasherY)
}}. This is the main auto-speed control function and
223 drives auto-speed control.
225 The first thing we do here is coordinate transformations. We're fed
226 non-linear Dasher space coordinates, but we need to re-linearise them
227 so the geometry is sane and make the crosshair the origin of
228 coordinates rather than top right corner. We also use normalised
229 coordinates such that the width of the screen corresponds to
2.0. This
230 is because the minimum radius calculations (see Section
\ref{sec:exr
})
231 only works for small radii.
234 The angle
\texttt{theta
} is calculated and stored in an
235 \texttt{std::deque<double>
} structure for later variance
236 calculations. Auto-speed control then works as follows.
238 \subsection{Changing the Bit Rate Based on the Angular Variance
}\label{sec:chng
}
240 The basic idea behind our design goes like this:
243 \item\label{item:first
} Calculate our `Dasher angle', $
\theta$ and
244 store it at the back of a deque structure. This is a single
245 sample. Count the number of samples we take.
246 \item While there are more samples in the
\texttt{deque
} than the current
247 sample size (see Section
\ref{sec:Size
}) remove items from the front
249 \item After we have collected enough samples i.e. enough time has
250 elapsed, calculate the variance using Equation
\ref{equ:var
}. This is
251 the job of
\texttt{CDasherViewSquare::Variance()
}. Reset the sample
252 count. Time averaging is accomplished by looking back at the last $n$
253 samples, where $n$ is the sample size as mentioned above and
254 calculated as per Section
\ref{sec:Size
}. At this point the exclusion
255 radius and sample size (see Sections
\ref{sec:Size
} and
\ref{sec:exr
})
256 are updated to take account of changing conditions. Because the sample
257 size can (and does) change, we need to use a more flexible
258 \texttt{deque
} structure rather than anything simpler/more
260 \item Using a
5-tier system, update the bit rate. This
5-tier system
261 gives great flexibility but also simplicity. Schematically:
263 \item If the variance is very low, increase the bit rate a lot.
264 \item If the variance is quite low, increase the bit rate a little.
265 \item If we're in the middle do nothing.
266 \item If the variance is quite high, decrease the bit rate a little.
267 \item If the variance is very high, decrease the bit rate a lot.
269 Changes are made to the bit rate on a percentage basis, so the faster
270 you're going already, the more the bit rate changes by. This helps
271 fulfill design requirement
\ref{item:bitr
}.
272 \item Never let the bit rate fall below
0.1 or above
273 8.0.
\texttt{CDasherViewSquare::UpdateBitrate()
} takes care of these
275 \item Repeat from step
\ref{item:first
}.
278 Let's think about design requirement
\ref{item:time
} briefly. The bit
279 rate can only be changed after a certain time has elapsed. This is the
280 same time period over which the variance is measured. This would seem
281 to make $
\tau_c =
\tau_g$ (see design requirement
282 \ref{item:time
}). However, things are complicated by the
5-tier system
283 for changing the bit rate (see above). This system means that the bit
284 rate doesn't always change every time
\texttt{UpdateBitrate()
} is
285 called. Hence, on average, the bit rate is actually changing on a
286 longer timescale than we measure the variance on. The tier system also
287 means the bit rate can still adapt rapidly enough to make auto-speed
288 control useful. We have fulfilled our design requirement.
290 \subsection{Excluding Misleading Data
}
292 As design requirement
\ref{item:back
}, certain aspects of user
293 behaviour could be na\"ively mistaken for the user having a good, easy
294 time when this is not the case. To prevent this confusion, only the
295 forward sector covering roughly $
\pm72^
{\circ}$ from the positive
296 $x$-axis is included. When the cursor is outside of this area,
297 auto-speed control is effectively paused. This makes sure we don't
298 have the problems noted in design requirement
\ref{item:back
}.
300 \subsection{Sample Size
}\label{sec:Size
}
302 We sample once per Dasher frame. In order to address Design
303 Requirements
\ref{item:samp
} and
\ref{item:bitr
}, we keep track of the
304 \emph{number
} of samples taken and vary this number so that if the
305 frame rate is the only thing that varies we sample over a constant
306 time. The number of samples we take per variance measure, $N$, is
313 $F$ is the frame rate, $B$ is the bit rate and $m$ and $c$ are
314 constants. So as $F$ varies the
\emph{time
} over which we sample
315 should be roughly constant. Furthermore, we address Design Requirement
316 \ref{item:bitr
}; we sample over a shorter time when Dasher is running
317 at a higher bit rate. All of this is given in code in the function
318 \texttt{CDasherViewSquare::UpdateSampleSize()
}. The constants are
319 specified in member variables of the class (see the code for details).
321 Note that because of the inverse relation to the bit rate, any $B <
1$
322 are set to $B =
1$ for the purposes of this calculation, so $N$
323 doesn't get too big. This is a bit of a fudge, but if $N$ is too big,
324 speed control is very unresponsive.
326 \subsection{The Minimum Radius
}\label{sec:exr
}
328 This fulfills Design Requirement
\ref{item:minr
}. The minimum radius
329 is set up to be adaptive (i.e. it will increase/decrease if a user
330 is always far from/near the crosshair). How do we do this? It's like a
331 clustering problem. To a first (very loose) approximation we think of
332 the distribution of radii as a mixture-of-
2-centred-Gaussians, with
333 two standard deviations. The two means represent two different
334 populations, radii when the user is dawdling and radii when the user
335 is progressing. Every time we sample a radius we have to decide which
336 population it belongs to and update things according. Schematically it
340 \item Initialise the two standard deviations and find an initial guess
341 for the minimum radius.
342 \item\label{item:mrs
} Every radius we sample we assign to either the
343 `dawdling near crosshair' population or the `writing at the right of
344 the screen' population, depending on whether it is more or less than
346 \item Update the standard deviation of that population
347 accordingly. These two steps are performed in
\texttt{void
348 CDasherViewSquare::UpdateSigmas(double r)
}.
349 \item Every now and then, recalculate the min. radius using the
350 updated standard deviations. This step is carried out in
351 \texttt{CDasherViewSquare::UpdateMinRadius()
}.
352 \item Repeat from step
\ref{item:mrs
}.
355 According to DJCM's mixture-of-
2-centred-Gaussians model for the
356 distribution of radii, the critical radius is given by:
358 \begin{equation
}\label{Equn:r
}
359 r_
{crit
}^
2 =
\frac{\ln\left(
\frac{\sigma_2^
2}{\sigma_1^
2}\right)
}{\left(
\frac{1}{\sigma_1^
2} -
\frac{1}{\sigma_2^
2}\right)
}
362 $
\sigma_1$ is the standard deviation of the `writing' population and
363 $
\sigma_2$ is the standard deviation of the `dawdling' population. It
364 has been empirically noted that this formula
\emph{does not work
} for
365 $
\sigma \gg 1$ (or more to the point for $r
\gg 1$) so normalised
366 coordinates are used to keep $r$ in range.
368 These values are updated by the moving-average `sludgy
372 S_
{(k+
1)
} :=
\alpha S_
{(k)
} + (
1 -
\alpha)r^
2
375 $
\alpha$ ($
\alpha <
1$ always!) measures how manys guys we're
376 averaging over; the bigger $
\alpha$ the more guys we use.
378 We simultaneously keeps track of
2 values of $S$, one for each
379 population and perform this update after assigning a value of $r$ to a
380 population. For each population, asymptotically, $S_
{(k)
} \simeq
381 \langle r^
2 \rangle$ so we make the association $
\sigma_i^
2 =
382 S_
{(k)
}$. These updated values of $
\sigma$ are then periodically used
383 to update $r_
{crit
}$ according to equation
\ref{Equn:r
}. We've
384 designed the system so that the minimum radius adapts much more slowly
387 \subsection{Brake and Boost Mode
}
389 One non-auto-speed control bonus feature we've implemented are `boost' and
390 `brake' keys for Dasher. If you hold down control, Dasher slows by
391 75\% of the underlying bit rate; if you hold down shift Dasher speeds
392 up by
75\% of the underlying bit rate. This is implemented differently
393 under Linux and Windows because of the different ways they handle
394 keyboard input. See `/dasher/Src/Gtk2/DasherControl.cpp' and
395 `/dasher/Src/Win32/Widgets/Canvas.cpp' for details. The crucial common
396 factor is that the boost/brake is handled by changing the value of the
397 Dasher-parameter
\texttt{LP
\_BOOSTFACTOR}.
399 \subsection{Other Notes
}
401 After some testing, it was found that the auto-speed control model did
402 not interact well with Dasher control mode. It would seem that that
403 users behave differently when using contorl mode. This confuses the
404 auto-speed control, and so auto-speed control should be automatically
405 disabled when the user enters a control node and enabled when they
408 The problem with this is that bugs in the implementation of the way
409 Dasher parses the tree of Dasher nodes mean sometimes auto-speed
410 control is not turned back on when you leave a control node! This is a
411 bug in
\texttt{CDasherModel
}, not in speed control. That section of the
412 code is due to be rewritten, as of September,
2005.
414 \section{Testing Automatic Speed Control
}
416 Carrying out full statistically rigorous tests of automatic speed
417 control as well as evaluating its psychological and qualitative impact
418 on Dasher users would be time consuming and require a large volunteer
419 base of test subjects. This really wasn't feasible.
421 So instead smaller scale evaluations were carried out, without extensive
422 statistical calculations. Experienced Dasher users found that auto-speed
423 control would settle down at an appropriate bit rate for them and stay there.
424 Less experienced users found auto-speed control picked out a lower speed than
425 they might have expected but that it made them feel better about using Dasher.
426 A test using the breath mouse and one-dimensional mode also proved successful.
428 Only somewhat rudimentary tests were carried out using the eyetracker and
429 breath mouse. Novice users of both devices reported that speed control was
430 satisfactory. Eyetracker input is very similar to direct input and it is
431 envisaged that auto-speed control will function in a similar way in both modes.
432 If anything, auto speed control will be more useful for eyetracker users
433 because their attention is necessarily completely focussed on what they are
434 writing and it's hard to look away from the canvas.
438 In general, automatic speed control has so far proved successful. It
439 speeds up and slows down appropriately when a user is bored or
440 stressed respectively. It settles down to a fairly consistent speed
441 which suits the user well. Still, certain things could be further
445 \item The whole thing could do with more extensive testing. All the
446 parameters have been tuned by the trials already carried out, but
447 there is still probably room for improvement.
449 \item The interaction with control mode isn't very elegant and is made
450 worse by the bugs in
\texttt{CDasherModel
}. When
\texttt{CDasherModel
}
451 is fixed up, this could be looked at.
453 \item As noted in section
\ref{sec:chng
}, the minimum time period over
454 which the variance can be changed is tied directly to the period over
455 which the variance is measured. This is partly because these periods
456 are both subject to being invariant to machine clock rate and user
457 ability (see sections
\ref{item:samp
},
\ref{item:bitr
} and
458 \ref{sec:Size
}). They are bound to be calculated in a similar way and
459 empirically having them equal was found to work. However, this need not be the
460 case. By decreasing the value of the member variable
461 \texttt{m
\_dSensitivity} (currently set to
1.0) this relationship can
462 be altered. This could be investigated further.
464 \item One-dimensional mode is also something of a challenge. In tests,
465 the model performed quite well and satisfied our single trial
466 subject. However, is it optimal for
1D mode? Could improvements be
469 \item An alternative model suggested for auto-speed control was to
470 model the user's behaviour as a solution to the damped, simple
471 harmonic oscillator differential equation. Exactly what the ideal
472 solution would be and how to implement this easily and efficiently was
473 not immediately clear. That's why we used the simpler angular variance
474 model. This alternative could be worth further consideration.
476 \item A question from an object-oriented programming perspective: Does
477 auto-speed control belong in
\texttt{CDasherViewSquare
}? Could it be
478 put into its own class as an abstract auto-speed control object? Or
483 In the end, automatic speed control based on angular variance proved
484 successful. It has been committed to CVS and should be released in
485 Dasher v4.0. Testing by the general public will ultimately decide its