MatlabInput allows MATLAB users to get input from keyboards and joysticks in a non-blocking manner. It contains two classes: HebiJoystick, and HebiKeyboard. HebiJoystick is a drop-in replacement for vrjoystick for users who don't have access to the Simulink 3D Animation toolbox. HebiKeyboard provides similar functionality, but for keyboard inputs.
% Add library
% Display all currently pressed keys whenever shift is up
kb = HebiKeyboard();
state = read(kb);
down = find(state.keys('a':'z')) + 'a';
The library was tested on Windows, Linux, and OSX on MATLAB 2015b, 2016a, and 2016b. However, it should run on any version >= 2013b. It makes use of the Java library (JInput) and does not support code generation).
Riley, just get a compiled version in: https://github.com/HebiRobotics/MatlabInput/releases.
I am having difficulty getting MATLAB to correctly locate the hebi library functions and am receiving the following message from MATLAB (R2016b):
Warning: Invalid file or directory
> In javaclasspath>local_validate_dynamic_path (line 266)
In javaclasspath>local_javapath (line 182)
In javaclasspath (line 119)
In javaaddpath (line 71)
In HebiJoystick.loadLibs (line 65)
In HebiKeyboard.loadLibs (line 58)
In HebiKeyboard (line 75)
Undefined variable "us" or class "us.hebi.matlab.input.HebiKeyboard".
I am attempting to run the simple example code above on this page and have placed the hebi library in my MATLAB directory. I believe I have added the directory to the MATLAB path but here is the statement I used to include the library:
Would you have any suggestions to make the code run? I do not know Java.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.