# Creating temporary tool relative to a existing tool.

**URL:** <https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328>\
**Category:** RobotStudio\
**Created:** [August 26, 2016, 9:36am UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328 "2016-08-26T09:36:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slokko](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/slokko/32/3431_2.png) [@Slokko](https://tech-community.robotics.abb.com/u/Slokko)\
**Post date:** [August 26, 2016, 9:36am UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328/1 "2016-08-26T09:36:28Z")

</div>

Hello  
I have a tool:  
PERS tooldata tGripper:=[TRUE,[[0,-241.92,195.917],[0.991444861,0.130526192,0,0]],[20.9, [-5.1, -4.7, 53.5],[1, 0, 0, 0], 0.064, 0, 0.769]];  
The tool is angled 15 degrees on the x-axis.  
The gripper holds a product of variable length.  
I want to create an new TCP (ex. tGripperWithProduct) at the end of the product.  
If the tool had no angle it would be easy to just adjust tGripper.tframe.z.  
And in my case here, with only one angle to consider, I have used basic trigonomety to solve this.  
I have written a function that returns the displaced tool. With “startingtool” and productlength as arguments. It works for this scenario.

But what if the tool is angled on more than one axis?  
Is there an existing function to solve this in rapid?

---

<div class="post-metadata">

**Author:** ![PerSvensson](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/persvensson/32/1040_2.png) [@PerSvensson](https://tech-community.robotics.abb.com/u/PerSvensson)\
**Post date:** [August 26, 2016, 1:30pm UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328/2 "2016-08-26T13:30:25Z")

</div>

use RelTool to move relative to used tool no need for recalculating the tcp. Take a look in the documentation regarding RelTool

---

<div class="post-metadata">

**Author:** ![Slokko](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/slokko/32/3431_2.png) [@Slokko](https://tech-community.robotics.abb.com/u/Slokko)\
**Post date:** [August 28, 2016, 11:31am UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328/3 "2016-08-28T11:31:05Z")

</div>

Oh. Ok.  
So the reltool position is calculated after the reorient. Not the other way around?  
If i write  
MoveL RelTool (p1, 0, 0, -100 \Rz:= 25), v100, fine, tool1;  
tool calculation is rotated 25 degrees and then moved 100mm backwards its z-axis  
NOT calculated 100 mm backwards and THEN rotated 25 degrees?

---

<div class="post-metadata">

**Author:** ![John\_Verheij](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_verheij/32/1724_2.png) [@John\_Verheij](https://tech-community.robotics.abb.com/u/John_Verheij)\
**Post date:** [August 30, 2016, 2:51pm UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328/4 "2016-08-30T14:51:09Z")

</div>

First the translation is performed and then the rotation. The rotation is in Z-Y-X order.

You can also see this with a small example. For example you have this robtarget:

```auto
  PERS robtarget p123 := [[0,0,0],[1,0,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];

```

Then perform a translation of 100 m in the Y- direction and a 90 degrees rotation around the Z-axis. If the rotation is performed first, then the translation will be in the X-direction (instead of the Y-direction).

```auto
  p234 := RelTool(p123,0,100,0\Rz:=90);

```

The output robtarget shows that first the translation and then the rotation is applied.

```auto
  PERS robtarget p234 := [[0,100,0],[0.707107,0,0,0.707107],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

```

---

<div class="post-metadata">

**Author:** ![Slokko](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/slokko/32/3431_2.png) [@Slokko](https://tech-community.robotics.abb.com/u/Slokko)\
**Post date:** [September 11, 2016, 6:59pm UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328/5 "2016-09-11T18:59:48Z")

</div>

Ok. So. The workaround would be…  
RelTool(RelTool(p123,0,0,0\Rz:=5),0,0,-100)  
Then the reorient would be calculated first, right?

Not very pretty but should work.

---

<div class="post-metadata">

**Author:** ![John\_Verheij](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_verheij/32/1724_2.png) [@John\_Verheij](https://tech-community.robotics.abb.com/u/John_Verheij)\
**Post date:** [September 12, 2016, 8:42am UTC](https://tech-community.robotics.abb.com/t/creating-temporary-tool-relative-to-a-existing-tool/7328/6 "2016-09-12T08:42:27Z")

</div>

Yes, that is correct. You can also define your own function in which you apply the correct order of rotations and translations.
