Get variable/register value from Java

When referring to general purpose registers, are you then referring to the GP registers in Modbus Server (addr. 128-255) or the Input_Integer_Register/Output_Integer_Register available over at the RTDE interface (including EthernetIP and Profinet)?

In either way, from the URCaps API classes com.ur.urcap.api.domain.io.* in respect to Modbus and Fieldbus registers, you are only able to read existing signals, that are present in the system.

For Modbus, this means, that there must be a “device” present in Modbus, and some signals added, before you can find these channels in the Collection<IO> returned by Collection<IO> collectionIO= api.getIOs().*.
Hence, the Modbus server values are not present here, unless you have added a device to connect to localhost, and read relevant channels.
In this case, it would probably be more relevant to create a Modbus client yourself to connect to localhost Modbus server.

For RTDE/fieldbus registers, these only show up in the Collection<IO> if they have been named in the “IO Setup” menu under installation. By convention, only named fieldbus registers that have been assigned a name, will show up in e.g. Set, Wait commands etc. Same applies to the collection you are handed.
In this case though, there have not been implemented support for reading the actual value of the register.
Hence, you can read whether the input/output is present (i.e. named), but it cannot be changed from Java.
This would typically happen in URScript, by using e.g. read_input_integer_register(address).

I will answer in respect to program Variables in the separate topic.

2 Likes