"Lego Mindstorms EV3" MATLAB Toolbox
Hello, fellow LEGO constructors and MATLAB programmers, welcome to the RWTH - Mindstorms EV3 Toolbox for MATLAB! This toolbox was designed to abstract and simplify controlling LEGO MINDSTORMS EV3 robots using MATLAB. Via Bluetooth or USB you can read sensor values or control your robots’ motors in an intuitive way. You can choose whether to strictly follow the EV3's firmware specification by sending commands directly, or operate on a higher level, using a complete virtualized EV3, including Motor and Sensor classes.
This toolbox is being developed at the RWTH Aachen, Germany, and it is the follow-up of the RWTH MATLAB NXT Toolbox.
To get started, take a look at the installation instructions and examples.
Prerequisites
If you use Windows, you will need to have the Instrument Control Toolbox installed for USB to work properly.
This toolbox has been developed and tested on MATLAB 2014a/2016a, on Windows 7/10 and Ubuntu 14.04/16.04. If you encounter problems using other configurations, feel free to contact us.
The EV3's firmware version needs to be updated to 1.09, bugs and unsuspected behaviour has been encountered when using older versions.
Installation
In most cases, you will only need to download the toolbox and add it's path to your MATLAB search path. ('Set path' -> 'Add with subfolders')
You can skip the next part and proceed to the first example to test if everything works fine.
If you use a Linux system and connecting via Bluetooth does not work, you can try to manually install the HIDAPI, an API for communication with HID devices, which this toolbox uses for Bluetooth connection on Linux - a prebuilt version is delivered with the toolbox. HIDAPI can be installed using the official repositories of your distribution or built on your own.
Examples
Before you can try out the following example, you will need to have your EV3 connected to your PC via Bluetooth or USB. If you use a Linux system and want to try out Bluetooth, we suggest you use the 'btconnect'-script you find in 'Tools'. It is a command line script which should facilitate pairing with the brick. The syntax is 'btconnect brickName' (you can read the name your EV3 at the top of its display - it should be EV3 by default).
% This example expects a motor at port A and a (random) sensor at port 1
b = EV3();
b.connect('usb'); % OR: b.connect('bt');
ma = b.motorA;
ma.setProperties('power', 50, 'limitValue', 720);
ma.start();
% fun
ma.waitFor();
disp(b.sensor1.value);
b.beep();
b.disconnect();
You can find more info on the toolbox functions/classes either by using help functionname/classname and doc functionname/classname, or in the generated PDF/HTML documentation (in docs).
Contribution
TODO