# Help! Get the current TCP pose

**URL:** <https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222>\
**Category:** Developer Tools\
**Created:** [July 10, 2014, 10:34pm UTC](https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222 "2014-07-10T22:34:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidina](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@davidina](https://tech-community.robotics.abb.com/u/davidina)\
**Post date:** [July 10, 2014, 10:34pm UTC](https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222/1 "2014-07-10T22:34:24Z")

</div>

Hello everyone,  
I was following tutorial in the PC SDK Manual and I want to read the current TCP pose in C# with the following:

public void Read\_Current\_Pose()  
{  
NetworkScanner scanner = new NetworkScanner(); scanner.Scan();  
Controller acontroller = new Controller(scanner.Controllers[0].SystemId);  
acontroller.Logon(UserInfo.DefaultUser);

MotionSystem aMotionSystem = acontroller.MotionSystem;  
MechanicalUnitCollection aMechCol = acontroller.MotionSystem.MechanicalUnits;  
MechanicalUnit aMechUnit = acontroller.MotionSystem.ActiveMechanicalUnit;

try  
{

if (acontroller.OperatingMode == ControllerOperatingMode.Auto)  
{  
using (Mastership m = Mastership.Request(acontroller.Rapid))

{

RobTarget CurrPos = acontroller.MotionSystem.ActiveMechanicalUnit.GetPosition(CoordinateSystemType.WorkObject);  
RapidData rd = acontroller.Rapid.GetRapidData(“T\_ROB1”, “Module1”, “rbt”)  
CurrPos = (RobTarget)rd.Value;

Console.WriteLine(CurrPos);  
}  
}  
}  
}

I wrote rbt:= CRobT(\Tool:=MyTool \WObj:=wobj0); from RAPID but I am not sure if that is the way to write it to get pose. I want to get the current TCP matrix, but when I printed the output it was not was I expected, as I got this output : [[1587.428550103,-522.655533591,0],[0,0,1,0],[-1,1,-2,0],[9E9,9E9,9E9,9E9,9E9,9E9]];. Please what am I doing wrong?

Any help will be appreciated. Thank you.

David

---

<div class="post-metadata">

**Author:** ![SjoLi](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sjoli/32/3340_2.png) [@SjoLi](https://tech-community.robotics.abb.com/u/SjoLi)\
**Post date:** [July 14, 2014, 11:04am UTC](https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222/2 "2014-07-14T11:04:18Z")

</div>

the pose consists of 2 parts a pos [x,y,z] and a rotation [q1,q2,q3,q4]

the layout you’r gettin is the **complete robtarget** which consists of a **[pos][rotation][config][external axis]**

The values u are getting are related to wobj0 which is usualy equal to the robot base frame

---

<div class="post-metadata">

**Author:** ![davidina](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@davidina](https://tech-community.robotics.abb.com/u/davidina)\
**Post date:** [July 15, 2014, 9:39am UTC](https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222/3 "2014-07-15T09:39:03Z")

</div>

Thank you very much Sjoli. I understand better now. Since I am getting myself familiar with PC SDK with Robostudio my knowledge is still limited. Since the matrix will consist of both rotation and translation, please is there a way to read that into C#? What I actually want to do is to obtain matrix by:

Move robot to a position → Read the the current position and rotation that will result in matrix → Move robot to next position → Read again → until all positions reached and read.

I need a way to approach this sequence. Can you please show some light on how to proceed?? Thanks a lot!!

---

<div class="post-metadata">

**Author:** ![SjoLi](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sjoli/32/3340_2.png) [@SjoLi](https://tech-community.robotics.abb.com/u/SjoLi)\
**Post date:** [July 16, 2014, 2:28pm UTC](https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222/4 "2014-07-16T14:28:11Z")

</div>

First get the CRobT

Then you can save the pos and orient(q1-q4) data from the target to there own datatype

MODULE Module1

pers robtarget p1:=[[100,200,300],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];  
VAR pos pos1:=[0,0,0];  
VAR orient orient1:=[1,0,0,0]

PROC Example()  
p1:=Crobt(\Tool:=tool0\WObj:=wobj0);  
pos1:=p1.trans;  
orient1:=p1.rot;  
ENDPROC  
ENDMODULE

---

<div class="post-metadata">

**Author:** ![davidina](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@davidina](https://tech-community.robotics.abb.com/u/davidina)\
**Post date:** [July 17, 2014, 1:40pm UTC](https://tech-community.robotics.abb.com/t/help-get-the-current-tcp-pose/6222/5 "2014-07-17T13:40:30Z")

</div>

Following your code and with your help, I am now able to save the pos and orient. Thank you very much. I can write the code to convert them to form the matrix from the C#… Or is there any better way to covert the output to rotation matrix instead of me writing that code? ( I need it with the transformation matrix from the camera to make the calibration)

Once again, thank you very much.
