How can I automatically detect and log changes to a USB joystick's position connected via vrjoystick?

1 次查看(过去 30 天)
I have a USB joystick that I would like to record the position of at a high frequency in MATLAB 2017a.
I understand that I can get the position of the joystick (i.e., axes) using:
joy = vrjoystick(1);
[axes,buttons,povs] = read(joy);
I am currently using a timer callback to call this read function every 0.05 sec. However, the timer often does not achieve the appropriate frequency and sometimes 1 or more seconds will pass without the timer completing. I thus lose some data this way. Is there a way to improve the timer or to more efficiently query the position of the joystick? Perhaps there's a way to detect changes to the joystick position and write these directly to a file?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by