# How to get a tcp pose via ethernet connection

**URL:** <https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454>\
**Category:** Technical Questions\
**Created:** [February 25, 2020, 7:40am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454 "2020-02-25T07:40:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon44063275](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon44063275](https://forum.universal-robots.com/u/anon44063275)\
**Post date:** [February 25, 2020, 7:40am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/1 "2020-02-25T07:40:36Z")

</div>

Hello,

Is there a way to get tcp pose of current robot through ethernet connection to UR robot in pc application?

---

<div class="post-metadata">

**Author:** ![fujikit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/fujikit/32/6042_2.png) [@fujikit](https://forum.universal-robots.com/u/fujikit)\
**Post date:** [February 25, 2020, 7:46am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/2 "2020-02-25T07:46:40Z")

</div>

There are some ways to get tcp pose.

1. use primary/secondary client and get q\_target or q\_actual.
2. use RTDE and get target\_q or actual\_q.

I often use RTDE but it is difficult to understand RTDE, so I recommend use primary/secondary client at first.

---

<div class="post-metadata">

**Author:** ![anon44063275](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon44063275](https://forum.universal-robots.com/u/anon44063275)\
**Post date:** [February 25, 2020, 8:06am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/3 "2020-02-25T08:06:38Z")

</div>

Thank you for the reply.

1. If I use a primary / secondary client, can I use port 30001 or 30002? And how should I send a command after connecting?

2. Are there any examples of implementing RTDE in the c ++ language?

---

<div class="post-metadata">

**Author:** ![anon79053281](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon79053281](https://forum.universal-robots.com/u/anon79053281)\
**Post date:** [February 25, 2020, 8:10am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/4 "2020-02-25T08:10:46Z")

</div>

yes, you are right. I strongly agree with you. we wrote code to read the RTDE using ethernet connection, and can only retrieve data once a time at beginning.  
like this:

```auto
received 4 bytes data successfully.
>>
data size=812
received 808 bytes data successfully.
>>@梹 臎ャ?鸷Z鷒PA?')髍??漌�傀訟餑玒?鄡/梺?繍�n�坻�
1504.03
1.0455 -3.01912 1.7993 -1.92682 0.516014 -0.0157411
0 0 0 0 0 0
0 0 0 0 0 0
2.53846e-17 2.51047 -0.420212 0.0179899 -0.000153302 0
3.24469e-16 32.2933 -5.39032 0.178921 -0.00152608 0
1.0455 -3.0191 1.79928 -1.92684 0.516016 -0.0157542
0 0 0 0 0 0
-0.141234 2.34493 -1.05589 0.0838773 0.218081 -0.247057
9.97947 0.497475 0.860093
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-26.8163 -4.86466 -16.7654 2.40645 7.18445 -1.81036
0.32087 0.193182 0.603869 -1.22156 1.20834 -1.22965
0 0 0 0 0 0
0
30.1 29 28.5 31.2 34.3 35.2
0.025572
8
0
253 253 253 253 253 253

```

However, do you have ideas on how to connect using primary/secondary?

---

<div class="post-metadata">

**Author:** ![fujikit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/fujikit/32/6042_2.png) [@fujikit](https://forum.universal-robots.com/u/fujikit)\
**Post date:** [February 25, 2020, 8:34am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/5 "2020-02-25T08:34:14Z")

</div>

To @anon44063275

I can use port30001 and 30002. After connection, buffer of data included pose will have flowed constantly.  
You build socket client and recieve the buffer.

I don’t know examples of RTDE other than python code.

---

<div class="post-metadata">

**Author:** ![fujikit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/fujikit/32/6042_2.png) [@fujikit](https://forum.universal-robots.com/u/fujikit)\
**Post date:** [February 25, 2020, 8:37am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/6 "2020-02-25T08:37:13Z")

</div>

To @anon79053281

I use primary/secondary client easier than RTDE.  
But I sometimes use RTDE too for the other purpose.

---

<div class="post-metadata">

**Author:** ![inu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/inu/32/732_2.png) [@inu](https://forum.universal-robots.com/u/inu)\
**Post date:** [February 25, 2020, 1:19pm UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/7 "2020-02-25T13:19:36Z")

</div>

Hey guys,

A colleague posted an example through python accessing the secondary client, it may be a good reference point for this discussion. Hope it helps !

> [@How to process package from robot controller](https://forum.universal-robots.com/t/how-to-process-package-from-robot-controller/390/4):
>
> You can use the Struct library in python to unpack the byte stream, using the information in [this excel sheet](https://s3-eu-west-1.amazonaws.com/ur-support-site/16496/Client_Interface.xlsx) to tell you which info can be found where. You may want to consider using the RTDE instead of the other client interfaces, that way you can customise the stream to only include the information you want, so you don’t need to sift through the whole lot. Here’s a python example getting some basic positional info from the client interface stream. You’d probably want to step through the pac…

---

<div class="post-metadata">

**Author:** ![anon79053281](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon79053281](https://forum.universal-robots.com/u/anon79053281)\
**Post date:** [March 3, 2020, 10:58am UTC](https://forum.universal-robots.com/t/how-to-get-a-tcp-pose-via-ethernet-connection/6454/8 "2020-03-03T10:58:32Z")

</div>

thanks for your reply, that is a great example to show connection on robot and pc. And now I finished a tool which connects pc to the ur robot in the same way as you said above. However, I implement it by C++.  
[implemented by cpp](https://github.com/JohanCHM/UR-robots/edit/master/manipulation/Ethernet%20Control/cpp/readme.md)
