Hi guys,
I want to create a component at my robot TCP. I’ve created a component creator and a component container in my tool but i’m not able to do a grasp of this new component.
I guess it’s not working because the component is attached to the robot tool and I haven’t been able to dettach it from it with any script method.
Any ideas on how to solve it?
Thanks in advance!
You could do everything in python script, create a new action and/or modifiy the action script of robot, etc.
I would recommend doing it in python script and not messing with actions at all. But if you want to pursue the action route, here is a layout with simple modification to the action script that adds boolean property EmptyingContainer and if true, release action attaches everything in the container to the 3D world node.
I don’t want to study the action script in detail, but there is probably something that updates the grasp_components global variable after grasp action. Since the dynamic components are created and transferred to container automatically, they are probably not considered grasped, thereby script ignores them.
Layout- Custom Action Script for Releasing.vcmx (880.5 KB)
Python Script in robot
from vcScript import *
def OnRun():
delay(1)
creator.create()
comp = getComponent()
creator = comp.findBehaviour("ComponentCreator")
Action script (removed reference to version in Program Files, and then used Snippet > ActionScript and modified Release function)
def Release( output, detection_tolerance ):
global robot, grasp_container, grasp_association, grasped_components
# Find first the part to be released
physicsType = None
set_phys = False
part = None
if len(grasped_components) == 0:
# howdy
if EmptyContainer.Value:
release_node = sim.World
for c in grasp_container.Components:
pm = c.WorldPositionMatrix
release_node.attach(c)
c.PositionMatrix = pm
sim.update()
return "No component to release"
...
But I don’t recommend doing this. Just use python script with signals and the attach() and grab() methods for node and container objects.
1 Like
Hi zesty,
Thanks for your reply, finally I’ve just used python script as you suggested, my code was missing the “sim.update” command.
I was concerned about the possibility of doing the release on physics but I’ve been able to do it without too many problems.
Regards