# TCP in wobjdata to WCS

**URL:** <https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438>\
**Category:** RobotStudio\
**Created:** [November 17, 2016, 2:27pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438 "2016-11-17T14:27:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![duesentrieb66](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@duesentrieb66](https://tech-community.robotics.abb.com/u/duesentrieb66)\
**Post date:** [November 17, 2016, 2:27pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/1 "2016-11-17T14:27:35Z")

</div>

Hello All,

in short:  
How can I calculate the position of a TCP in WCS which is rotated and moved in wobjdata?

in long:  
How can I figure out the current x/y/z in world coordinate system of my TCP at any given point in my software?

Thanks so much,  
Duesentrieb

---

<div class="post-metadata">

**Author:** ![Johannes\_Weiman](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Johannes\_Weiman](https://tech-community.robotics.abb.com/u/Johannes_Weiman)\
**Post date:** [November 17, 2016, 3:41pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/2 "2016-11-17T15:41:31Z")

</div>

Hello Duesentrieb,

What is the scope here? Are you talking about a RobotStudio addin, RAPID code, or…?

Regards,  
Johannes

---

<div class="post-metadata">

**Author:** ![duesentrieb66](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@duesentrieb66](https://tech-community.robotics.abb.com/u/duesentrieb66)\
**Post date:** [November 17, 2016, 7:09pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/3 "2016-11-17T19:09:46Z")

</div>

I am sorry to be unclear.

I am talking about RAPID code in RobotStudio.

Best, Dusko

---

<div class="post-metadata">

**Author:** ![Pavel\_Riabichev](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@Pavel\_Riabichev](https://tech-community.robotics.abb.com/u/Pavel_Riabichev)\
**Post date:** [November 18, 2016, 5:38am UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/4 "2016-11-18T05:38:49Z")

</div>

Hello

Check CPos in the RAPID manual

VAR pos pos1;  
MoveL \*, v500, fine \Inpos := inpos50, tool1;  
pos1 := CPos(\Tool:=tool1 \WObj:=wobj0);

---

<div class="post-metadata">

**Author:** ![duesentrieb66](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@duesentrieb66](https://tech-community.robotics.abb.com/u/duesentrieb66)\
**Post date:** [November 18, 2016, 1:10pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/5 "2016-11-18T13:10:10Z")

</div>

Thank you Pavel,

as I understand CPos or CRobT are calculating the position if the robot is there.

But how can I calculation this BEFORE the robot moves there? I want to control the track of the robot. The track position is, in my case, dependent where the robtarget will be.

Thanks!

---

<div class="post-metadata">

**Author:** ![Pavel\_Riabichev](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@Pavel\_Riabichev](https://tech-community.robotics.abb.com/u/Pavel_Riabichev)\
**Post date:** [November 18, 2016, 1:25pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/6 "2016-11-18T13:25:31Z")

</div>

Then you should look at the target.

var num nTargX;  
nTargX := Target\_30.trans.x;

And if you are offsettings you need to add that offset.  
/Pavel

---

<div class="post-metadata">

**Author:** ![duesentrieb66](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@duesentrieb66](https://tech-community.robotics.abb.com/u/duesentrieb66)\
**Post date:** [November 18, 2016, 1:40pm UTC](https://tech-community.robotics.abb.com/t/tcp-in-wobjdata-to-wcs/7438/7 "2016-11-18T13:40:55Z")

</div>

Here an example of my code:

```auto
 ...
 currentWobjdata.uframe.trans.x:=currentWobjdata.uframe.trans.x+i*cLog.length;
 currentWobjdata.uframe.rot:=OrientZYX(i*180,0,0);
 currentWobjdata.oframe.trans.x:=cLogEnd.tongueLength+cLogEnd.faceDepth-((currentTool.width/2)+chainsawPrecutOffset);
 currentWobjdata.oframe.trans.y:=-((cLogEnd.faceWidth/2)+chainsawPrecutOffset);
 currentWobjdata.oframe.rot:=OrientZYX(180+cLogEnd.sideAngle,0,0);

 currentRobtarget.trans.x:=fromX;
 currentRobtarget.trans.y:=fromY;
 currentRobtarget.extax.eax_a:= **here I need to know the WCS-X value of the TCP of the currentRobtarget in currentWobjdata will be**
 MoveL currentRobtarget,currentTool.f,fine,currentTooldata\WObj:=currentWobjdata;
 ...

```

Thank you
