File Exchange

image thumbnail

Simulink Support Package for LEGO MINDSTORMS EV3 Hardware

Run models on LEGO MINDSTORMS EV3.

209 Downloads

Updated 11 Sep 2019

Editor's Note:

This support package is currently unable to download third-party software for macOS for all versions of MATLAB. We are actively working to fix this issue.

MATLAB installations on Windows and Linux are unaffected.

Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware enables you to create and run Simulink models on LEGO MINDSTORMS EV3 hardware. The support package includes a library of Simulink blocks for configuring and accessing LEGO MINDSTORMS EV3 sensors, actuators, and communication interfaces. It also enables you to interactively monitor and tune algorithms developed in Simulink as they run on the LEGO MINDSTORMS EV3.

This support package is functional for R2014a and beyond.

Comments and Ratings (21)

@Wang Zebing Please contact MathWorks Technical support for assistance

@Zhangying Wesolowska Kindly follow the steps mentioned in this page to resolve the third party install error
https://www.mathworks.com/matlabcentral/answers/318635-how-do-i-perform-a-clean-re-installation-of-a-support-package

Wang Zebing

Using R2017a. I always got this. Please help me.
### Generating code into build folder: C:\Users\12281\Documents\LEGO Creations\MINDSTORMS EV3 Projects\untitled_ert_rtw
### Invoking Target Language Compiler on untitled.rtw
### Using System Target File: D:\Program Files\MATLAB\R2017a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file untitled.h
### Writing header file untitled_types.h
### Writing header file rtwtypes.h
### Writing source file untitled.c
### Writing header file untitled_private.h
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Sourcery G++ Lite v2009q3 v4.7 | gmake (64-bit Windows)
### Creating 'C:\Users\12281\Documents\LEGO Creations\MINDSTORMS EV3 Projects\untitled_ert_rtw\untitled.mk' ...
### Building 'untitled': "D:\Program Files\MATLAB\R2017a\bin\win64\gmake" -f untitled.mk all
C:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcerylite.instrset\CodeSourcery\bin/arm-none-linux-gnueabi-gcc -c -MMD -MP -MF"untitled.dep" -MT"untitled.o" -O0 -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcerylite.instrset\CodeSourcery\arm-none-linux-gnueabi\libc\usr\include -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcerylite.instrset\CodeSourcery\lib\gcc\arm-none-linux-gnueabi\4.4.1\include -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcerylite.instrset\CodeSourcery\lib\gcc\arm-none-linux-gnueabi\4.4.1\include-fixed -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcecode_lms2012.instrset\EV3Source -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcecode_lmstypes.instrset\EV3Source -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcecode_bytecodes.instrset\EV3Source -c -nostdinc -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/Users/12281/DOCUME~1/LEGOCR~1/MINDST~1 -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/ev3/include -ID:/Program Files/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/12281/DOCUME~1/LEGOCR~1/MINDST~1/untitled_ert_rtw -ID:/Program Files/MATLAB/R2017a/extern/include -ID:/Program Files/MATLAB/R2017a/simulink/include -ID:/Program Files/MATLAB/R2017a/rtw/c/src -ID:/Program Files/MATLAB/R2017a/rtw/c/src/ext_mode/common -ID:/Program Files/MATLAB/R2017a/rtw/c/ert -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcecode_lmstypes.instrset\EV3Source/.. -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcecode_lms2012.instrset\EV3Source/.. -IC:\ProgramData\MATLAB\SupportPackages\R2017a\3P.instrset\ev3sourcecode_bytecodes.instrset\EV3Source/.. -ID:/Program Files/MATLAB/R2017a/toolbox/target/codertarget/rtos/inc -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/ev3/src -o untitled.o untitled.c
In file included from untitled.c:16:
untitled.h:22: fatal error: rtw_continuous.h: No such file or directory
compilation terminated.
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/simulink/include/sf_runtime: No such file or directory
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/extern/include: No such file or directory
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/simulink/include: No such file or directory
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/rtw/c/src: No such file or directory
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/rtw/c/src/ext_mode/common: No such file or directory
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/rtw/c/ert: No such file or directory
arm-none-linux-gnueabi-gcc: Files/MATLAB/R2017a/toolbox/target/codertarget/rtos/inc: No such file or directory
gmake: *** [untitled.o] Error 1
### Creating HTML report file untitled_codegen_rpt.html
### Build procedure for model: 'untitled' aborted due to an error.
Error(s) encountered while building "untitled":
### Failed to generate all binary outputs.

It does not work. Downloading of the "third party packages" does not work.
What is the problem with that?

Simon Baars

It does not work properly on Linux. Both USB and Bluetooth do not work. lsusb shows the EV3 Lego Mindstorms connection. I connected Bluetooth properly. Please assist with these issues.

ian Van

Ben Wang

Using R2018a. I always got this. Please help me.

### Generating code into build folder: D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw
### Invoking Target Language Compiler on ev3_lft.rtw
### Using System Target File: E:\Program Files\MATLAB\R2018a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file ev3_lft_types.h
### Writing header file ev3_lft.h
.
### Writing header file rtwtypes.h
### Writing source file ev3_lft.c
### Writing header file ev3_lft_private.h
### Writing source file ev3_lft_data.c
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: MinGW64 | gmake (64-bit Windows)
### 'D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw\ev3_lft.mk' is up to date
### Building 'ev3_lft': "E:\Program Files\MATLAB\R2018a\bin\win64\gmake" MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -f ev3_lft.mk all
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>call "\\benson\E$\Program Files\MATLAB\R2018a\bin\win64\checkMATLABRootForDriveMap.exe" "\\benson\E$\Program Files\MATLAB\R2018a" 1>mlEnv.txt
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>for /F %a in (mlEnv.txt) do set "%a"\n
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>set "MATLAB_ROOT=H:"\n
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>set "ALT_MATLAB_ROOT=H:"\n
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>set "MATLAB_BIN=H:\bin"\n
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>set "ALT_MATLAB_BIN=H:\bin"\n
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>cd .
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>if "" == "" ("E:\Program Files\MATLAB\R2018a\bin\win64\gmake" MATLAB_ROOT=H: ALT_MATLAB_ROOT=H: MATLAB_BIN=H:\bin ALT_MATLAB_BIN=H:\bin -f ev3_lft.mk all ) else ("E:\Program Files\MATLAB\R2018a\bin\win64\gmake" MATLAB_ROOT=H: ALT_MATLAB_ROOT=H: MATLAB_BIN=H:\bin ALT_MATLAB_BIN=H:\bin -f ev3_lft.mk )
"C:\TDM-GC~1\bin/gcc" -c -ansi -pedantic -Wno-long-long -fwrapv -m64 -O0 -I -I -I -I -I -I -c -nostdinc -DMODEL=ev3_lft -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=ev3_lft -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -ID:/MATLAB/LegoFirstTry -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/ev3/include -ID:/MATLAB/LegoFirstTry/ev3_lft_ert_rtw -IH:/extern/include -IH:/simulink/include -IH:/rtw/c/src -IH:/rtw/c/src/ext_mode/common -IH:/rtw/c/ert -I"/.." -I"/.." -I"/.." -IH:/toolbox/target/codertarget/rtos/inc -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/ev3/src -o "ev3_lft.obj" "ev3_lft.c"
In file included from ev3_lft.c:16:0:
ev3_lft.h:18:18: fatal error: math.h: No such file or directory
compilation terminated.
gmake: *** [ev3_lft.obj] Error 1
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
D:\MATLAB\LegoFirstTry\ev3_lft_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
### Creating HTML report file ev3_lft_codegen_rpt.html
### Build procedure for model: 'ev3_lft' aborted due to an error.
Error(s) encountered while building "ev3_lft":
### Failed to generate all binary outputs.

Hi Prof Perruquetti.
I created a Tech Support Case to investigate the compilation issue. One of our engineers will be in touch soon.
Greg DA

Hello I am using Matlab 2018a on a mac book pro (Mac OS High Sierra), I dowloaded and installed "Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware". Then I open "ev3_drive_openloop" and then deploy to hardware.
I get the following message:

"### Starting build procedure for model: ev3_drive_openloop
Code Generation 1
Elapsed: 3 sec
usr/local/carlson-minot/crosscompilers/bin/arm-none-linux-gnueabi-gcc -c -MMD -MP -MF"ev3_drive_openloop.dep" -MT"ev3_drive_openloop.o" -O2 -Iusr/local/carlson-minot/crosscompilers/arm-none-linux-gnueabi/libc-2014.05-29-sysroot/usr/include -Iusr/local/carlson-minot/crosscompilers/lib/gcc/arm-none-linux-gnueabi/4.8.3/include -Iusr/local/carlson-minot/crosscompilers/lib/gcc/arm-none-linux-gnueabi/4.8.3/include-fixed -IEV3Source -IEV3Source -IEV3Source -c -nostdinc -DMODEL=ev3_drive_openloop -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DUNIX -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=ev3_drive_openloop -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DUNIX -I/Users/perruquetti/Desktop/Calcul/MATLAB/mesMatlab -I/Users/perruquetti/Desktop/Calcul/MATLAB/mesMatlab/ocuments/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/ev3/include -I/Users/perruquetti/Desktop/Calcul/MATLAB/mesMatlab/ev3_drive_openloop_ert_rtw -I/Users/perruquetti/Desktop/Calcul/MATLAB/mesMatlab/ocuments/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/ev3/ev3demos -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -IEV3Source/.. -IEV3Source/.. -IEV3Source/.. -I/Applications/MATLAB_R2018a.app/toolbox/target/codertarget/rtos/inc -I/Users/perruquetti/Desktop/Calcul/MATLAB/mesMatlab/ocuments/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/ev3/src -o ev3_drive_openloop.o ev3_drive_openloop.c
/bin/sh: usr/local/carlson-minot/crosscompilers/bin/arm-none-linux-gnueabi-gcc: No such file or directory
gmake: *** [ev3_drive_openloop.o] Error 127
### Build procedure for model: 'ev3_drive_openloop' aborted due to an error.
Error(s) encountered while building "ev3_drive_openloop":
### Failed to generate all binary outputs."

It seams that the cross compiler (probably part of the thirdpart) was not dowloaded and installed. I check if "usr/local/carlson-minot/crosscompilers/bin/arm-none-linux-gnueabi-gcc" does and exist and it was not the case. I tried to install it manually... but did not succeed. Can you provide me some help with this problem ? (I am Professor at Ecole Centrale and teaching control and robotics: thus I know that this package is working with release 2017b on windows for my students).
Thanks best regards

I am using MATLAB 2017b (on MacOS). After setting

the connection mode to bluetooth,
and the ev3 id I read on the brick,
when I try to deploy on target hardware the ev3_getting started demo, I get the following error :

### Build procedure for model: 'ev3_gettingstarted' aborted due to an error. The following error occurred during deployment to your hardware board: Instrument Control Toolbox is required for this functionality.

This toolbox is not in the requirements EV3 2017B reqs for the EV3 Support Package, therefore my question.

Edit : I was able to deploy using USB mode, without error wrt the ICT toolbox

@ Wendell Capili
Simulink Support Package for LEGO Mindstorms EV3 is supported on Mac starting from R2016a release.
Details can be found here : https://www.mathworks.com/hardware-support/system-requirements.html

Is there no version for macOS? I am installing but this is what I am getting:

Simulink Support Package for LEGO MINDSTORMS EV3 Hardware cannot be installed on this system.
It requires:

Base Product: Simulink
Host Platforms: Win32,Win64,Linux64

I take back what I previously said about the 2016a version. The 2017a is much more well rounded and solved nearly all the problems I had. It's great to see all the effort that went in this add-on in just a year ! Keep it up !

There is no way as of 2016a to read distance from an infrared sensor, furthermore it could note manage to retreive data while the program runs in external mode, but maybe i'm just not good with this yet

I always get the Message, when i try to install the package:

There was a problem installing the support package. To resolve this issue, contact Technical Support

I have MATLAB R2016b.

What is the Problem here?

Pradeep KS

Hi, I was trying to install the support file for my MATLAB, I own the 2014a release, but everytime I try I always get this error message:

"MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware is not available for this release of MATLAB."

So, what I need to do? It is because I don't have the data acquisition toolbox?

I was trying to install the support file for MATLAB ( I already have the support package for Simulink). Here's the link:

http://www.mathworks.se/hardware-support/lego-mindstorms-ev3-matlab.html

However, I got this error:
The file you are trying to view is not in a published state.

How can I get this support package ? And do I need it if I already have the Simulink support package ?

John

Is there a way to get this to work on Mac platform as I get an error

Brian McKay

@J S: Sorry, but the Simulink Support Package for Lego MINDSTORMS EV3 Hardware is only available for release R2014a onwards; there is no support package for R2013b and older releases.

J S

how should i install it in 2013b version?
(my school haven't got the latest vertion yet)

MATLAB Release Compatibility
Created with R2014a
Compatible with R2014a to R2019b
Platform Compatibility
Windows macOS Linux
Tags Add Tags