Page 1 of 1

Integrating joint velocity to get position

Posted: 19 Jan 2017, 04:42
by realjsk
I know the desired velocity of a revolute joint configured in passive mode. Since I can only set the position value of such a joint, I was wondering if their is a way to integrate the known desired velocity over time to a position value. I don't like to configure the joint in force/torque mode so that I don't have to deal with the control side (among other reasons). Thank you.

Re: Integrating joint velocity to get position

Posted: 20 Jan 2017, 09:16
by coppelia
Hello,

try with something like:

Code: Select all

if (sim_call_type==sim_childscriptcall_initialization) then 
    jointHandle=simGetObjectHandle('myJoint')
    lastTime=0
    jointVelocity=0.1 -- 0.1 rad/sec
end 

if (sim_call_type==sim_childscriptcall_actuation) then 
    local t=simGetSimulationTime()
    local dt=t-lastTime
    lastTime=t
    local pos=simGetJointPosition(jointHandle)
    pos=pos+dt*jointVelocity
    simSetJointPosition(jointHandle,pos)
end 
Cheers

Re: Integrating joint velocity to get position

Posted: 21 Jan 2017, 02:39
by realjsk
It worked. Thank you very much.