Use PickMovingPart with SuctionGrabber

Hey there,

for my Bachelors Thesis i will need a bit of Python programming in VC4, but i’m fairley new to this.

I built a layout where robots pick up moving glass from a conveyor with the pickMovingPart() method. I now want to add a suction grabber to the robot and make him pick the glass with it, but despite changing the tool on the robot it goes back to grabbing it with Tool[1] because the Subroutine “vcHelperLinearMove” generated by the pickMovingPart() method resets it to Tool[1]. Any way to change this?




Thank you for your question and good luck with the thesis. See the attached layout.

If you are using vcHelpers.Robot2 and the pickMovingPart() method, it is a given that you should set the ActiveTool property to the tool frame you want to use for the movement. In other cases, you might want to change the container for the picked part.

Let me know if the attached layout helps–see the PythonScript2 behavior in the robot, specifically the last two lines of code.

Test-Pick-Moving-Part-with-Active-Tool.vcmx (916 KB)

It seems like i’m not able to open the Layout (format of layout can’t be detected or is not supported) I’m using Professional 4.0.4 if that helps

Here is my code, which is settled in the Sensor Conveyor under the sensor signal:


from vcScript import *
from vcHelpers.Robot2 import *

def OnRun():
app = getApplication()
robot_comp = app.findComponent(“GenericRobot #2”)
robot = getRobot(robot_comp)
gestell = app.findComponent(“2016-09-05_Glasgestell_1800x1200_leer #2”)
comp = getComponent()
sensor_signal = comp.findBehaviour(“SensorSignal”)
stack_size = 8
while stack_size > 0:

triggerCondition(lambda: sensor_signal.Value != None)
part = sensor_signal.Value

robot.pickMovingPart(part, 0,0,0,120,0,0,0,0)

robot.releaseComponent(gestell, part)
stack_size -= 1


I fixed it manually by putting a 120 Offset as Real Tz, but i would rather have it grab in the right position by default.


Sorry, I used a newer version of VC product to make layout. Attached is version made in 4.0.5 which should open in 4.0.4.

Here are the steps:

  1. Move tool frame you want to use to the preferred location.
  2. In your script, add robot.ActiveTool(<the tool frame you want to use>) before the pickMovingPart() call.

Test-Pick-Moving-Part-with-Active-Tool-1.vcmx (882 KB)

Thanks! That worked

Hey @zesty,
Following your example and the video from the academy:

I encounter this problem in which when the robot places the part in the component with the command, the component doesn’t move and stays still in the conveyor. Do you know what the problem is?

Thanks in advance,
Test-Pick-Moving-Part-with-Active-Tool (1).vcmx (917.7 KB)

You are doing a good job. To complete the tutorial, delete the Physics Path behavior in Conveyor 2.

The tutorial is over 4 years old, and the eCatalog components are different. The Conveyor components now have a Physics Path and OneWayPath behaviors. The vcHelpers.Robot2 has two methods place() and releaseComponent(). The place() function will call releaseComponent(). The releaseComponent() by default will check for VC_CONTAINER type objects and take the first one. Since the Physics Path behavior is listed before the One Way Path, and that behavior is used.

If you want to hit the dancefloor, you could modify the vcHelpers.Robot2 module to your needs, for example add a Physics filter as an argument or so that you can pass the container object you want to place something in. There are a couple different workarounds as well, but if you do need physics just delete the behavior from the conveyor.

Side note to whomever added those heuristic path planning properties to the Conveyor, consider making a tutorial on how to use them/avoid congestion.

1 Like

Thanks a lot @zesty!!
Works perfectly when deleting conveyor’s physics path. I wouId have never guessed it was that error so I really appreciate your help.

That will be 1 billon Dogecoin, please. Jk. No problem, and it is probably a good time to update the vcHelpers at some point anyway. I’ll let support know about this.

1 Like