# Palletizing when the first layer starts at different Z position

**URL:** <https://forum.universal-robots.com/t/palletizing-when-the-first-layer-starts-at-different-z-position/27628>\
**Category:** General Application Help: How do I?\
**Created:** [March 27, 2023, 7:18pm UTC](https://forum.universal-robots.com/t/palletizing-when-the-first-layer-starts-at-different-z-position/27628 "2023-03-27T19:18:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvarela](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@rvarela](https://forum.universal-robots.com/u/rvarela)\
**Post date:** [March 27, 2023, 7:18pm UTC](https://forum.universal-robots.com/t/palletizing-when-the-first-layer-starts-at-different-z-position/27628/1 "2023-03-27T19:18:59Z")

</div>

I used the wizard to program a palletizing routine that is working well. Unfortunately, the stand we use to palletize the parts can vary in height by 25mm. This will result in the robot pushing the part into the stand and damaging it or dropping it too far from the stand and damaging it. Teh parts are pressed ceramic powder, so they are very fragile, and the stands are very heavy.  
How can I program a palletizing sequence where I can measure the stand height and enter the initial z axis of the palletizing and then have the Robot offset as it adds more layer?  
I’m using a UR10e.

---

<div class="post-metadata">

**Author:** ![roguebuck](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/roguebuck/32/4848_2.png) [@roguebuck](https://forum.universal-robots.com/u/roguebuck)\
**Post date:** [March 27, 2023, 8:58pm UTC](https://forum.universal-robots.com/t/palletizing-when-the-first-layer-starts-at-different-z-position/27628/2 "2023-03-27T20:58:50Z")

</div>

The pallet template has a “feature” reference. make a feature in the installation are of the GUI, say “myFeature”, and set your pallet to reference this feature. You can change this feature in the installation area, but you can also make program-local changes by overwriting the value, in this case, just the z-pos as `myFeature[2] = z_offset`

i can think of 2 options:

1. does the operator know the precise offset each time prog is run? if so; you could assign a variable with an input from the user, then apply the offset inputted by the user with `myFeature[2] = user_input`

2. If the user doesnt know the precise offset, you could use a direction command to have the robot move in the -Z direction until tool contact (with the offset surface), then do `myFeature[2] = get_actual_tcp_pose[2]`

_Note: You will likely have to reteach your pallet after referncing your custom feature. I have never been successful at changing the feature of a pre-programmed pallet; i always set the feature of the pallet prior to programming_

TLDR - use a custom feature as reference for the pallet. capture the offset when the program starts and apply it to the feature variable.

---

<div class="post-metadata">

**Author:** ![anon78288624](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@anon78288624](https://forum.universal-robots.com/u/anon78288624)\
**Post date:** [March 27, 2023, 9:11pm UTC](https://forum.universal-robots.com/t/palletizing-when-the-first-layer-starts-at-different-z-position/27628/3 "2023-03-27T21:11:49Z")

</div>

I have been using the get\_actual\_tcp\_pose command but it has often been not taking the shortest route to the point even when I use get\_inverse\_kin command not sure how to fix this issue but I imagine you wont have this issue with your application.

---

<div class="post-metadata">

**Author:** ![roguebuck](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/roguebuck/32/4848_2.png) [@roguebuck](https://forum.universal-robots.com/u/roguebuck)\
**Post date:** [March 27, 2023, 9:18pm UTC](https://forum.universal-robots.com/t/palletizing-when-the-first-layer-starts-at-different-z-position/27628/4 "2023-03-27T21:18:23Z")

</div>

@ryan3 - Your application is complicated by Robotiq’s copilot. They are doing some blackbox stuff in an xmlrpc server with the features; especially when using their apply contact offset node, but also generally.

AFAIK, OPs application is just using the built in palletizing node and should not have an issue.

Further, OP here is only concerned about Z which simplifies this application even more.
