Support for Lego Mindstorms EV3

조회 수: 9 (최근 30일)
John
John 2013년 9월 24일
답변: Dan Lluch 2015년 12월 11일
Are there estimates of when the Lego Mindstorms EV3 hardware will be supported with Matlab and Simulink?
  댓글 수: 6
Remi
Remi 2013년 12월 11일
Hey thanks for the quick answer. I am useing the Compiler: Microsoft Visual C++ 2010. But I recall that I had severe Problems installing Windows SDK I just tried it again and it won't work... But atleast now I know the problem. So thanks for the kind help.
Liam O'Sullivan
Liam O'Sullivan 2014년 1월 22일
Remi - please refer below to my answer labelled as USB connectivity.

댓글을 달려면 로그인하십시오.

채택된 답변

Peter Corke
Peter Corke 2013년 11월 15일
This has matured, check out https://wiki.qut.edu.au/display/cyphy/Lego+EV3
for the details: documentation and MATLAB code. We can run with Bluetooth, USB, and WiFi for Mac/Linux/Windows (except Bluetooth-Linux combo).
Please provide feedback here or else at https://groups.google.com/forum/#!forum/robotics-tool-box
  댓글 수: 3
Liam O'Sullivan
Liam O'Sullivan 2013년 11월 17일
Some examples are given here. If you wish to connect to the EV3 brick via usb you can run
b = Brick('ioType','usb')
After the Brick object has been created you can check the connection by playing a beep tone
b.beep(5,500)
Liam O'Sullivan
Liam O'Sullivan 2014년 1월 24일
편집: Liam O'Sullivan 2014년 1월 24일
A frequently asked question section has been added to the toolkit website! Please refer there first before asking questions here :)

댓글을 달려면 로그인하십시오.

추가 답변 (10개)

Dan Lluch
Dan Lluch 2015년 12월 11일
MathWorks provided support for MATLAB in 14b (passing data back and forth), and Simulink in 14a(programming the device). You can read more about capabilities and features on both workflows here:
HTH Dan

Peter Corke
Peter Corke 2013년 10월 30일
Have a look at
https://wiki.qut.edu.au/display/cyphy/Lego+EV3
we've tried to figure out how the EV3 works, and we have a MATLAB class that talks to the Ev3 brick over Bluetooth or Wifi. Right now we need to have the Instrumentation Toolbox on a PC, but in a day or so we'll have this working for Mac/Linux without Instrumentation Toolbox.
USB cable interface is hard because it requires an HID driver.
  댓글 수: 2
John
John 2013년 10월 31일
Thanks for the link. I'll take a look.
Peter Corke
Peter Corke 2013년 10월 31일
Would be happy for comments and feedback. It's a work in progress, but I think sufficiently useful at this point to share. Working on more sensors, richer motor interface, and Win/Mac/Linux portability.

댓글을 달려면 로그인하십시오.


Kutay Ça??l Ça??l
Kutay Ça??l Ça??l 2013년 11월 20일
When I try to run these code, I am getting the following error; By the way, I am using Matlab R2013a and Mac OS X platform. Please, share your opinion. Thanks.
--------------------------------------------------------------- Warning: The following error was caught while executing 'Brick' class destructor: Attempt to reference field of non-structure array. Error using loadlibrary (line 419) Failed to preprocess the input file. Output from preprocessor is:/bin/bash: gcc-4.2: command not found
Error in hidapi (line 94) loadlibrary(hid.slib,hid.sheader);
Error in usbBrickIO (line 58) brickIO.handle = hidapi(0,brickIO.vendorID,brickIO.productID,brickIO.nReadBuffer,brickIO.nWriteBuffer);
Error in Brick (line 114) brick.conn = usbBrickIO(brick.debug); ---------------------------------------------------------
  댓글 수: 1
Liam O'Sullivan
Liam O'Sullivan 2013년 11월 21일
You need to have Xcode installed on your Mac to run the loadlibrary command in MATLAB. I believe this is missing since it cannot find the 'gcc-4.2' command or it isn't in your path.

댓글을 달려면 로그인하십시오.


Ulrich
Ulrich 2013년 11월 23일
When I tried to run the example.m with my EV3 attached via USB on a Win32/Win7 system I got the error:
Invalid MEX-file 'D:\SRC\EV3_Matlab_Corke\hidapi.dll': D:\SRC\EV3_Matlab_Corke\hidapi.dll ist keine zulässige Win32-Anwendung. Error in usbBrickIO (line 58) brickIO.handle = hidapi(0,brickIO.vendorID,brickIO.productID,brickIO.nReadBuffer,brickIO.nWriteBuffer); Error in Brick (line 114) brick.conn = usbBrickIO(brick.debug); Error in Example (line 4) b = Brick('ioType','usb');
Do I have to flash a special firmware? Is there a tutorial to get started?
Best regards Uli
  댓글 수: 1
Liam O'Sullivan
Liam O'Sullivan 2013년 11월 23일
편집: Liam O'Sullivan 2014년 1월 7일
The current build of the source has only been tested with R2013a 64-bit in Windows 7 64-bit. The error here is that it cannot load the MEX-file (hidapi.dll) which is used for the USB connections between MATLAB and the EV3 brick. The hidapi.dll file that is distributed with the source is compiled for 64-bit machines so I think that is where the problem is.
Note that no special firmware is required for the toolkit software to interact with the EV3 brick.

댓글을 달려면 로그인하십시오.


Amr
Amr 2013년 12월 26일
Hi Liam,
I have MATLAB 2013a and Windows 7 Pro 64bit, SDK 64 installed, and when I run Example.m I get the following: Error using loadlibrary (line 419) There was an error loading the library "C:\Users\amr\Downloads\EV3MATLAB\hidapi.dll" The specified module could not be found.
Error in hidapi (line 94) loadlibrary(hid.slib,hid.sheader);
Error in usbBrickIO (line 58) brickIO.handle = hidapi(0,brickIO.vendorID,brickIO.productID,brickIO.nReadBuffer,brickIO.nWriteBuffer);
Error in Brick (line 120) brick.conn = usbBrickIO(brick.debug);
Error in Example (line 4) b = Brick('ioType','usb');
Caused by: Error using loaddefinedlibrary The specified module could not be found. Please Advise, Amr
  댓글 수: 3
Alan Bindemann
Alan Bindemann 2014년 1월 18일
편집: Alan Bindemann 2014년 1월 20일
Liam,
I am also having problems getting the loadlibrary command to work with the hidapi.dll as well. My setup is as follows:
  • Windows 7 64-bit
  • MATLAB R2013a 64-bit
  • Microsoft SDK 7.1 Installed and configured using mex -setup
  • Revision 1160 of the QUT_EV3 module from the SVN repository.
When I try running Example.m the code errors out at line 419 of the loadlibrary command (The specified module could not be found). I've looked in the debugger and can't see anything obviously amiss.
When I looked at the hidapi.dll using DependencyWalker, it complains that it cannot find MSVCR120D.dll.
Any suggestions would be appreciated.
Thanks, Alan
Liam O'Sullivan
Liam O'Sullivan 2014년 1월 22일
Thanks for the feedback Alan, please refer below to my answer labelled as USB connectivity.

댓글을 달려면 로그인하십시오.


Winty
Winty 2014년 1월 16일
편집: Winty 2014년 1월 16일
Hi Liam,
I've got the same problem with the hidapi.dll file. I'm running Matlab 2013a 64bit on Windows 7 x64. The Windows SDK is set as compiler for mex files.
I also tried to get the toolkit running with Matlab 2010bSP1. I'm using this Compiler: Microsoft Visual C++ 2010 Express, because the Windows SDK is not shown within the mex setup in R2010bSP1. With that Version the hidapi.dll seems to be loaded, but i get another error when i try to run the Brick.m file:
Warning: The following error was caught while executing 'Brick' class destructor: Attempt to reference field of non-structure array. ??? Error using ==> usbBrickIO Illegal attribute 'Abstract'.
Error in ==> Brick>Brick.Brick at 120 brick.conn = usbBrickIO(brick.debug);
Any suggestions to solve that Problem?
Best regards, Winty

Liam O'Sullivan
Liam O'Sullivan 2014년 1월 17일
Hi Winty,
Can you use the Microsoft Visual C++ 2010 Express compiler in 2013a?
The 'Abstract' functionality was added into MATLAB from version 2012a. Thus for versions earlier than this you will have to remove 'BrickIO' from the various interface files to get them to work e.g. change 'classdef usbBrickIO < BrickIO' in usbBrickIO.m to 'classdef usbBrickIO < handle' etc.
  댓글 수: 2
Winty
Winty 2014년 1월 17일
편집: Winty 2014년 1월 23일
Thanks for your quick reply!
Unfortunately the Visual C++ 2010 Express compiler isn't shown when i use mex -setup so i can't use it.
Yesterday I found out that Matlab can't find the hidapi.dll. I get the same error "The specified module could not be found." when I delete that dll from the folder. Maybe Matlab or windows SDK don't have the permission to use this file or something?
Do you have any idea why matlab 2013a can't load the hidapi.dll file?
Liam O'Sullivan
Liam O'Sullivan 2014년 1월 22일
Winty - please refer below to my answer labelled as USB connectivity.

댓글을 달려면 로그인하십시오.


Liam O'Sullivan
Liam O'Sullivan 2014년 1월 22일
편집: Liam O'Sullivan 2014년 1월 25일
USB connectivity - I have uploaded a new version of the toolbox (available here) which should hopefully rectify the issues some users have been having with EV3 USB connections (32-bit MATLAB is now supported). The toolbox should now work without having to download the Windows SDK and configuring your mex compiler for MATLAB. Feedback welcome! Frequently asked questions has also been added to the toolkit website.
  댓글 수: 5
Theodore
Theodore 2014년 1월 28일
Many thanks, Liam.
Some tips for beginners like me:
- After Liam updated the library, his tools will run on a 32bit Matlab student version.
- As of today, the latest link is at QUT EV3 MATLAB toolkit
- Download, unzip.
- Connect your brick with the USB cable.
- Start Matlab
- Drag and drop "Example.m" from the unzip location onto the command window.
- You will see this: EDU>> run('E:\Matlab\CyPyLabEV3\EV3\Example.m')
your brick will connect.
Liam O'Sullivan
Liam O'Sullivan 2014년 2월 2일
Hi Winty, I can't find an easy way of doing what you want using the communication protocol in the default EV3 firmware.
I have however added mailbox functionality to the toolkit as explained here . Thus you can send the variable data via a messaging block in the Lego NXT-G environment and it can be received in MATLAB. Please note though that mailbox messaging will only work with a bluetooth connection in MATLAB (you will need the instrumentation and control toolbox for that in Windows).

댓글을 달려면 로그인하십시오.


Dale Martin
Dale Martin 2014년 3월 12일
  댓글 수: 1
John
John 2014년 3월 12일
편집: John 2014년 3월 12일
I just noticed this. That's great news.
Update: In looking a little closer at the EV3 support, I notice that there only seems to be Simulink support (NXT2.0 had both Simulink and Matlab support). Are there any plans to offer command-line support? Does this have to do with how bluetooth-serial commands are handled (or not) on the EV3 hardware?

댓글을 달려면 로그인하십시오.


Signe Engelsholm
Signe Engelsholm 2014년 4월 2일
This toolkit is great!
However, it seems that it sometimes doesn't work properly when operating multiples motors at the same time. Have anybody had similar experiences? Or a solution to the problem?
Regards Signe

카테고리

Help CenterFile Exchange에서 LEGO MINDSTORMS EV3 Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by