Doubt about sim.rmlPos

Typically: "How do I... ", "How can I... " questions
Bellinsbauer
Posts: 21
Joined: 22 Apr 2018, 07:44

Doubt about sim.rmlPos

Post by Bellinsbauer » 08 Aug 2018, 12:23

Hello,
I'm using the sim.rmlPos function for my task and one of its input is "maxVelAccelJerk".
In my script i defined this as:

Code: Select all

local maxVelAccelJerk={0.2,0.2,0.2,0.4,0.4,0.4,0.6,0.6,0.6}
The values inside should be in rad/s, rad/s^2 and rad/s^3. In this way the maximum values for velocity , acceleration and jerk should be 11.46 °/sec, 22.92 °/sec^2 and 34.37 °/sec^3. But when I plot the graph based on the velocity it shows values higher then those mentioned before. And I'm wondering why.
I post here my scene
https://www.dropbox.com/s/klgdskyf5226t ... 1.ttt?dl=0

Kind regards,
Leonardo.

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

Re: Doubt about sim.rmlPos

Post by coppelia » 08 Aug 2018, 18:38

Hello,

this should not happen. It is difficult to read through your code, but try some more simple examples maybe. Did you have a look at this demo scene?

Cheers

Bellinsbauer
Posts: 21
Joined: 22 Apr 2018, 07:44

Re: Doubt about sim.rmlPos

Post by Bellinsbauer » 08 Aug 2018, 20:14

Yes, I saw it several times before doing what I posted.
It's really strange, because I cannot understand what is going on. Do you have any advices? Or any idea on how to solve it?

Bellinsbauer
Posts: 21
Joined: 22 Apr 2018, 07:44

Re: Doubt about sim.rmlPos

Post by Bellinsbauer » 09 Aug 2018, 08:41

And one more question:
in RMLExamples.ttt, joint2 has this script:

Code: Select all

function sysCall_threadmain()
    h=sim.getObjectAssociatedWithScript(sim.handle_self)
    maxVel=0.1 -- rad/s
    maxAccel=0.01 -- rad/s^2
    maxJerk=0.001 -- rad/s^3

    rmlObject=sim.rmlPos(1,0.0001,-1,{0,0,0},{maxVel,maxAccel,maxJerk},{1},{180*math.pi/180,0,0})

    sim.setThreadAutomaticSwitch(false)
    result=0
    while result==0 do
        result,newPosVelAccel=sim.rmlStep(rmlObject,sim.getSimulationTimeStep())
        if result~=-1 then
            sim.setJointPosition(h,newPosVelAccel[1]) -- or sim.setJointTargetPosition, depending on the joint mode
        end
        sim.switchThread()
    end
    sim.setThreadAutomaticSwitch(true)

    sim.rmlRemove(rmlObject)
end
sim.setJointPosition is used if the joint is in passive mode. sim.setJointTargetPosition is used if the joint is in force/torque mode. If my joint is in inverse kinematics mode what should i use? I used sim.setObjectPosition in order to move the target in the direction of the object which should i reach. Is it correct?

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

Re: Doubt about sim.rmlPos

Post by coppelia » 09 Aug 2018, 11:00

Yes, typically you would change the position of the IK target object (i.e. a dummy) via sim.setObjectPosition.

Cheers

Bellinsbauer
Posts: 21
Joined: 22 Apr 2018, 07:44

Re: Doubt about sim.rmlPos

Post by Bellinsbauer » 09 Aug 2018, 12:55

Thanks.
And what about the issue before? The one related with the maximum vel, accel and jerk? Any suggestions?
Please, I'm stuck on that.

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

Re: Doubt about sim.rmlPos

Post by coppelia » 09 Aug 2018, 12:59

Please try provide a minimalistic example that illustrates your problem. We cannot afford to debug complex code / scenes of others.

Cheers

Bellinsbauer
Posts: 21
Joined: 22 Apr 2018, 07:44

Re: Doubt about sim.rmlPos

Post by Bellinsbauer » 10 Aug 2018, 08:56

I commented each single line of my code and I deleted what is useless. Now, it should be much clearer.
The script is divided in two parts which make the same things but for different purposes. In the first part the Scara goes to pick up the object with the minimum actuation time. In the second part the Scara goes to the second convejor belt to deposit its object with the minimum actuation time again.

https://www.dropbox.com/s/0ot4wpqddjx34 ... 1.ttt?dl=0

Hope it could be easier now for you to understand.
Thank you in advance.

Bellinsbauer
Posts: 21
Joined: 22 Apr 2018, 07:44

Re: Doubt about sim.rmlPos

Post by Bellinsbauer » 10 Aug 2018, 10:50

I made a simpler example as you suggested. Here there are just two joints, the object doesn't move along a convejor belt and I use the inverse kinematics and I still have the same problem. I set the maximum velocity as 0.05 rad/s for both joints and the graph shows that the joints velocities exceed this value.

https://www.dropbox.com/s/x21ugdb18oxjz ... s.ttt?dl=0

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

Re: Doubt about sim.rmlPos

Post by coppelia » 10 Aug 2018, 12:54

You are moving the robot end-effector with sim.rmlPos. This means that the position/velocity of the end-effector will be modified. i.e. the velocity of the end-effector will be limited by the specified movement profile. Not the velocity of the joints (which are another space).

Cheers

Post Reply