This is my code to get all the variables on my instalaltion but I cannot find methods to get the value of the variable. The objective is to visualize some variables (such as counters) in a toolbar.
This is not as simple. I’m also trying to find the best way to view and edit a variable from a toolbar. These are the possibilities I know to get the current value of a URScript variabile in a URCap:
Read it from Primary Interface - You have to write a “reader” for the packages sent by the controller, maybe based on this sample which is for Realtime: getRobotData
I tried with the ScriptCommunicator (the ScriptExtractor part), but I can get only data by using built-in function like get_…().Do you have an example where you get the value of a pose (like i_home_pose) or a general int variable (i_var_1) stored in the installation variables?
You are correct, I forgot I was using scriptExporter to export a value from the integer registers, as e.g.:
ScriptExporter export = new ScriptExporter();
ScriptCommand commandInt = new ScriptCommand("Command1");
commandInt.appendLine("int_value = read_output_integer_register(21)");
int resultInt = export.exportIntegerFromURScript(commandInt, "int_value");
So a possible workaround is to constantly copy the variable you are interested in to a register and read from that. Sorry but I don’t know if it is possible to read a variable with this code.