Page 1 of 1

Using script function of LUA on MATLAB

Posted: 03 Jun 2019, 03:34
by Jinhyeok
Hello, I'm Jinhyeok. For now, I'm trying to make a time delay control for a manipulator with Matlab external API.
To do this, I felt that I need to know about joint velocity and acceleration.

According to previous FAQs, I could find some references.
> ... php?t=5031
According to this link, I need to use vrep.simxCallScriptFunction but Matlab returns that string cannot be changed to int8 type.
matlab code

Code: Select all

[ret, retInts, retFloats, retStrings, retBuff]=vrep.simxCallScriptFunction(clientID,"Cuboid",vrep.sim_scripttype_childscript,'getJointVelocity',[],[],[actuator_3],[],vrep.simx_opmode_blocking);

LUA code for the non-threaded code of Cuboid

Code: Select all

function getJointVelocity(inInts,inFloats,inStrings,inBuffer)
 local jointHandle=inFloats[1]
 return {},{v},{},''

I corrected my code as above.
After some corrections of my Matlab codes, it seemed that the type of
"Cuboid" is what matters.

Since I'm new to V-REP and the syntax of LUA, my question would sound strange.

And there's one more question. Is it effective to use LUA script to implement some control code on 5R manipulator rather using MATLAB external API?
Thanks in advance and sorry for unarranged question. :)
> PS) My version of MATLAB is R2018a and the version of V-REP is 3.6.1.

Re: Using script function of LUA on MATLAB

Posted: 03 Jun 2019, 08:35
by coppelia

did you try with 'Cuboid' instead of "Cuboid"?

About your second question: with Lua code (or with C code inside of a V-REP plugin) you can run commands synchronously, without any communication overhead. With the remote API however, there is communication overhead, which tends to drastically slow down things if you have frequent function calls that need to travel to V-REP, execute something there, and return a reply.


Re: Using script function of LUA on MATLAB

Posted: 06 Jun 2019, 15:36
by Jinhyeok
Thanks for answering my question.
After try with 'Cuboid', it worked.
I felt that I need to implement joint control with child script, without remoteAPI.