MATLAB Utilities
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
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.
The code below shows the live video display in Teleop Taxi which used HebiCam in combination with the IP Webcam app running on an Android phone.
% 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.
HebiKeyboard
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
HebiJoystick
HebiJoystick is also part of MatlabInput and serves as a drop-in replacement for vrjoystick for users who don't have access to the 3D Animation Toolbox.
% Display pressed buttons joy = HebiJoystick(); while true [axes, buttons, povs] = read(joy); if any(buttons) disp(find(buttons)); end pause(0.01); end