Java in simulink code - EV3

2 次查看(过去 30 天)
Marco Biroli
Marco Biroli 2016-12-25
Hello,
I am using this MATLAB toolkit: https://wiki.qut.edu.au/display/cyphy/QUT+EV3+MATLAB+toolkit to program an EV3 robot. My problem is that I am trying to access a part of this code simply by saying:
"b = Brick('ioType','wifi','wfAddr','192.168.1.104','wfPort',5555,'wfSN','0016533dbaf5')" but if I try to run it I first got an error about varagin not being allowed here but I went around that problem and now it tells me:
"Import statements are currently unsupported.
Function 'wfBrickIO.m' (#72.2759.2765), line 74, column 13: "import"".
The part of code that causes problem in wfBrickIO.m is:
% import the required java libraries
import java.io.*;
import java.net.*;
% add the java path to the class path
javaaddpath .
% open the brick IO connection
brickIO.handle = Socket(brickIO.addr, brickIO.port);
% set the input stream
brickIO.inputStream = DataInputStream(brickIO.handle.getInputStream);
% set the output stream
brickIO.outputStream = OutputStreamSend();
% connection message to the brick
wmsg = ['GET /target?sn=' brickIO.serialNum ' VMTP1.0' char(10) 'Protocol: EV3'];
if brickIO.debug > 0
fprintf('Sent: [ %s ]\n',char(wmsg));
end
% send the connection message
brickIO.write(wmsg);
% receive the reply
rmsg = brickIO.read;
if brickIO.debug > 0
fprintf('Returned: [ %s ]\n',char(rmsg));
end
What could I do ? I tried to say "coder.extrinsic('Brick')" but then I got an error saying that Code Generation needed 'Brick'. I tried "coder.extrinsic('wfBrickIO')" but then it tells me that: "Code generation does not support class properties of mxArray type."
  1 个评论
Sharmila Raghu
Sharmila Raghu 2016-12-29
Please contact the author of the third party Toolkit, that you are using for assistance regarding this error.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by