Universal Robots+

How to obtain a list of ALL the IOs on the robot using the URCap Java API


We are trying to obtain the full list of ALL the IOs available on the robot.

So far, we have tried to do this (which is called from the buildUI() method in SwingInstallationNodeView):
Collection<IO> allIos = ioModel.getIOs();

However, the ‘allIos’ collection will then only contain the IOs for:

  • Digital Input 0-7
  • Tool Input 0-1
  • Configurable Input 0-7
  • Analog Input 0-3
  • Digital Output 0-7
  • Tool Output 0-1
  • Configurable Output 0-7
  • Analog Output 0-3

And we would also like to get the General Purpose IOs and the Modbus IOs, which are shown in the ‘I/O Setup’-tab in the Installation node:

How can we get these IOs in the URCap Java API?


I always use the below code when I get allIOs.
Would you try to use?

  Collection<DigitalIO> digitalIOs = api.getInstallationAPIProvider().getInstallationAPI().getIOModel().getIOs(DigitalIO.class);
  Collection<AnalogIO> analogIOs = api.getInstallationAPIProvider().getInstallationAPI().getIOModel().getIOs(AnalogIO.class);
  Collection<ModbusIO> modobusIOs = api.getInstallationAPIProvider().getInstallationAPI().getIOModel().getIOs(ModbusIO.class);
 Collection<IntegerRegister> intRegisters = api.getInstallationAPIProvider().getInstallationAPI().getIOModel().getIOs(IntegerRegister.class);

I created the function below.
I could list all IOs into one collection.

    private ArrayList<IO> getAllIOs(URCapAPI api) {

    IOModel ioModel = api.getInstallationAPIProvider().getInstallationAPI().getIOModel();

    Collection<AnalogIO> AnalogIOs = ioModel.getIOs(AnalogIO.class);
    Collection<DigitalIO> DigitalIOs = ioModel.getIOs(DigitalIO.class);
    Collection<ModbusIO> ModbusIOs = ioModel.getIOs(ModbusIO.class);
    Collection<BooleanRegister> BooleanRegisters = ioModel.getIOs(BooleanRegister.class);
    Collection<IntegerRegister> IntegerRegisters = ioModel.getIOs(IntegerRegister.class);
    Collection<FloatRegister> FloatRegisters = ioModel.getIOs(FloatRegister.class);

    ArrayList<IO> ios = new ArrayList<IO>();


    return ios;

1 Like

General Purpose registers and bools are only available, if they are named.
I.e. a user assigned a name to them (meaning they are in use).
This is consistent with when they show up in IO Dropdowns throughout PolyScope, eg. the Set- or IF-nodes.

Hi, @jbm

Thank you for your advising :slight_smile:
I see.
Only gp registers named are displayed, as you say.

there’s no way to name the registers within the URCAP, isn’t it? I didn’t find any way to do it

1 Like