Issue with placing part on moving object

Hello everybody,

I am fairly new to Visual Components and try to place parts on moving objects on a conveyor belt. However, sometimes the object on which the parts are placed stops even though the conveyor belt has not stopped. After it has been equipped the part starts to move again. The code I use for the robots is enclosed:

A robot picks 3 parts from the input conveyor, then looks for object on the conveyor part without any children and places the three parts on the object.

There occurs no error while the simulation is running, the object just stops moving while being handled. Does anyone know how to fix this issue?

Thanks in advance!

from vcScript import *
from vcHelpers.Robot2 import *

def getPositionClip(zaehler, seat):
  mtx =
  zaehler = zaehler + 1
  frame = seat.findFeature('Position_%i' % zaehler)
  mtx = frame.FramePositionMatrix
  if zaehler < 3:
  return mtx

def OnRun():
  app = getApplication()
  robot = getRobot()
  conveyorIn = app.findComponent("Sensor Conveyor #1")
  conveyorOut = app.findComponent("Conveyor #2")
  path = conveyorOut.findBehaviour("Path__HIDE__")
  #Clip positions UC1
  mtx_1 =
  mtx_2 =
  mtx_3 =
  mtx = [mtx_1, mtx_2, mtx_3]
  zaehler = 0
  #while simulation is running
  while app.Simulation.IsRunning:
    #pick parts
    while robot.SignalMapIn.input(100) != True:
    while conveyorIn.ComponentChildren:
      part = conveyorIn.ComponentChildren[0] 

    #Choose seat in range
    seats = path.Components
    num = 0
    for seat in reversed(seats):
      distance = seat.getPathDistance()
      #print seat.getPathDistance()
      num = num + 1
      if distance < 1500 and distance > 500:
        if seat.Children == []:
    #place parts
    zaehler = 0
    while zaehler < 3:   
      mtx[zaehler] = getPositionClip(zaehler, seat)

      try: # here the object on the conveyor randomly stops
        zaehler = zaehler + 1
        e = sys.exc_info()[0]
        print e


Third part stopped while being equpped, stopping the following parts as well. First two objects are still moving



can you upload your project? I tested for myself with only one robot and it works just fine.


thank you for your quick response. I have tested it further myself. The problem seems to be related to the amount of parts or the distance between them on the conveyor belt. If I slow down the creation interval of the feeder, the problem does not arise.

For the project, however, I have fixed distances between the moving objects (which are quite narrow), so I can’t simply increase their interval.

I hope the code is understandable.


Kind regards,


placing_parts_on_moving_objects_v0.3.vcmx (171 KB)

Hi again,

if your problem is solved thats nice! If not - did you click on the ‘Include Components’-checkbox when you save the layout? (Save as -> on the top right). I dont see any components in the project. You may use VC 4.0 ecat - i am using 4.2 ecat. Just a info for later uploads here.