RMLMoveToJointPositions function

Typically: "How do I... ", "How can I... " questions
Post Reply
adrialopezbou
Posts: 7
Joined: 17 Nov 2020, 10:37

RMLMoveToJointPositions function

Post by adrialopezbou »

Hello,

I am having trouble trying to use the rmlMoveToJointPosition functions to move three joints of a robotic arm synchronously, so that all of them move with different velocities in order to finish the movement at the same time. I have tried with all the flags of the function specified in the help files and all joints move at the same velocity, getting the same result as using three separated SetJointTargetPosition functions.

I use the torque/force mode in all the joints, and I am using python to calculate each joint angle and then pass the angles as three float signals and one integer signal to tell a function in a threaded child script to execute the rml function.

This is the threaded child code:

function sysCall_threadmain()
movingWithRML=0
q1=0
q2=0
q3=0
qT={q1,q2,q3}
cVel={0,0,0}
cAcc={0,0,0}
vMax={5,5,5}
aMax={5,5,5}
jMax={0,0,0}
vT={0,0,0}
baseMotor=sim.getObjectHandle('BaseMotor')
mainArmMotor=sim.getObjectHandle('MainArmMotor')
shortArmMotor=sim.getObjectHandle('ShortArmMotor')
joints={baseMotor,mainArmMotor,shortArmMotor}
sim.setIntegerSignal('movingWithRML',0)
sim.setFloatSignal('q1',q1)
sim.setFloatSignal('q2',q2)
sim.setFloatSignal('q3',q3)

-- Put your main loop here, e.g.:
--
while sim.getSimulationState()~=sim.simulation_advancing_abouttostop do
movingWithRML = sim.getIntegerSignal('movingWithRML')
if movingWithRML==1 then
sim.setIntegerSignal('movingWithRML', 0)
qT[1]=sim.getFloatSignal('q1')
qT[2]=sim.getFloatSignal('q2')
qT[3]=sim.getFloatSignal('q3')
result,cPos,cVel,cAcc=sim.rmlMoveToJointPositions(joints,1,cVel,cAcc,vMax,aMax,jMax,qT,vT)
end
sim.switchThread() -- resume in next simulation step
end
end


Am I doing something wrong? Thanks for the help.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: RMLMoveToJointPositions function

Post by coppelia »

Hello,

normally, use the default flag (i.e. -1) for a synchronized behaviour between all joints. What might be happening in your situation: you are trying to apply target joint positions to a manipulator that is dynamically enabled. So there will also be the dynamics aspect, and if one of the joints is not able to move as fast as required (e.g. because its torque is too low, or its load too high, or because it has a low upper velocity limit), then you won't see a synchronized movement across all axes. Try to temporarily set your model to static, and see if that changes the behaviour. You can do this in the model dialog.

Cheers

adrialopezbou
Posts: 7
Joined: 17 Nov 2020, 10:37

Re: RMLMoveToJointPositions function

Post by adrialopezbou »

Hello again,

Thanks for the help, I had to increase the upper velocity limit in all joints and now it works! I thought that the maximum velocity parameter in the rml function would overwrite the upper velocity limit in the joint dynamic dialog, but I guess it wasn't the case.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: RMLMoveToJointPositions function

Post by coppelia »

nope, those are two distinct items: the RML functions that have no idea about the underlying (possibly dynamic) system, and the dynamic aspect.

Cheers

Post Reply