PDA

View Full Version : Reducing Latency


Matlock
30th May 2007, 00:11
I have written a simulation to be used in motor control research. It uses a Saitek Cyborg, no force-feedback, wired USB joystick. The problem is with reaction times. A fast reaction time is about 100ms. As a rough test I videoed the joystick movements and the sprite it controls with a digital video camera. There was roughly 2-3 frames, 67-100ms latency between the joystick and sprite movements. To eliminate the chance it was partly sprite re-drawing time I tested the time from the DXCallback to the end of re-drawing with TimeGetTime calls and it was consistently zero or 1ms. So the latency seems to be real. The program does not use much memory or CPU power. It is written in VB6 with DX8. I am on a Toshiba Satellite 3.0GHz and will test a newer desktop.

Is there anything I can do to the system to reduce the 67-100ms to only a few milliseconds? Is this a normal latency with this joystick?

Thanks,

Barry.

Matlock
7th June 2007, 19:14
I increased the USB polling rate from 125Hz to 500Hz and received more joystick data points, that was good. But it did not change the delay from the joystick moving until the sprite moving, I think this eliminates the USB port as the source of the delay.

If I take into account monitor latency of supposedly 8ms, let's say 16ms that leaves 50 to 84ms.

Anybody? Thanks.

UKSupport
12th June 2007, 11:18
Hi,

Precisely which Cyborg is it? Also, do you have the driver installed for it?

Low speed usb devices have a maximum updates rate of 125Hz ie Cyborg joystick data updates are every 8ms on usb bus. The OS then reads that at typically 40Hz, so every 25ms - Our axes are all read and updated in the device typically every 15ms, worse case 20ms.

So there's that degree of latency introduced by USB (around 8ms) and of course Windows itself (only a few ms)

Finally, you should note that if you're using Direct X to interface with the stick, the OS will throttle the bandwidth, whereas if you want to get every new data point, you need to take the data straight from the HID USB stack.

Matlock
15th June 2007, 19:06
Thanks Richard,
This is the Cybord evo PS 24, USB wired, driver version: 4.3.3.500. I see in the spec sheet it is a USB 1.1 device. Is there a faster Joystick I should be using?

I thought increasing the USB polling rate will get around the OS latency. With the USB port polling at 500Hz I am getting two axis update events every 16ms, effectively one every 8ms. That is good, I'm just not sure 'when' they are happening due to this latency, as I said the sprite moves at least 67ms after the joystick.

I would be happy to buy a newer joystick if there is one.

Thanks,

Barry.