In addition to official APIs, HEBI maintains several open source projects to help simplify the prototyping of robotics applications in MATLAB. These are free utilities that function completely independently of our actuators and other APIs. Current projects:
- HebiCam acquires streaming video in real time (Github, File Exchange)
- SharedTransform exchanges data between multiple instances (File Exchange)
- HebiKeyboard integrates keyboard input inside control loops (Github, File Exchange)
- HebiJoystick integrates joystick input inside control loops (Github, File Exchange)
HebiCam allows users to efficiently access streaming video from a variety of sources. The functionality is similar to MATLAB's IP Camera support package, but with additional support for common formats including h264 and rtsp streaming.
% Connect to camera cam = HebiCam('http://192.168.0.10:8080/video'); % Continuously gather and display video I = imshow(cam.getsnapshot); while true I.CData = getsnapshot(cam); drawnow; end
As an example, this project can be used to get live video data from two or more cameras simultaneously for stereo vision.
% MATLAB instance (writer) blob = SharedTransform('blob'); blob.setTransform(eye(4)); % MATLAB instance (reader) blob = SharedTransform('blob'); T = blob.getTransform();
As an example, one instance of MATLAB can control a robot at >100 Hz and react to computer vision input being processed in a separate instance of MATLAB at ~30 Hz.
HebiKeyboard is part of MatlabInput and provides a way to react to keyboard input inside a continuously running control loop. Unlike MATLAB's built-in solutions, the calls are non-blocking and don't require a particular window or figure to be selected.
% Display 'X' button state whenever shift is not down kb = HebiKeyboard(); while true state = read(kb); if ~state.SHIFT disp(state.keys('x')) end pause(0.01); end
% Display pressed buttons joy = HebiJoystick(); while true [axes, buttons, povs] = read(joy); if any(buttons) disp(find(buttons)); end pause(0.01); end