# Depallitizing not incrementing?

**URL:** <https://forum.universal-robots.com/t/depallitizing-not-incrementing/29104>\
**Category:** General Application Help: How do I?\
**Created:** [June 20, 2023, 6:12pm UTC](https://forum.universal-robots.com/t/depallitizing-not-incrementing/29104 "2023-06-20T18:12:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrp](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@nrp](https://forum.universal-robots.com/u/nrp)\
**Post date:** [June 20, 2023, 6:12pm UTC](https://forum.universal-robots.com/t/depallitizing-not-incrementing/29104/1 "2023-06-20T18:12:02Z")

</div>

UR10e

Be Kind it’s my first program. lol.  
Attempting to tend a CNC machine.  
Currently running Depalletizing template with a single line of 10x parts (count is set correctly)  
I have taught the first and last block points - verified positions in pallet settings (with move to)

Had to rearrange a few things, not sure if I deleted a count increase.  
Everything is currently under “At Each Item”  
Last move under the AEI is a move to a home position  
It runs correctly, just does not go to next blank

looking for a little assistance.

Neil

---

<div class="post-metadata">

**Author:** ![efn](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@efn](https://forum.universal-robots.com/u/efn)\
**Post date:** [June 21, 2023, 6:34am UTC](https://forum.universal-robots.com/t/depallitizing-not-incrementing/29104/2 "2023-06-21T06:34:25Z")

</div>

Hello Neil,

The Pallet function automatically increments its counter, so you can’t really delete it.

It sounds like you’re using the At Each Item slightly wrong. All waypoints in AEI are offset for each part, so returning to a home position is not ideal. That waypoint should be placed outside of the Pallet sequence. 🙂  
What I have seen confuse other people earlier is that basic principal of the Pallet function. It works by offsetting everything for each loop of the sequence. So the whole robot program needs to loop/repeat to function correctly (or at least the part with the Pallet function).

If that is not where your issue lies, then please attach your program or a screenshot of this. 🙂

---

<div class="post-metadata">

**Author:** ![nrp](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@nrp](https://forum.universal-robots.com/u/nrp)\
**Post date:** [June 21, 2023, 1:45pm UTC](https://forum.universal-robots.com/t/depallitizing-not-incrementing/29104/3 "2023-06-21T13:45:41Z")

</div>

Thanks for the additional information.  
I was frustrated with it so before I got your response, I researched and wrote a program from scratch.

I used a double nested loop to handle a single layer array of material.  
This also made it easier to place the part back into the same spot after it was taken back out of the machine.  
(something I was struggling with using the pre-defined depalletizing template)

From the known approach height of Stock Blank 01, I used a:  
MOVEJ  
STK\_Approach\_Origin “KIND OF A Stock array Zero, Zero”

```
   MOVEL(Pose_Trans(get_actual_tcp_pose(),p[Temp_X, Temp_Y, 0,0,0,0]),a=1.2,v=0.25)    

```

**Question:** what are the last three zeros in the position vector ? it was not really explained in any of the documents I could find ?

Using some stock size and spacing variables, I was able to calculate the next stock position within the loop as I incremented the x & y counters.

**Question** : What is the cleanest way to call an external program from within my loop ? (not a sub program)

---

<div class="post-metadata">

**Author:** ![efn](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@efn](https://forum.universal-robots.com/u/efn)\
**Post date:** [June 21, 2023, 2:06pm UTC](https://forum.universal-robots.com/t/depallitizing-not-incrementing/29104/4 "2023-06-21T14:06:03Z")

</div>

1: Here’s a short article on the axis angles (last three coordinates of the position variable p[X,Y,Z,RX,RY,RZ]): [Universal Robots - Explanation on robot orientation](https://www.universal-robots.com/articles/ur/application-installation/explanation-on-robot-orientation/)

2: You can call other programs with the subprogram call, as well. It doesn’t have to saved as an actual subprogram. 🙂
