article

Julie Weller avatar image
4 Likes"
Julie Weller posted Julie Weller edited

Changing Task Executer Stacking Rules

Changing the packing method for task executers can be tricky and also can vary widely between types. In this article we'll explore the default packing method for each TE and how to alter it to suit the model's needs. Attached is a model which demonstrates the default packing method and the comparison. The model is also the best place to get premade code for the ASRS, the crane, and the Robot:

TEStackingNew.fsm

Default Stacking on Task Executers

There are two types of default stacking methods on the TE's.

AGV's, operators, forklifts, ASRS, and basicTE's all use a simple up and down stacking method:

1691763693102.png

The other TE's (elevator, robot, and crane) don't separate the boxes at all so they all look like they're on top of each other (this is because they're mostly meant to only carry one item at a time):

1691763863355.png

Changing the Stacking Pattern:

AGV, Operator, & BasicTE:

For these objects, changing the stacking method is relatively simple.

  1. Add 5 labels to the object: numx, numy, xshift, yshift, and zshift
  2. Add an OnLoad trigger in the properties panel
  3. Set the trigger by going to Visual->Set Location
  4. Type in this code
current.xshift+item.size.x*((item.rank-1)%current.numx)
-current.yshift+item.size.y*(Math.floor(((item.rank-1)/current.numx)%current.numy) - (current.numy-1)/2)
current.zshift+item.size.z*Math.floor((item.rank-1)/current.numx/current.numy)

The only thing that differs between these 3 objects are the label values. The labels "numx" and "numy" sets the number of objects in the x direction and how many in the y direction. For example a 3x3 grid on the AGV would set "numx" be 3 and "numy" be 3


xshift yshift zshift
AGV 1 .5 .5
Operator .75 .29 1.10
BasicTE 0 0 .85

Elevator, Robot, & Crane:

These objects are very similar to the TE's above. You'll follow the same steps above, except on the On Load trigger, choose to just paste custom code in the box. They have slightly different code (due to the different direction/ways of stacking) that you can copy from the model above. However, you will still add the labels to the TE's. You can set them using labels like these:


xshift yshift zshift
Elevator .7 1 .095
Robot .34 .35 .2
Crane .2 .5 -.25

Forklift:

This is the easiest object to change because it is already built into the TE.

To change the stacking pattern just add an OnEntry trigger and select Transporter Stacking Method, then just change the values to be what you would like.

1691785677904.png

ASRS:

For this one, you can change the stacking method by editing the model tree.

The steps to change it are simple but specific:

  1. Open the model tree for the object by right clicking and selecting Explore Tree
  2. Find the behaviour node beneath the ASRS Node
  3. Add an node underneath called "eventfunctions"
  4. Beneath the node you just created add a node called "OnPreDraw"
  5. Paste in that node the code below (you can edit this to alter the stacking method how you would like):
inheritcode();

TaskExecuter current = c;
Object followingObj = first(current);

double numx = 1;
double numy = 4;
double xshift = .95;
double yshift = 1.45;
double zshift = .1;

while(objectexists(followingObj)){
double x = xshift+followingObj.size.x*((followingObj.rank-1)%numx);
double y = -yshift+yloc(node(">visual/drawsurrogate/Lift/Slide", current))+followingObj.size.y*(Math.floor(((followingObj.rank-1)/numx)%numy) - (numy-1)/2);
double z = zshift+followingObj.size.z*Math.floor((followingObj.rank-1)/numx/numy);
double xFactor = 0.5;
double yFactor = 0.5;
double zFactor = 0;

setloc(followingObj, x, y, z, xFactor, yFactor, zFactor);

followingObj = next(followingObj);
}

Some things to keep in mind:

Each TE is completely customizable by the user so the offset I considered to look right may not look right to you, the good thing is it's very changeable!

stacking itemstackingstacking logicagv stackingtask executer item stacking
1691785677904.png (12.6 KiB)
1691763693102.png (186.9 KiB)
1691763863355.png (79.7 KiB)
testacking.fsm (83.3 KiB)
testackingnew.fsm (83.2 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Article

Contributors

julie.weller contributed to this article

Related Articles