I have been trying to read the global installation variables from a URCAP as discussed in this forum and have been finding it extremely difficult to say the least! I would like to access the global variables because I want to run a calibration routine with my URCAP and then save the calibrated variables to the data model within my URCAP. I then want to rerun the program and take measurements and adjust the robot path according to the new measurements relative to the calibrated variables in the data model.
Here is what I’ve tried to date:
- Initially I tried to do it via the script communicator:
URCap Sample: URCap-ScriptCommunicator
however I found that accessing the global variables caused the controller to crash (note I was using a URSIM rather than the real controller but I assume the real controller would do the same). It’s a shame this didn’t work because it would have been a nice simple solution. - @mmi above mentions using GlobalVariablesSetupMessage, and GlobalVariablesUpdateMessage but working out how to do this is beyond my limited programming skills. It seems relatively easy to access variables using the RTDE interface and I’ve gone through the getRobotData sample URCap. However, to access the global variables you need to use the Primary and Secondary Client Interface I’ve struggled to find examples of how to use this with the best one being provided by @ajp here:
How to process package from robot controller
Unfortunately it is implemented in python rather than Java and it uses the struct.unpack method – there doesn’t seem to be an equivalent in Java. - I have struggled to understand the daemon method suggested by @jbm above which uses script code and I’m not sure how to access the variable from the URCAP.
Any thoughts or suggestions would be much appreciated.