About controlling the opening and closing of Rg2 gripper through python.
The software version is 4.2.0 edu windows/ubuntu.
As a beginner, I hope to communicate with vrep through Python and use Python to send signals to control the opening and closing of Rg2 gripper (where Rg2 gripper is installed on UR3 or UR5 manipulator)
I found many codes on the Internet, but they can't work normally. Their software is 3.0+.
I want to ask you how to operate. Do you need to modify or delete all the Lua scripts automatically generated after importing ur and Rg2 models? How to deal with Python side. Yes get Rg2_ Openclosejoint and then call the simxsetjointmaxforce and simxsetjointtargetvelocity functions?
The error is reported below: External call to simCallScriptFunction failed (rg2Open@RG2): Failed calling script function.
Thanks a lot
how to controll the opening of Rg2 gripper through python.
Re: how to controll the opening of Rg2 gripper through python.
Hello,
from an external application, e.g. from an external Python script, best is to use the ZeroMQ remote API. From there you can then easily call any CoppeliaSim script function with sim.callScriptFunction (e.g. in the called function you can open/close the gripper). You could also simply use sim.setInt32Signal from Pyhon, and react to it in CoppeliaSim with sim.getInt32Signal. There are many different possibilities.
If you look at the RG2 model, you will see:
so from your external application, simply set the RG2_open int32 signal to 0 or 1.
Cheers
from an external application, e.g. from an external Python script, best is to use the ZeroMQ remote API. From there you can then easily call any CoppeliaSim script function with sim.callScriptFunction (e.g. in the called function you can open/close the gripper). You could also simply use sim.setInt32Signal from Pyhon, and react to it in CoppeliaSim with sim.getInt32Signal. There are many different possibilities.
If you look at the RG2 model, you will see:
Code: Select all
function sysCall_actuation()
local v=-motorVelocity
local data=sim.getInt32Signal('RG2_open')
if data and data~=0 then
v=motorVelocity
end
sim.setJointTargetForce(motorHandle,motorForce)
sim.setJointTargetVelocity(motorHandle,v)
end
Cheers
Re: how to controll the opening of Rg2 gripper through python.
非常感谢您的回复 我的问题已经得到解决。
Thank you very much for your reply. My problem has been solved.
Thank you very much for your reply. My problem has been solved.