Universal Robots Forum

How do I write to a text-file only within polyscope?

I’m using a UR e5 Cobot, and we want to use the Cobot to probe evenness of surfaces. To do so I lower the TCP to the surface until I sense contact with a defined force, and then read out the coordinates using the “get_actual_tcp_pose()”-Command.
In a first try I’d like to check how reliable my findings are, thus I’d like to repeat the measurement 10 times, and track the values.

Within polyscope, I was able to store those measurements in an array which I initialized using the assignment

var := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0].

However, I’d afterwards like to safe those values into a file, that is located on the coBot hard-drive.

Is there any chance polyscope is able to do this? I don’t have experience in hooking the CoBot to an external computer.

If you create var as an installtion variable, it will be saved to disk in the default.variables file alongside your program in human readable format, and that file can then be copied off the robot via USB.

That would be the easiest way to do it. There are other ways to pass data out of polyscope to other processes that can write them to disk but you’d need to get to grips with some aspects of URCap development for that, which would be a lot more involved.

Ok, I’ll look into that. Thank you.
The long way would effectively be to write a URCap that will be able to do file-handling?

Yes, that’s right. You wouldn’t necessarily need the Java GUI part of the URCap but a python daemon running on the command line receiving values over xmlrpc and saving them to file would work. You could find examples of how to do this in URCap documentation, but it would be a fair bit of work if you’re not familiar with the system.

Setting up installation variables worked out fairly well. Thank you.

Glad to hear it, you’re welcome :slight_smile: