Universal Robots Forum

Possibilities to write to file

Hi all,

As we want to log some data for analysis or to debug, it will be nice to have the possibilities to write the values of variables to a file. Maybe am I missing something but I don’t think it’s possible right away.


That would make a good URCap…

1 Like

This could indeed be an interesting URCap.
Consider a program node, that sends relevant data on the fly to a daemon (socket-style), that outputs this to a log.
Data could be shown in the installation node, or sent somewhere.
The daemon could also read the RTDE or client interface output, to log positional data or similar available output.

What kind of information, would be relevant to log?

1 Like

I think It would great to not have any restrictions on that. For example, I used to log force() to understand well the limits of that function and try to make good filter on that input. I also log the pose to make a kind of trajectory-recording function and to show the path done vs. the path wanted (log the deviations).
Unfortunately as I never done a URCap, I don’t have any clean code to share (my things were kind of sketchy :smile: )

@jbm Is there a way today to read the values of variables on port 30001? I thought I saw in the documentation that could be done or am I wrong?

It would be very helpful to be able to write variables to a file and then read those variables back from a file.

I know this can be accomplished through the configuration but this gets messy when trying to use the same main program and loading a configuration just to get the variables. All the associated messages and reboots confuse an operator.

I run template programs to do the same basic operations and then change the variables to determine the exact locations.

If I could save just the variable values to a file and then recall the variables without having to change configurations, that would be great.

Right now I’m working on trying to accomplish this with XMLRPC and Python on a separate computer but I should be able to accomplish this on the robot itself.


Set of programs that I always run that perform the same operation
Use variables for the positions
Would like to save variable values to a file and then recall variable values


1 Like

Please refer to the Client Interface documentation.
For the Primary Client two packages are of relevance, if you want to read the value of variables in programs.
Namely the GlobalVariablesSetupMessage and GlobalVariablesUpdateMessage with message type 25.
These are transmitting the current value of existing global variables in the program as they are changed - hence from this infertace, you may read the value of all variables that are also shown in the “Variables” tab.


Hi, I have just a problem with this.
I read robot messages correctly, but I never receive GlobalVariablesSetupMessage. Is necessary to send something to robot?

Hi GlobalVariableSetupMessage is sent out only once you start the program. Please also note to read the byteStream received until it reaches its bound or when you get message Type 25, i.e. setup message.

1 Like

@mbush, you can read the variables through port 30001. My experience is passing whole bytestream until you get variable update message or its bound.

I once made a urcap for this. But sorry I have only Chinese help doc. But I guess it won’t prohibit you from understanding the function meaning and usage method.xmlrpcfile. Doc in Chinese, help doc

1 Like


I’ve installed the urcap xmlrpcfile with polyscope simulator version 3.5. But I’ve had a problem: when i run the code file.mkfile(“text”.txt), this line of code not return a true value.

How can I do?

I’ve checked the checkbox run file demons.