Detect Keyboard Input Matlab

前端 未结 4 840
不知归路
不知归路 2020-12-11 03:01

I have a simple question, although it\'s harder than it seems; I couldn\'t find the answer on the interwebs :O

I\'m writing a script in Matlab. What I want to do is

4条回答
  •  死守一世寂寞
    2020-12-11 03:14

    I frequently ran into similar use cases and typically preferred to react to joystick buttons because of the more convenient interface provided by vrjoystick. However, I recently wrote a library that provides a similar interface for keyboard inputs.

    % Pause on ESC
    kb = HebiKeyboard();
    while true
        state = read(kb);
        if state.ESC
          % PAUSE DRIVING
        else
          % DRIVE CAR
        end
    end
    

    It's non-blocking and doesn't require focus on any particular figure.

    File Exchange: http://mathworks.com/matlabcentral/fileexchange/61306-hebirobotics-matlabinput

    Github: https://github.com/HebiRobotics/MatlabInput

提交回复
热议问题