File Exchange

image thumbnail

HebiRobotics/Matlab​Input

version 1.2.0.0 (56.6 KB) by

Library for getting keyboard and joystick input into MATLAB

4 Downloads

Updated

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.
Example:

% Add library
addpath('hebi');

% Display all currently pressed keys whenever shift is up
kb = HebiKeyboard();
while true
state = read(kb);
down = find(state.keys('a':'z')) + 'a';
if ~state.SHIFT
disp(char(down));
end
pause(0.01);
end

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).

Readme: https://github.com/HebiRobotics/MatlabInput
Download: https://github.com/HebiRobotics/MatlabInput/releases

Comments and Ratings (2)

Will Fonseca

Riley, just get a compiled version in: https://github.com/HebiRobotics/MatlabInput/releases.

Riley DeHaan

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
'C:\Users\riley\Documents\MATLAB\HebiRobotics-MatlabInput-e491424\src\main\resources\matlab\%RELEASE_NAME%.jar'.
> 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:
addpath('C:\Users\riley\Documents\MATLAB\HebiRobotics-MatlabInput-e491424');

Would you have any suggestions to make the code run? I do not know Java.

Updates

1.2.0.0

description fix

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video