Simple Prismatic Joint Actuation

Typically: "How do I... ", "How can I... " questions
mattyc_56
Posts: 10
Joined: 04 Feb 2020, 13:52

Simple Prismatic Joint Actuation

Post by mattyc_56 »

Hi,

Apologies in advance, I am very new to CoppeliaSim and coding in general.

I am looking to simulate the linear movement of the 2 jaws in a "Schunk EGN100" gripper. The gripper is imported already and connected to a Kuka KR10. For this I have 2 prismatic joints and I can currently manually actuate the jaws using the joint object and dynamic properties windows. The joints are in force torque mode and the motors are enabled.

However, I want to do this through a child script which is associated with the gripper. i.e I would like to be able to change the force, velocity and target positions through this child script.

1) However, setting the joint position with sim.setJointPosition has absolutely no effect and seems to be determined by the "Pos. range" in the joint properties?

2)I think setting the velocity and force in the script are working as long as I do not tick "control loop".

3) I have used your advice under this topic "viewtopic.php?t=3375" but cannot
seem to get the joint to close once it has opened.

4) I have also looked at "viewtopic.php?t=1823" which is a very similar question but I am confused as to how to use one joint to actuate both grippers and also how to properly implement the joint callback function.

Essentially, in the end, I need to be able to actuate these jaws out, move my robot into position and close them on a simple shape, possibly via a UI. For now if I could get the jaws actuating in and out 0.01 meters via a child script that would be fantastic.

Thank you very much in advance for any help!

Matthew

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

Re: Simple Prismatic Joint Actuation

Post by coppelia »

Hello Mathew,

about your questions:
  • If your joint is in force/torque mode, then it can be controlled either in force/velocity, or in position (auxiliary also in spring/damper mode, etc.). If you want to control it if force/velocity, you should know that your joint will apply the specified force until the specified velocity has been reached. You'd use sim.setJointForce and/or sim.setJointTargetVelocity. If you want to control your joint in position, then instead of using sim.setJointPosition, you should use sim.setJointTargetPosition. Make sure that the control loop is enabled in that situation (and that you do not have a force or maximum velocity of 0).
  • If your joint is in force/velocity mode, and you want to inverse its direction, you can't use a negative value for the force/torque: that value should always be positive. But you can influence the direction with the sign of the velocity.
  • For gripping it is always a better idea to apply the chopstick approach: with chopsticks, you have one actuator to open/close the sticks (hand), and one actuator to position the sticks (arm). This gives much better results that to use one stick with the left hand, and one stick with the right hand to grip an object. Most two-finger grippers in the model library of coppeliaSim use that technique. For example the Baxter gripper model. Have a look how it was implemented: BaxterGripper_centerJoint would be the arm actuator with the joint control callback (basically centering the two fingers relative to the gripper base). And BaxterGripper_closeJoint would be the hand actuator.
Cheers

mattyc_56
Posts: 10
Joined: 04 Feb 2020, 13:52

Re: Simple Prismatic Joint Actuation

Post by mattyc_56 »

Hi,

Thank you so much for getting back to me! I will attach a link to my scene below.

I have managed to get the gripper functional using a center joint and a open/close joint as you suggested.

1) Currently, in the "KukaKR10" child script I set the gripper data (velocity, force and open - copied from UR5 example scene)

2) The "EGN100" child script then assigns the force and velocity to the "EGN100OpenCloseJoint".

3) The "EGN100CentreJoint" child script makes use of the joint callback function you suggested in your reply.

So currently if I want to change the gripping force of my gripper, I can easily change it on line 6 of the "KukaKR10" child script.

This however only changes the force applied by the "EGN100OpenCloseJoint" and as a result the right hand gripper and the therefore the gripping force of the left hand gripper is not changed. I think this is because the "EGNCentreJoint" (attached to the left hand gripper) has "Control loop enabled". If I disable this however the gripping fingers begin to float around in mid air.

So in a nut shell I need to be fit to control the gripping force of both joints in the script so that I can assign an exact overall gripping force. Is this possible?

I have noticed that in the the example scene "ur5WithRg2Grasping" the CentreJoint does not actually actuate and the OpenClose joint seems to actuate both fingers and therefore changing the force of this joint changes the entire gripping force? This would work perfectly!

Thank you very much for any help, please let me know if you need any more info or don't quiet understand. Here's a link to my scene.


https://ucd-my.sharepoint.com/:u:/g/per ... g?e=cmBTTX

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

Re: Simple Prismatic Joint Actuation

Post by coppelia »

The centerJoint of the ur5WithRg2Grasping.ttt demo scene is actually actuating, and doing the exact same thing as in your robot.

The grasping force is actually given by the force in the open/close joint. Think about the chopstick example: the open/close joint is your hand that holds the chopsticks. You can adjust the closing force. And the centerJoint is your arm that positions your hand. The arm can be controlled in position and operate with a much larger force/torque, which doesn't change the fact that your had holds the chopsticks with another specific force. Of course, there are border effects when your gripper is opening and something is blocking the finger attached to the centerJoint.

In any case, maybe it is possible to create a better gripper model with two good joint controllers for each individual finger, but we haven't had any success with this yet (things will also highly depend on the physics engine you use)

Cheers

mattyc_56
Posts: 10
Joined: 04 Feb 2020, 13:52

Re: Simple Prismatic Joint Actuation

Post by mattyc_56 »

Understood, thank you again!

Just another quick question. Do you have any idea as to why the robot "jumps" slightly on its path as it gets back to its starting position and begins to descend with the part gripped? It doesn't do this on its return path either?

Really appreciate all your help.

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

Re: Simple Prismatic Joint Actuation

Post by coppelia »

It is your 4th argument in the sim.followPath function. It should be zero.

Path objects are actually not that convenient and flexible, specially if they are straight. Better is to generate the path yourself via a function. Have a look at this demo scene for instance.

Cheers

mattyc_56
Posts: 10
Joined: 04 Feb 2020, 13:52

Re: Simple Prismatic Joint Actuation

Post by mattyc_56 »

Hi again!

Thank you very much for the help above! Here's my latest scene:

https://drive.google.com/open?id=1dqSZu ... Z69NVFVL5M

I have now placed a force sensor between the gripping fingers and the jaw which holds them in the EGN100 Gripper.

I use this to read the force in the Y-axis three times during the lifting process.

I have downloaded Vortex and am I having a lot of success with it. With Vortex, when I change the gripping force (on line 6 of the KUKA KR10 child script) the force sensors read it accurately as far as 160N. However, once I go over this, for example 350N, the force sensor consistently only gives readings of around +/- 166N in the Y axis.

Do you have any idea why this is?

Thanks in advance!

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

Re: Simple Prismatic Joint Actuation

Post by coppelia »

Your jaw shapes are convex shapes, but not pure primitive shapes (i.e. cuboids). This normally results in slower calculation and less stable contacts with physics engines.

The forces measured via one of the physics engines heavily depend on how the selected physics engine operates internally. Most will display a limited force measurement when trying to apply a very large force within relatively small mass and/or inertia shapes. What happens if you increase the masses and/or inertias of your cube and gripper?

Cheers

mattyc_56
Posts: 10
Joined: 04 Feb 2020, 13:52

Re: Simple Prismatic Joint Actuation

Post by mattyc_56 »

Hi,

Thank you very much for the reply!

I have tried to change the fingers and jaws to simple convex shapes and also to primitive cuboids. I have increased and decreased the moments of inertia and masses on the above also.... All with no success.

Newton seems to be able to pick up the force increase however?

I have also used the ur5Grasping scene and measured the force increase with Vortex there as my code is very similar and it works perfectly with this scene.

I cannot see what else there is to change?

Thanks again!

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

Re: Simple Prismatic Joint Actuation

Post by coppelia »

I am really at a loss what is going on there...

Post Reply