# De-palletizing routine dynamically adjusting the number of layers

**URL:** <https://forum.universal-robots.com/t/de-palletizing-routine-dynamically-adjusting-the-number-of-layers/29421>\
**Category:** Technical Questions\
**Created:** [July 6, 2023, 9:26am UTC](https://forum.universal-robots.com/t/de-palletizing-routine-dynamically-adjusting-the-number-of-layers/29421 "2023-07-06T09:26:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin.greening](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@kevin.greening](https://forum.universal-robots.com/u/kevin.greening)\
**Post date:** [July 6, 2023, 9:26am UTC](https://forum.universal-robots.com/t/de-palletizing-routine-dynamically-adjusting-the-number-of-layers/29421/1 "2023-07-06T09:26:00Z")

</div>

We have an application where we load small pumps into a test station. The pumps are delivered in plastic trays which hold 14 pumps, we are planning to use the de-palletizing routine to unload the pump’s from the trays into the test machine. The proposed number of trays is 4 high. However this relies on the operator loading the correct number of trays. To check this i have programmed a search routine which returns the number of trays in the stack, can I use this number to adjust the number of layers in the de-palletizing routine so the pumps are unloaded from the correct layer? I have tried adjusting the Pallet1.cnt variable in the program but the robot stops when this is activated.

Also when I am moving the robot to the depalletizing position the move to the waypoint before the calling the depalletizing routine the robot always stops at that point even though a blend radius has been assigned. The robot makes a clunk sound when it stops and I would like to smooth this transition.

---

<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:** [July 6, 2023, 10:34am UTC](https://forum.universal-robots.com/t/de-palletizing-routine-dynamically-adjusting-the-number-of-layers/29421/2 "2023-07-06T10:34:52Z")

</div>

You’re right in thinking you have to edit Pallet\_1\_cnt. If you have 4 layers with 10 parts in each layer, Pallet\_1\_cnt will count to 40 and the depalletizing will be finished.  
So if you were to change Pallet\_1\_cnt to 10 instead of 0 (or 11 and 1 - I don’t remember the start value) before the palletizing starts, the robot should start at layer 2 instead of 1.

The “clunk” sound you’re mentioning is a very bad sound. It will put excessive wear on the robot, and it will fail prematurely. So you will want to fix that asap. 🙂  
That being said, a blend between a waypoint and a following Palletizing template should work. You don’t have any commands in-between those two, do you?  
I have seen older versions of Polyscope not always handling blend optimally. If you’re running an older version, maybe an update would do the trick. 🙂
