Hello, I’m currently developing a URCap for an interface between two of our robots. I want the URCap program node when executed to call a function within the Program Node Contribution similar to how the Hello World URCap creates a popup on execution.
I know that the Hello World URCap is using the GenerateScript function and a script line to create the popup.
I can put my function into generateScript but its only called when the program is started. Just to be clear i’m trying to call a function (inside of the program node contribution script) when the program node is executed durning run time.
Okay this works but not the way I want. Is there a way to call a function within the program node java script? This function sets up a socket connection and then sends a message to a connected computer running a python server. I know I can simiply
It sounds like an XML-RPC call to connect from your running robot program, to an external function, e.g. running in a Python script.
Check out the XML-RPC Math sample found under the samples topic.
Could TCP/IP communication also be implemented directly in the URCap without using URScript? In other words, could the socket connection run through a Java function instead of having to use a ScriptWriter to build a URScript function?
Additionally, when the Robot Program reaches the Program Node during execution, what method(s) is executed in the URCap, besides generateScript()?
URCap contributions are not called during program execution. They are only supplying script code that is executed by real time controller thread. Basically they are called just once before program starts execution.
Only way to communicate from real time thread to URCap is to use network sockets.
Is this still the case?
I’m trying to communicate from the real time thread to my URCap, seems like some needles extra actions.
So the only way is to use network sockets ?
I have a ProgramContrbution that uses functions from my ModBus communication protocol. So i should make a websocket to communicate from the real time thread to the programcontribution to call these functions ?
I’m curious why though ? Is it speed or functionality ?
I’ve managed quite fine with just a simple socket in Java.
Doing this for testing on my internship assignment.
I have been making a URCap to control Festo Motors with the modbus protocol.