Typically: "How do I... ", "How can I... " questions
trabias
Posts: 11
Joined: 23 Jul 2013, 23:50

I had 32 bit MATLAB installed on my computer last week in order to use V-REP. It seems the compiler needed didn't get installed as well. I have contacted the systems administrator to get this resolved today.

Thanks!
Sarah

trabias
Posts: 11
Joined: 23 Jul 2013, 23:50

Hi!

I was able to figure out the issues with the compiler, but when I run my model I get a new error:

" The function 'loadlibrary' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation.

Function 'remapi.m' (#74.20282.20316), line 568, column 13:
Launch diagnostic report."

I've done some reading about coder.extrinsic from http://www.mathworks.com/help/simulink/ ... insic.html, I'm not sure where to declare the function. Any input is greatly appreciated!

Thanks!
Sarah

coppelia
Posts: 8272
Joined: 14 Dec 2012, 00:25

Hello Sarah,

it is very important that you first try to make the example program run on Matlab: programming/Matlab/simpleTest.m
If you are unable to run that program, then you have another Matlab-setup-specific problem.

Cheers

trabias
Posts: 11
Joined: 23 Jul 2013, 23:50

I have run the sample code and I receive this:
">> simpleTest
Program started
Failed connecting to remote API server
No appropriate method, property, or field delete for class remApi.

Error in simpleTest (line 36)
vrep.delete(); % explicitely call the destructor!"

Doesn't that mean it was able to build the library? I'm not sure why it isn't able to do so in the simulink file. My other idea is to write a code that calls the simulink file, calculates and gathers all of the values, and then begins the simulation.

Thanks!
Sarah

dds
Posts: 85
Joined: 20 Mar 2014, 14:35

Hello. I have also been trying to implement the functions of VREP as simulink blocks, but I have several problems because I can not handle the library in simulink, ie I can not pass the library "vrep.xxx"as an argument to the block "MATLAB Function", ie. "x=getJointPosition(vrep,jointName)". My original idea was to generate the connection in a matlab script, which in turn initiates simulink which performs all mathematical tasks and comunication until the user decides to close it, then is returned to the script which closes the connection.
What would be the correct way to connect and VREP simulink?

coppelia
Posts: 8272
Joined: 14 Dec 2012, 00:25

Hello,

can't you simply wrap all functions in Matlab function blocks?
If you look at the demo script programming/remoteApiBindings/matlab/matlab/simpleTest.m, you would have one function block in charge of creating the connection:

Code: Select all

function clientID=connectToVrep(ip,port)
vrep=remApi('remoteApi');
vrep.simxFinish(-1);
clientID=vrep.simxStart(ip,port,true,true,5000,5);
The other function blocks would be treated in a similar way.

Cheers

dds
Posts: 85
Joined: 20 Mar 2014, 14:35

Hi ! I triend this simple function on "MATLAB Function" block.

Code: Select all

function y = fcn(u)
vrep=remApi('remoteApi'); % using the prototype file (remoteApiProto.m)
%Code here
vrep.delete(); % call the destructor!
y = u;
And I get error :
Code generation does not support the 'delete' method. Handle objects are only destroyed when program execution ends, and destructors are never called.

Function 'remapi.m' (#42.19783.19904), line 561, column 9:
"function delete(obj)"
Launch diagnostic report.

coppelia
Posts: 8272
Joined: 14 Dec 2012, 00:25

It is ok not to call the destructor (the destructor is currently anyway empty).

Cheers

dds
Posts: 85
Joined: 20 Mar 2014, 14:35

Any way

Code: Select all

function y = fcn(u)
vrep=remApi('remoteApi'); % using the prototype file (remoteApiProto.m)
%Code here
y = u;

gives the same error

coppelia