# Update TCP in real time

**URL:** <https://forum.universal-robots.com/t/update-tcp-in-real-time/1114>\
**Category:** Robot Communication\
**Created:** [August 25, 2017, 11:51am UTC](https://forum.universal-robots.com/t/update-tcp-in-real-time/1114 "2017-08-25T11:51:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon21910823](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@anon21910823](https://forum.universal-robots.com/u/anon21910823)\
**Post date:** [August 25, 2017, 11:51am UTC](https://forum.universal-robots.com/t/update-tcp-in-real-time/1114/1 "2017-08-25T11:51:30Z")

</div>

Hello,

I have developed a program to send a function of multiple poses via port 30001. I would like to change the TCP during the motion via set\_TCP. I do this by sending a secondary function (sec func()), but I would like to constantly change the tcp, It only seems to work once.

Is it possible to send multiple secondary functions to update the TCP?

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [August 27, 2017, 5:21am UTC](https://forum.universal-robots.com/t/update-tcp-in-real-time/1114/2 "2017-08-27T05:21:49Z")

</div>

Why not include a thread in your main program (the one sent over 30001), that waits for your new TCP data, and updates this dynamically in this program.  
E.g. by receiving the data over RTDE.

---

<div class="post-metadata">

**Author:** ![anon21910823](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@anon21910823](https://forum.universal-robots.com/u/anon21910823)\
**Post date:** [August 29, 2017, 10:17am UTC](https://forum.universal-robots.com/t/update-tcp-in-real-time/1114/3 "2017-08-29T10:17:19Z")

</div>

Thanks for the reply, I am not sure what you mean. Would I be sending set\_TCP in this thread? At the moment I send all poses in one go as a function, I then run the motion and stream data via MODBUS (pose position, current TCP) I can change the TCP but I can’t seem to get it to update more than once.

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [September 12, 2017, 7:26am UTC](https://forum.universal-robots.com/t/update-tcp-in-real-time/1114/4 "2017-09-12T07:26:54Z")

</div>

```auto
def myFunction():
   thread mySetTCPThread():
      while (no new TCP available somewhere):
         sync()
      end
      set_tcp(values read somewhere)
      sync()
   end
   threadID = run mySetTCPThread()
   while ( True ):
      # Your other motion commands
   end
end
```
