Support for Lego Mindstorms EV3

6 次查看(过去 30 天)
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