Detach

Dear VC forum,

Currently I’m trying to model my own end-effector (image included). It’s supposed dispense round eatingpaper from the cartridge above the rotating vacuumtool. Goal: The link grabs one paper, rotates and releases it when the rotation of 180 degrees is done.

Pardon my lack of knowledge of VC, i’m new and learning. The rotating link grabs one paper and rotates 180 degrees. The problem occuring is that the paper is attached to it’s parent node, the rotating tool (link_4). When I use the detach button in Home -> hierarchy, the paper is released and I can use my grab/release tools pick and place further. But if the paper is attached to the parent, it stays attached to link_4, even if I release it with my tool.

Is there a python way of releasing the paper into the world (just like the detach button)? After this I could just use my tool to grab/release the paper.

 

Code in end-effector:

#script for 180deg toolrotation

from vcScript import *
from vcNode import *
from vcServoController import *
from vcContainer import *

comp = getComponent()
app = getApplication()
node = comp.findNode("Link_4")
container = comp.findBehaviour("ComponentContainer")
graspcontainerlink4 = comp.findBehaviour("GraspContainer_vacuumCompleteToolVisualComponents_Link_4")
movetime = comp.getProperty("motionTime") #motionTime in Properties
servo = comp.findBehaviour("Servo")

gosignal = comp.getBehaviour("TurnSignal")
donesignal = comp.getBehaviour("TurnComplete")

def OnRun():
  servo.moveImmediate(0)
  while True:
    triggerCondition(lambda : getTrigger() == gosignal and gosignal.Value == True)

    #pick label
    label = container.Components[0]
    graspcontainerlink4.grab(label)
    ouwel = getApplication().findComponent("ouwel")
    print(ouwel)
    
    
    #reset rotation
    if (servo.getJointValue(0) < 360):
      servo.setJointTarget(0,servo.getJointValue(0)+180)
    else:
      servo.moveImmediate(0.0) #moves to 0 degrees in 0 simtime
      
    #rotate
    servo.setJointTarget(0,servo.getJointValue(0)+180)
    servo.setMotionTime(movetime.Value)
    servo.move()              #start turning
    donesignal.signal(True)   #done turning
    delay(0.01)
    donesignal.signal(False)  #signals off
    gosignal.signal(False)    #signals off
  pass


 

Hi ,

If you want to use an End effector with robot it’s better to control grasp & release action in robot program. This can be done either programming menu or Python Script.

At this method you can select how to control your tool either Digital Input output or servo joint.

Modelling Gripper Video may help you :https://academy.visualcomponents.com/lessons/model-a-gripper-part-2/