Page 2 of 4

Re: Simulink and V-REP

Posted: 12 Aug 2013, 19:04
by trabias
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

Re: Simulink and V-REP

Posted: 13 Aug 2013, 23:47
by trabias
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:
"loadlibrary(obj.libName,obj.hFile)"
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

Re: Simulink and V-REP

Posted: 14 Aug 2013, 17:35
by coppelia
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

Re: Simulink and V-REP

Posted: 14 Aug 2013, 18:23
by trabias
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

Re: Simulink and V-REP

Posted: 01 Apr 2014, 14:38
by dds
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?

Re: Simulink and V-REP

Posted: 02 Apr 2014, 08:15
by coppelia
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

Re: Simulink and V-REP

Posted: 04 Apr 2014, 14:50
by dds
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.

Re: Simulink and V-REP

Posted: 04 Apr 2014, 16:13
by coppelia
It is ok not to call the destructor (the destructor is currently anyway empty).

Cheers

Re: Simulink and V-REP

Posted: 04 Apr 2014, 20:55
by dds
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

Re: Simulink and V-REP

Posted: 06 Apr 2014, 18:08
by coppelia
Make sure you check the Simulink help resources, your problem is not directly linked to V-REP. Make sure to carefully read this page for example.

Cheers