Velocity on MATLAB

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 12
Joined: 19 Feb 2016, 23:02

Velocity on MATLAB

Post by STata » 22 Feb 2016, 14:32

Dear all,

Is it possible to directly get joint velocity from VREP using MATLAB Api??.



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

Re: Velocity on MATLAB

Post by coppelia » 22 Feb 2016, 17:25


you cannot directly do that. But what you can do is something like:

Code: Select all

[ret, retInts, retFloats, retStrings, retBuff]=vrep.simxCallScriptFunction(clientId,"objectName",vrep.sim_scripttype_childscript,"getJointVelocity",[],[],['jointName'],[],operationMode);
Then, in your scene, create a non-threaded child script that you attach to object objectName and put following function at the top of the script:

Code: Select all

    local jointHandle=inFloats[1]
    local res,v=simGetObjectFloatParameter(jointHandle,sim_jointfloatparam_velocity)
    return {},{v},{},''
What will basically happen: the remote API client will remotely call script function getJointVelocity, which will execute the command and return the desired value. This approach can basically be used for all commands that are not directly supported on the client side.

Make sure you have the last V-REP release (V3.3.0), otherwise you won't have that functionality.


Post Reply