At [General] → [Screwdriving] view, the dropdown can displayI/O signal names.
For example [Input] → [OK] → dropdown [select , qw , qwe …]
Please see the image file[IO Setup.png] as follow.
But when we want to develop new view at [UR Caps], use dropdown can not get signal names what be set at I/O setup.
The getIOModel() returns a Collection<IO> object.
Each IO object has both a Default Name (use getDefaultName()) and a name (use getName()).
The default name is always something like “digital_out[2]” where the regular name may be “StartConveyor” or whatever the user defined this name to be. If no name is set, the default name is returned by getName().
Also, you should generally use the Contribution to pull the list of IO’s, and then set this in the View.
This is better practice, than having the View itself pull the list of IO’s through the Contribution.
This is why it is only the Contribution via the ApplicationAPI, that has access to the IOModel.
error log:
WARNING: using the default ‘SACParserCSS21’ instead
get ApplicationAPI:com.ur.urcap.ui.main.impl.URCapAPIImpl@170576aa
get IOModel:com.ur.urcap.installation.io.IOModelImpl@3507d30f
09:39:04.661 WARN - Could not find component: class com.ur.view.modbus.ModbusComponent {thread: Thread-2 , loggerClass: gui.installation.services.RobotInstallationLookupServiceImpl}
09:39:04.666 ERROR - Exception occurred when setting Swing URCap model {thread: Thread-2 , loggerClass: com.ur.urcap.contribution.installation.InstallationContributionSwing}
java.lang.NullPointerException
at com.ur.view.modbus.ModbusInstallationImpl.getModbusInterface(ModbusInstallationImpl.java:17) ~[?:?]
at com.ur.view.modbus.ModbusIOComponent.getAllOfType(ModbusIOComponent.java:72) ~[?:?]
at com.ur.view.modbus.ModbusIOComponent.getInputs(ModbusIOComponent.java:40) ~[?:?]
at com.ur.view.io.IOServiceImpl.getInputs(IOServiceImpl.java:349) ~[?:?]
at com.ur.urcap.installation.io.IOModelImpl.getAllModbusIOs(IOModelImpl.java:107) ~[?:?]
at com.ur.urcap.installation.io.IOModelImpl.getIOs_aroundBody0(IOModelImpl.java:49) ~[?:?]
at com.ur.urcap.installation.io.IOModelImpl$AjcClosure1.run(IOModelImpl.java:1) ~[?:?]
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) ~[?:?]
at com.ur.polyscope.valueobjects.aspects.UncaughtExceptionAspect.aroundMethod(UncaughtExceptionAspect.java:27) ~[polyscope-value-objects-api-1.8.3.jar:?]
at com.ur.urcap.installation.io.IOModelImpl.getIOs(IOModelImpl.java:43) ~[urcap-10.4.182.jar:?]
at com.ur.urcap.installation.io.IOModelImpl.getIOs(IOModelImpl.java:1) ~[urcap-10.4.182.jar:?]
at com.ur.urcap.tfsoft.hios.screwdriving.impl.ScrewDrivingInstallationNodeContribution.(ScrewDrivingInstallationNodeContribution.java:38) ~[?:?]
at com.ur.urcap.tfsoft.hios.screwdriving.impl.ScrewDrivingInstallationNodeService.createInstallationNode(ScrewDrivingInstallationNodeService.java:38) ~[?:?]
at com.ur.urcap.tfsoft.hios.screwdriving.impl.ScrewDrivingInstallationNodeService.createInstallationNode(ScrewDrivingInstallationNodeService.java:1) ~[?:?]
at com.ur.urcap.contribution.installation.InstallationContributionSwing.createInstallationNode(InstallationContributionSwing.java:109) ~[urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.InstallationContributionSwing.setModel(InstallationContributionSwing.java:79) [urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.AbstractURCapInstallation.updateInstallationContribution(AbstractURCapInstallation.java:115) [urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.AbstractURCapInstallation.setInstallationModel(AbstractURCapInstallation.java:139) [urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.URCapInstallationNodeSwing.setInstallationModel(URCapInstallationNodeSwing.java:1) [urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.URCapInstallationModule.setInstallationModel(URCapInstallationModule.java:246) [urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.URCapInstallationModule.updateModelAndInfo(URCapInstallationModule.java:236) [urcap-10.4.182.jar:?]
at com.ur.urcap.contribution.installation.URCapInstallationModule.updateInstalledURCaps(URCapInstallationModule.java:214) [urcap-10.4.182
Try querying the list of IOs outside of the InstallationNode constructor.
The IOModel is dynamic, and possibly not initialized at the time the InstallationNode is created.
This code is called from the buildUI()-method in the class that implements the SwingInstallationNodeView.
What I find strange is that I get a nullpointer exception that seems to originate from the ModbusIO:
ERROR [Thread-0] 13:12:19 18/02/20: Exception occurred when setting Swing URCap model
java.lang.NullPointerException
at com.ur.view.modbus.ModbusInstallationImpl.getModbusInterface(ModbusInstallationImpl.java:17)
at com.ur.view.modbus.ModbusIOComponent.getAllOfType(ModbusIOComponent.java:72)
at com.ur.view.modbus.ModbusIOComponent.getInputs(ModbusIOComponent.java:40)
at com.ur.view.io.IOServiceImpl.getInputs(IOServiceImpl.java:333)
at com.ur.urcap.installation.io.IOModelImpl.getAllModbusIOs(IOModelImpl.java:109)
at com.ur.urcap.installation.io.IOModelImpl.getIOs_aroundBody0(IOModelImpl.java:51)
at com.ur.urcap.installation.io.IOModelImpl.getIOs_aroundBody1$advice(IOModelImpl.java:24)
at com.ur.urcap.installation.io.IOModelImpl.getIOs(IOModelImpl.java:1)
at com.ur.urcap.installation.io.IOModelImpl.getIOs_aroundBody2(IOModelImpl.java:185)
at com.ur.urcap.installation.io.IOModelImpl.getIOs_aroundBody3$advice(IOModelImpl.java:24)
at com.ur.urcap.installation.io.IOModelImpl.getIOs(IOModelImpl.java:1)
Why does it getModbusInterface when I have specifically told it to only fetch the DigitalIO.class’ IOs?