simRMLMoveToJointPositions

Typically: "How do I... ", "How can I... " questions
Post Reply
Stalkarn

simRMLMoveToJointPositions

Post by Stalkarn »

Hi!
I have created a joint on a robot that can successfully rotate if I give it a velocity in the prperties window. What I want to do is to tell the joint to rotate to a specific angle. I found the function

Code: Select all

simRMLMoveToJointPositions(table jointHandles,number flags,table currentVel,table currentAccel,table maxVel,table maxAccel,table maxJerk,table targetPos,table targetVel,table direction)
which seems to do what I want, only with several joints but I should be albe to pas tables for one joint.
The problem is I don't understand how to use it.
I created a threaded script as required and made it execute this function with following parameters. res = simRMLMoveToJointPositions(lMTalbe,-1,{0},{0},{30},{2},{80},{-math.pi/2},nil,nil); The joint has initialy no velocity and I want it to rotate to a specific angle with the above maxVelocity and maxAcceleration but nothing happens.

Could you elaborate on how this function is used, please?

Regards!

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

Re: simRMLMoveToJointPositions

Post by coppelia »

Hello,

the function allows you to drive from current joint positions to a given joint positions. So, if you have n joints, you would need something like:

Code: Select all

jointHandles={jointHandle1,jointHandle2,..,jointHandleN} -- N values
zeroTable={0,0,...,0} -- N values
maxVelTable={joint1MaxVel,joint2MaxVel,...,jointNMaxVel} -- N values
maxAccelTable={joint1MaxAccel,joint2MaxAccel,...,jointNMaxAccel} -- N values
maxJerkTable={joint1MaxJerk,joint2MaxJerk,...,jointNMaxJerk} -- N values
targetJointPositions={joint1TargetPos,joint2TargetPos,...,jointNTargetPos} -- N values
simRMLMoveToJointPositions(jointHandles,-1,zeroTable,zeroTable,maxVelTable,maxAccelTable,maxJerkTable,targetJointPositions,zeroTable,nil) -- N values
Your joints should be either in passive mode, or in force/torque mode (with position control enabled). In the latter case, make sure the joint settings allow to drive with the maxVelTable velocity, otherwise the movement will not be executed as expected. The last optional argument of the simRMLMoveToJointPositions function allows you to specify in which direction a cyclic joint should turn to reach the specified position (if left empty, the shortest direction will be used)

Cheers

Stalkarn

Re: simRMLMoveToJointPositions

Post by Stalkarn »

Hi again and thank you for the reply.

There are two things that I'm not sure about still, the first thing is the max jerk. I looked it up and it seemed to be the rate of change of acceleration (j = da/dt) and in my case I don't need the acceleration to change i.e. it can be constant so max jerk in my case is 0?
The second thing is where to put this. As it is now I have a robot with a script (non-threaded) and I have a joint connected to it that should rotate when I say it should rotate so I made a threaded script connected to the joint where I call this function.
Currently nothing is happening and I don't know why. My guess is that the joint-script is called every cycle of the program but that is just a guess.

Actualy one last thing, targetPosition is an angle between -pi to pi right?

Regards!

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

Re: simRMLMoveToJointPositions

Post by coppelia »

Did you check whether your threaded child script gets executed? If it outputs an error?

If you do not want any limitation in jerk, then just specify a large value for it.

From the API, all values have to be specified as meters, radians, seconds, kg, etc., unless otherwise specified.

Cheers

Stalkarn

Re: simRMLMoveToJointPositions

Post by Stalkarn »

Hi,
The child script is executed and I do not get any errors.

Regards

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

Re: simRMLMoveToJointPositions

Post by coppelia »

Can you post the scene?

Post Reply