Setup for physics path behavior

Anyone know how to configure a physics path in component?

I created the behavior in a Conveyor component I found in eCat. Next, I set the input and outport ports of physics path to In and Out interfaces. Finally, I created a simple geometry to divert components to either side of path.

When components are transferred into the physics path, they either disappear or a message is printed in Output panel reading that “unable to accept non-physical item.” Is this because of transferring component from sim world to physics world?

 

PhysicsPathDemo.vcmx (125 KB)

Hi Zezty, this is due to the fact that the part that you have created is not in physics world. Try to create a component and setup the the phys. behavior and the phys. collider in the geometry tree to for example box. Then translate the component somewhere on top of the conveyor, run the sim and see that it falls and travels along the conveyor. If so, the conveyor is setup nicely. After this save the component to local folder, and drag and drop the shape feeder to your layout, and attach the part to the top node of the feeder. Now the part will most likely fall thru the feeder, so you need to set the phys. collider of the feeder geometry as well.

Br
Chris

“unable to accept non-physical item" usually means that item entering the conveyor is missing the physical entity behavior. Also make sure to configure frames list in the physical path behavior, add physics entity, change it’s type to kinematic, and select “box” collider to one of it’s geometries. Optionally you can also configure additional collider padding in order to make it overlap with the feeder geometry. Then objects switching from kinematic to “in physics” state will have better support when entering conveyour container.</span>

I’m currently rendering a video, I will post it when ready.

OK. I created a Physics Entity in Conveyor and in Part component created by Feeder and set the Collider to be Kinematic. I then set Root feature of Conveyor root node to be “Boxes” and the Block divert feature to Precise.

Changing the settings did not yield the results I wanted in which the Parts jump up when they hit the Block in the middle of the conveyor.

Are there recommend setups for Belt Conveyor, Roll Bar Conveyor, Incline and Decline Conveyors?

I also want to turn on/off Physics in conveyor using component property. Is it so that I just create a Boolean type property and Python script that sets the Collider property of root features to None?

PhysicsPathDemo02.vcmx (152 KB)

Hi, what would be the expected outcome from turning off phys, would you like the parts to fall to the floor ? Currently you can not edit the physics behaviour of a component during simulation, correct me if I’m wrong Aare ?

At the moment there is not any recommended setting for “Belt Conveyor, Roll Bar Conveyor, Incline and Decline Conveyors”, but my rule of thumb when testing phys so far, is that a diverter as the one in you model should have less friction then the belt pushing the parts, and same goes if you have guide rails on the conveyor. If you then would like use an other type of stopper, like a bladder stopper, the contact part should have more friction than the belt. Further more, restitution roughly translated to “bounciness” should be less then 1. I usually put the dynamic friction to 1/10 of the static friction.

To slow down Physics Bodies, simulate atmospheric drag, or add resistance to a hinge, there are two properties available to Physics Bodies and Physics Constraints: Linear Damping and Angular Damping. Linear Damping controls how much the Physics Body or Constraint resists translation, while Angular Damping controls how much they resist rotating.
Attached is a video showing how you setup a part in phys together with a feeder and a conveyor. I will publish one more video soon, showing how to setup a diverter and what values I would choose.

Expected Outcomes:

  1. Turn off Physics -> Parts on Conveyor are not affected by Physics and move on conveyor path (normal sim world simulation of material flow)
  2. Turn on Physics -> Parts on Conveyor are affected by Physics and are move on conveyor path and are diverted (physics world simulation of material flow manipulation)
 

The attached component is what I am working on and would like to test with Advanced Feeder and another Conveyor, which is the attached layout.

 

 

ConveyorSimPhyDemo.vcmx (14 KB)

LayoutConveyorSimPhyDemo.vcmx (253 KB)

I updated the script and layout (see attachment). The internal connection is being made between proxy and paths, but the part is not moving onto path. Is it something with the proxy connection?

Notes:

  • Block component does not have Physics Entity
  • CylinderGeo has Physics Entity
 

LayoutConveyorSimPhyDemo-1.vcmx (570 KB)

Hi, did not check your edited one yet, but please check attached files below. Basically everything works as you wanted i think except that the part will jump to center of path when tranferred out from the orange box conveyor, due to the flowproxy. (Also the materials are shifting, known bug). If the green part is not fed, attach it to the blue circle of the shape feeder and run sim again.

 

 

LayoutConveyorSimPhyDemo_edited.vcmx (95.1 KB)

Diverter.vcmx (16.1 KB)

physComponent.vcmx (18.1 KB)

I think what is wrong with your script is that you need to assign the ports from the OnRun() function and not from the signal handler.

I’ll make a last attempt for the video upload now, however it feels like we have moved past tha point allready, but might be interesting for some one else.

example does not work after about 40 seconds. it is the same issue I am having when trying to switch the internal connections to handle multiple inputs and outputs by using a port signal in proxy: the connections eventually break or do not get set. that is, when the conveyor is handling two or more components at a time.

basically, should I create two components: one for simulation and one for simulating physics?

i ask because making the same component twice is not what I want to do. for example, I do not want to create two stamping machines, and if I have Works library layouts would it be possible to loop through all the components and add Physics functionality that can be disabled using Boolean property.

but right now I am just concerned about whether two components is the preferred approach or there is working proxy capability to handle sim and physics parts.

Well, if you are handling more then 1 part at a time, you would have to extend the example with some sensor that can sample both the physPath and the normPath, i.e. volume or ray cast. I would choose ray cast, then you have to switch the correct output port when the part approaches the end of the path. Alt. you can have a book keeping, so you know what part entered first, and what port it should go out on. and then pop from that list when a part has left.

Yes, I looked at the Turn Table for how it handles the routing, but I want the component to handle everything at the gate.

No idea why the attached layout does not work. It fails as soon as the proxy is connected to physics path in that the proxy never reconnects to sim path and non-physics parts cannot enter the flow.

LayoutSimPhysicsPartRouting-1.vcmx (841 KB)

Basically, you can run to different scripts (remember to connect the signals to both scripts), one that handles outputs and one that handles inputs. Add the item and the port to a list in the signal handler, then process them in order in the onRun logic, however this won’t work if the order of the parts changes, e.g. if you have a physical stoppper inbetween, that only stops the physical parts, in that case, you will need some sensor before the output, to actually check what part is about to leave (like a volume sensor) .

In newer versions the transition from logical path to physical path and the change of the kinematic type to be in physics from kinematics will (hopefully) be handled automatically. Things are still changing in the phys. implementation, so things might worker better in the near future.
Input Script

from vcScript import *

def OnSignal( signal ):
  global queue
  if signal == partSignal and partSignal.Value:
    part = partSignal.Value
    isPartPhysics = False
    for b in part.Behaviours:
      if b.Type == "rPhysicsEntity":
        isPartPhysics = True
        break
    ##check if part can be transferred to physics path
    port = 0
    if isPartPhysics:
      connector = physicsPath.Connectors[0]
    else:
      connector = simPath.Connectors[0]
    queue.append( (part, port, connector) )

def OnRun():
  global queue
  queue = []
  ##wait for part and then add to queue
  while True:
    condition(lambda: queue)
    part, port, connector = queue.pop(0)
    proxy.connectInternally(port,connector)
    triggerCondition(lambda: getTrigger() == pathSignal and pathSignal.Value)
    physEntity = part.findBehaviour('PhysicsEntity')
    if physEntity:
      type_ = physEntity.getProperty('Physics Type')
      type_ .Value = 0
    proxy.connectInternally(port, None)
      
comp = getComponent()
simPath = comp.findBehaviour("OneWayPath")
physicsPath = comp.findBehaviour("PhysicsPath")
proxy = comp.findBehaviour("ComponentFlowProxy")
portSignal = proxy.PortSignal
partSignal = proxy.ComponentSignal
pathSignal = comp.findBehaviour("TransitionSignal")

Output Script

from vcScript import *

def OnSignal( signal ):
  global queue
  if signal == partSignal and partSignal.Value:
    part = partSignal.Value
    isPartPhysics = False
    for b in part.Behaviours:
      if b.Type == "rPhysicsEntity":
        isPartPhysics = True
        break
    ##check if part can be transferred to physics path
    port = 1
    if isPartPhysics:
      connector = physicsPath.Connectors[1]
    else:
      connector = simPath.Connectors[1]
    queue.append( (part, port, connector) )

def OnRun():
  global queue
  queue = []
  ##wait for part and then add to queue
  while True:
    condition(lambda: queue)
    part, port, connector = queue.pop(0)
    proxy.connectInternally(port,connector)
    try:
      physEntity = part.findBehaviour('PhysicsEntity')
    except: pass
    triggerCondition(lambda: getTrigger() == pathSignal and not pathSignal.Value)
    try:
      if physEntity and outIface.ConnectedComponent:
        type_ = physEntity.getProperty('Physics Type')
        type_ .Value = 1
    except: pass
    proxy.connectInternally(port,None)
      
comp = getComponent()
simPath = comp.findBehaviour("OneWayPath")
physicsPath = comp.findBehaviour("PhysicsPath")
proxy = comp.findBehaviour("ComponentFlowProxy")
portSignal = proxy.PortSignal
partSignal = proxy.ComponentSignal
pathSignal = comp.findBehaviour("TransitionSignal")
outIface = comp.findBehaviour("OneToOneInterface_1")

This is good work. Do you have the layout where that code works or 3D PDF?

How should it work when a part exits a physics path and enters a sim path: should the part fall to the floor or set the Physics Type property to 0/None like you did in your code?

Well, in the normal case I would say that the part automatically would have its property changed to kinematics and driven on the simpath. Then again, if there is nothing connected to the end of the phys conveyor or the gap between the physics collider and the sim path is to large the part should fall to the floor. I can’t run that code any more since I have a newer version now, where some things allready have changed :slight_smile:

Yes, does not work for me either. The parts just sit at the gate and never enter paths. May I ask why you set the PhysicsType to 0 when part enters Physics path?

Hi, that is the enumerator for InPhysics, when the part were traveling on the normal path the mode was set to Kinematics, which means that the phys path can’t interact witht the part.