Using script function of LUA on MATLAB

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 4
Joined: 29 May 2019, 16:53

Using script function of LUA on MATLAB

Post by Jinhyeok » 03 Jun 2019, 03:34

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.

Site Admin
Posts: 7199
Joined: 14 Dec 2012, 00:25

Re: Using script function of LUA on MATLAB

Post by coppelia » 03 Jun 2019, 08:35


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.


Posts: 4
Joined: 29 May 2019, 16:53

Re: Using script function of LUA on MATLAB

Post by Jinhyeok » 06 Jun 2019, 15:36

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.

Post Reply