## Simple Prismatic Joint Actuation

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

### Simple Prismatic Joint Actuation

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
Posts: 7690
Joined: 14 Dec 2012, 00:25

### Re: Simple Prismatic Joint Actuation

Hello Mathew,

• 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: 3
Joined: 04 Feb 2020, 13:52

### Re: Simple Prismatic Joint Actuation

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
Posts: 7690
Joined: 14 Dec 2012, 00:25

### Re: Simple Prismatic Joint Actuation

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: 3
Joined: 04 Feb 2020, 13:52

### Re: Simple Prismatic Joint Actuation

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?

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