How to get a tcp pose via ethernet connection

Hello,

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

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.

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?

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:

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?

To @aofk159

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.

To @leihui.li

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

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 !

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

1 Like