---- datatemplateentry project ----
template : projects:display_template
title : Input Device Latency
participants_ : [[people:raphael_wimmer|Raphael Wimmer]], [[people:florian_bockes|Florian Bockes]], [[people:andreas_schmid|Andreas Schmid]], [[people:vitus_maierhoefer|Vitus Maierhöfer]]
keywords_ : WIP, latency, prototype, USB, mouse, keyboard, joystick, gamepad, input device, input
status_ : ongoing
start : 2017
end :
featured : no
photo_img : projects:lagbox_glamor_website.jpg
shortdescription : Measuring and understanding latency of input devices
abstract : We measure and model the latency of input devices and its effect on user performance. Our research strengthens theoretical foundations and gives practical guidance for researchers, developers, and users.
----
## News
---- datatemplatelist ----
template: news:list_template
cols : %title%, date, description
sort : ^date
filter : tags ~~ latency
----
\\
\\
{{ youtube>U9y5hWek_nA?1000x600 }}
\\
\\
## Project Goals
- Get a better understanding of latency and latency jitter
- Develop a tool for exactly measuring the latency of input devices
- Provide users with advice on which input devices to choose
\\
\\
## Current Status (2021-10-10)
This project has spawned a few sub-projects in which we continue research on latency in human-computer interaction:
* [[:projects:end-to-end-latency|Yet Another Latency Measuring Device]]
* [[:projects:display_latency|DIY Approach to Measuring Display Reaction Time]]
* Effect of Latency on User Performance (work in progress)
\\
\\
## Measurements at a Glance
The following latency measurements were first presented in our [CHI '19 paper](publications:on_the_latency_of_usb-connected_input_devices_2019).
### Legend:
Blue: default latency distribution for each device
Orange: latency distribution if one manually sets a USB polling interval of 1 millisecond (=1000 Hz polling rate).
Click on image for larger version.
Gamepads:
{{:projects:latency:paper_all_gamepads.png?direct&400|}}
Mice:
{{:projects:latency:paper_all_mice.png?direct&400|}}
Keyboards:
{{:projects:latency:paper_all_keyboards.png?direct&400|}}
\\
\\
## FAQ - Frequently asked questions (work in progress)
??? What exactly is new about this research?
!!! We suggest a simple theoretical model of latency in input devices, a precise measuring technique, and an appropriate visualization approach (swarmplots) that hightlights the peculiarities of each device's latency. Furthermore, we conducted more precise latency measurements for input devices.
/*
??? How large are the differences between devices?
!!! (to come. see visualizations)
*/
??? Do latency differences between devices really matter?
!!! It depends. In most everyday use cases, latency differences of 10-30 ms do not really matter. However, for professional gamers or in certain application areas (e.g. teleoperation, psychological reaction time experiments), low latency is extrremely imortant. An increase of latency by 14 ms means that one can only react one or two display frames later. This would eat up all performance gains from a 144 Hz computer monitor (compared to a common 60 Hz monitor). Scientific research is a little bit inconclusive about how strongly latency affects performance in games or similar tasks.
/*
??? How does the shape of the latency distribution matter?
!!! (to come)
*/
??? Why did you test pretty old or uncommon devices?
!!! When selecting devices to test, we had two criteria: \\
1. devices whose latency had been measured earlier by other researchers or gamers (such as the Logitech G300 and G5 mice)\\
2. any devices which we had tested earlier or had lying around
/*
??? Why is the USB polling rate so important?
!!! (to come)
*/
??? Should I enable a higher polling rate?
!!! Yes. We do not see of any negative side effects for most devices. In only one case (XBox 360 wireless) we noticed slightly higher average latency (by 1 ms) when polling every 1 ms.
??? Which device should I buy?
!!! We cannot tell you this. In practice, other factors (ergonomics, haptics of the button press, tracking precision) are certainly more important than small differences in latency. On the other hand, you might want to avoid devices which exhibit significantly higher latency than others.
???
\\
\\
## Key Results
## Practical Relevance
## Technical Details
### Model/USB
### USB Polling Rate
## About the Visualizations
==== Model ====
The overall latency of an input device is determined by multiple components:
- the mechanical delay of the button (BTN),
- the microcontroller in the device (MC)
- the USB polling interval (USB)
- the kernel's process switching interval (OS)
Each component adds its own partial latency to the overall latency. Furthermore, the scanning/polling rates of microcontroller, USB host, and operating system add further latency that depends on *when* the polling occurs.
As the offset between the polling intervals shifts over time, the overall latency changes, too.
This leads to characteristic latency distributions for each device.
{{:projects:event_latency_graph.png?nolink&400|}}
\\
\\
==== LagBox ====
Old video for our CHI Late Breaking Work paper. In the measurements shown in this video, measuring interval and USB polling interval are synchronized (which is actually not good), so the tool effectively measured USB polling rate.
{{:projects:latency:video_lagbox.mp4?640x360|}}
\\
\\
=== Hardware ===
The LagBox is based on a Raspberry Pi 2. A optocoupler, which can be switched by the RPi's GPIO interface, is connected to a button of the input device //(Fig. 1)// and can trigger a button press. \\
For this method of testing input latency, it is necessary to modify the input devices by connecting the transistor-side of an optocoupler to the button which should be tested //(Fig. 2)//. Furthermore, this method is not suited to test the latency of input devices that offer a non-physical type of interaction, like touch displays. \\
An advantage of this method over non-invasive approaches is the fact, that external influences are reduced to a minimum due to the direct electric connection between the testing device and the input device. This method also allows it to trigger a large number of button presses in a very short period of time. Thus, it becomes easy to conduct stress tests on the hardware or to collect big amounts of data.
[{{:projects:latency:circuit.png?200|Figure 1: LagBox circuit}}]
[{{:projects:latency:hacked_controller.jpg?300|Figure 2: Hacked Gamepad}}] \\
\\
\\
=== Software ===
On startup, the software of the LagBox requires the user to select the "hacked" button of the input device via command line parameters to determine which input event to listen to. Afterwards, the actual testing process begins. The RPi closes the optocoupler by writing to the corresponding GPIO pin, logs the current timestamp and waits for an input event by the input device connected via USB. Once the input event arrives, the optocoupler is opened again, another timestamp is logged and the difference is written to a logfile. Then we wait for a randomly selected time between 0.1ms and 10ms, so the circuit can discharge. The reason for the randomized waiting time is to avoid accidental synchronisation of the event readout with the polling rate. This testing process is repeated several (right now 1000) times to get a big enough sample size of input latencies. \\
The last latency as well as the overall progress of the test are shown on a minimalist GUI //(Fig. 3)//.
[{{:projects:latency:only_gui.jpg?500|Figure 3: GUI of the LagBox}}] \\
=== Measuring Latency ===
[How to build the LagBox and conduct your own measurements](projects:latency:howto)
[Database of detailed latency measurements](projects:latency:measurements)
\\
{{:projects:latency:lagbox_demo.mp4?640x360|Demo of how to conduct a measurement}} \\
\\
\\
==== Results ====
To validate our prototype, several experiments were conducted during the development process where we tested various USB-connected mice, keyboards, and gamepads. The following devices were tested: three gamepads (Logitech Wing-man and two different no-name gamepads using the same DragonRise controller IC), two keyboards (Logitech G15 and Gembird Mini USB Keyboard), and three mice (Logitech G5, G300, and RX250). For each device, we collected 5000 samples. We observed that great differences exist between devices regarding both latency and consistency. Moreover, plotting the kernel density estimates for the latency distributions reveals further peculiarities of certain devices //(Fig. 4)//. For example, the Logitech G15 keyboard has a bimodal distribution of latencies.
[{{:projects:8ms_violinplots.png?300| Figure 4: Violinpots of latency distribution}}] \\
\\
Tabelle ausgeblendet für normale Besucher. RW
^ **List of tested devices (invasive method, 125Hz polling)** ||||
| **Device Name** | **Device Type** | **Polling Rate** | **Median ± std. dev** |
| Logitech Rx250 | Mouse | 125Hz | 13.3 ± 2.8 |
| Logitech Wingman | Gamepad | 125Hz | 5.6 ± 2.3 |
| DragonRise (2x) | Gamepad | 125Hz | 17.3 ± 4.5 |
| Gembird Mini | Keyboard | 125Hz | 29.0 ± 2.5 |
| Logitech G300 | Mouse | 1000Hz | 3.9 ± 0.7 |
| Logitech G5 | Mouse | 1000Hz | 2.2 ± 0.3 |
| Logitech G15 | Keyboard | 1000Hz | 25.8 ± 4.9 |
\\
\\
## Upcoming and Future work:
- building a non-invasive method for precisely characterizing input latency (we are not very successful in this regard yet)
- conducting a small study on the effects of input latency on performance in a simple game (first study conducted, second study needs to be prepared)
- test more, current, devices (when time permits)
\\
\\
## Publications
---- datatemplatelist ----
template: publications:list_template
cols : %title%, authors_, date, short-description, abstract, pdf_url, bibtex_url, video_url, photo, published-in
sort : date
filter : %pageid%~publications:*
and : project=latency
----
## Press Coverage
* **PC Games Hardware**, Andreas Link (10.05.2019, German): [Wissenschaftliche Studie: Wie schnell sind Mäuse, Tastaturen und Gamepads wirklich?](http://www.pcgameshardware.de/Eingabegeraet-Hardware-154122/News/Studie-Wie-schnell-sind-Maeuse-Tastaturen-und-Gamepads-wirklich-1281669/)
\
## Further Resources
* [Documents tagged "Latency" in our Zotero library](https://www.zotero.org/groups/1491718/physical-digital_affordances/items/collectionKey/IZ8BI479)
* [LagBox on GitHub](https://github.com/PDA-UR/LagBox)
* [Data of our measurements on GitHub](https://github.com/PDA-UR/latency_measurements)
* [CHI 2018 Poster](https://hci.ur.de/_media/projects/latency/lagbox_poster_small.png)
## All Related Posts
---- datatemplatelist ----
template: news:list_template
cols : %title%, date, description
sort : ^date
filter : tags ~~ latency, Latency
----