### Using script function of LUA on MATLAB

Posted:

**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.

> http://forum.coppeliarobotics.com/v ... 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

LUA code for the non-threaded code of Cuboid

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.

To do this, I felt that I need to know about joint velocity and acceleration.

According to previous FAQs, I could find some references.

> http://forum.coppeliarobotics.com/v ... 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]
local
res,v=simGetObjectFloatParameter(jointHandle,sim_jointfloatparam_velocity)
return {},{v},{},''
end
```

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.