# Calibrate Z rotation of tool

**URL:** <https://forum.universal-robots.com/t/calibrate-z-rotation-of-tool/31983>\
**Category:** Technical Questions\
**Created:** [January 3, 2024, 10:25am UTC](https://forum.universal-robots.com/t/calibrate-z-rotation-of-tool/31983 "2024-01-03T10:25:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![apm2](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@apm2](https://forum.universal-robots.com/u/apm2)\
**Post date:** [January 3, 2024, 10:25am UTC](https://forum.universal-robots.com/t/calibrate-z-rotation-of-tool/31983/1 "2024-01-03T10:25:40Z")

</div>

Hello Community,

I’m trying to develop a function to calibrate the Y rotation of my tool or the Z rotation in the default flange TCP based on a original tool TCP. I need this because the tool con loosely rotate and the rotation can not be guaranteed from run to run. A setup is made where robot moves to a position, turns on freedrive and then the user rotations the tool so it fits into a fixture. This is what it looks like right before placement of the tool into the fixture in freedrive mode:

 ![0e0e3050-20db-4f80-ace6-71826271d984](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/e/eea1127b6d5f5479c6f43d442c23df7ab45cb45d.jpeg)  
 ![304dfeda-b35a-477e-ad78-98cb46aaee67](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/1/14a82778bf1a8d61ed82c3e1bab4f94a39fa50a2.jpeg)

How do I make this function to set a new TCP based on the original TCP and the new one after the calibration?  
My original tool tcp is p[0.0005, 0.001, 0.13741, -1.5324, -0.3603, -0.3585]
