Universal Robots Forum

URCaps Java Socket / send data when program node is activated

Hi all, I’m really new to URCaps devlopment and I would require a bit of help to understand and achieve the project I’m developping.

Basically, the URCaps is a TCP Socket (Client) that exchanges datas with a server that is an industrial device.
Communication is not really the issue as the connection is well established, and I manage to send data, receive data will be done later, but my problem is to send data when a program node is reach.

I’ve created a program node “SendData” with in its configuration page, a field that contains data to send.
What I did not manage to do, is to send the data when node is reached.

Can someone give me an example of interaction between the node in the UR program and the program node in the URCaps ?
Is there a simple way, Something like an event that the program node is reached ?

Thanks in advance for your future contributions.

Eddie.

Hi @eddie.lerat

Maybe reading this article about UR Software Architecture would be beneficial to you, in understanding how PolyScope and URScript are operating together.

Hi @jbm,
Thanks for your quick answer.
I’ve already read some part of this article, but I should have miss some parts, particularly, the one explaining the use of Deamon.
Am I in the right direction if I use Deamon to interact between my program node and my URCaps at runtime ?
Thanks

Hello,

depends on what you are trying to do. Are you trying to interface with some equipment which has defined protocol?

What did you do? What did you expect would happen? What happened instead?

Hello,
I’ve a special protocol to implement, what I would like to do is to send a particular message when a program node is activated.
I’ve created an installation node where I configure IP address an TCP port, I’ve also created a program node that is “Send message”.
In this program node, I’ve created a field where I store the message to send.
So, when the program node is reached in the UR program tree, I would like to send over my socket the configured message.

Then you need to put the code you would like to execute in generateScript method of your Program Node. Probably it will be socket_send_string function.

Thanks for your answer Dozmin but my socket is not manage in the script, but in the URCaps as there is not the right functions to achieve data reception treatment.
What I need is to be able to activate a function of my program node when this node is activated.

Then I advise using XMLRPC. Daemon is a server, handles all the difficult stuff. Robot calls functions through rpc object in script.

Really thank you, I’ve downloaded mydeamon example program, it seems that it is what I was looking for.
I will now invstigate how to use it, and how to implement the functions that I requires.
I can close the Topic as the main question I had is probably solved.
Thanks both.