good afternoon, I would like to implement the code provided by ROBOTIQ_85 in its second option of "You fake the grasping by attaching the object to the gripper via a connector.", in that way to take objects and not be influenced by their dynamic properties. I leave you the code and the steps that appear to me.
-- 2. You fake the grasping by attaching the object to the gripper via a connector. This is
-- much easier and offers very stable results.
--
-- Alternative 2 is explained hereafter:
--
--
-- a) In the initialization phase, retrieve some handles:
--
-- connector=sim.getObjectHandle('ROBOTIQ_85_attachPoint')
-- objectSensor=sim.getObjectHandle('ROBOTIQ_85_attachProxSensor')
-- b) Before closing the gripper, check which dynamically non-static and respondable object is
-- in-between the fingers. Then attach the object to the gripper:
--
-- index=0
-- while true do
-- shape=sim.getObjects(index,sim.object_shape_type)
-- if (shape==-1) then
-- break
-- end
-- if (sim.getObjectInt32Parameter(shape,sim.shapeintparam_static)==0) and (sim.getObjectInt32Parameter(shape,sim.shapeintparam_respondable)~=0) and (sim.checkProximitySensor(objectSensor,shape)==1) then
-- -- Ok, we found a non-static respondable shape that was detected
-- attachedShape=shape
-- -- Do the connection:
-- sim.setObjectParent(attachedShape,connector,true)
-- break
-- end
-- index=index+1
-- end
-- c) And just before opening the gripper again, detach the previously attached shape:
--
-- sim.setObjectParent(attachedShape,-1,true)
fake the grasping with ROBOTIQ and UR5
Re: fake the grasping with ROBOTIQ and UR5
Hello,
and... ? What is your exact question? What is your problem?
Cheers
and... ? What is your exact question? What is your problem?
Cheers
-
- Posts: 3
- Joined: 26 Feb 2021, 06:01
Re: fake the grasping with ROBOTIQ and UR5
Hello,
my apologies for not posting the question, how is this code implemented correctly?
(Since I always get error regarding this line shape=sim.getObjects(index,sim.object_shape_type) and this sim.setObjectParent(attachedShape,-1,true), under that I would like to know how to correctly implement this code.)
Cheers.
my apologies for not posting the question, how is this code implemented correctly?
(Since I always get error regarding this line shape=sim.getObjects(index,sim.object_shape_type) and this sim.setObjectParent(attachedShape,-1,true), under that I would like to know how to correctly implement this code.)
Cheers.
Re: fake the grasping with ROBOTIQ and UR5
and here again you do not tell us what the error says... an error message gives you important clues to what is wrong in your code.
Cheers
Cheers
-
- Posts: 3
- Joined: 26 Feb 2021, 06:01
Re: fake the grasping with ROBOTIQ and UR5
Hi,
Sorry, I will be more specific. The gripper is assembled to the UR5 robotic arm connection. Then, looking for how to take it, I managed to bring the whole assembly to a comfortable position to take the cube (cube that must have dynamic properties at the beginning of the simulation).
Now, at the time I left the default gripper programming, when I realized that the cube had movements affected by the physics of the simulation, I continued reading the default code of the gripper and found the second option in the form of comments. What I did was, to copy each one of those lines (in order as the instructions said) at the beginning and in the same function of "sysCall_actuation", leaving them after the commands already written (or after the third end in the line 36 that comes by default) and run the simulation.
When running I got the following error:
"Lua runtime error: [string "CHILD SCRIPT ROBOTIQ_85"]:56: One of the function's argument type is not correct. (sim.setObjectParent)"
which would be this command: sim.setObjectParent(attachedShape,-1,true). That command should be the last step of "before opening the gripper again, detach the previously attached shape".
So, I take this opportunity to ask, how can I fix this error (concerning sim.setObjectParent(attachedShape,-1,true))? Is it necessary to leave the second option given by the commented code in another function? In case I did not understand well the instructions that is inside this code I ask again, how to implement this second option that is in the code by defalut?
PS: Kindly I don't know if it is mandatory that the gripper has to be near the cube before starting the simulation. Also say that the gripper opens and closes without problems, and you can grab the cube in a normal way, but affected in a physical way. I take this opportunity to ask how to place the images to these comments, to make screenshots.
Cheers.
Sorry, I will be more specific. The gripper is assembled to the UR5 robotic arm connection. Then, looking for how to take it, I managed to bring the whole assembly to a comfortable position to take the cube (cube that must have dynamic properties at the beginning of the simulation).
Now, at the time I left the default gripper programming, when I realized that the cube had movements affected by the physics of the simulation, I continued reading the default code of the gripper and found the second option in the form of comments. What I did was, to copy each one of those lines (in order as the instructions said) at the beginning and in the same function of "sysCall_actuation", leaving them after the commands already written (or after the third end in the line 36 that comes by default) and run the simulation.
When running I got the following error:
"Lua runtime error: [string "CHILD SCRIPT ROBOTIQ_85"]:56: One of the function's argument type is not correct. (sim.setObjectParent)"
which would be this command: sim.setObjectParent(attachedShape,-1,true). That command should be the last step of "before opening the gripper again, detach the previously attached shape".
So, I take this opportunity to ask, how can I fix this error (concerning sim.setObjectParent(attachedShape,-1,true))? Is it necessary to leave the second option given by the commented code in another function? In case I did not understand well the instructions that is inside this code I ask again, how to implement this second option that is in the code by defalut?
PS: Kindly I don't know if it is mandatory that the gripper has to be near the cube before starting the simulation. Also say that the gripper opens and closes without problems, and you can grab the cube in a normal way, but affected in a physical way. I take this opportunity to ask how to place the images to these comments, to make screenshots.
Cheers.
Re: fake the grasping with ROBOTIQ and UR5
Simply print the value of attachedShape, just before the error happens. What does it say?
The error is very very probably because attachedShape is not defined (i.e. nil) or does not correspond to an object handle.
Cheers
Code: Select all
print(attachedShape)
Cheers