Java in simulink code - EV3

2 views (last 30 days)
Marco Biroli
Marco Biroli on 25 Dec 2016
Commented: Sharmila Raghu on 29 Dec 2016
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 Comment
Sharmila Raghu
Sharmila Raghu on 29 Dec 2016
Please contact the author of the third party Toolkit, that you are using for assistance regarding this error.

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!