Gripper URCap problems!

Hi guys, I am working on my first URCap application in my company. I wanted to make a demo URCap for a pneumatic gripper. What the URCap should do:
- turn on/off certain output that the user chooses with the help of combo box
- toolbar with test buttons to test certain outputs
And… the problem occurs in the toolbar when I want to test previously chosen output. Here are the screens. Advice appreciated as I have just started with Java Swing and URCap development.

The situation when I do not refer to setIOcomboBoxItems and Selection method which is brought from contribution.
1
And… when I refer to it.
image
If someone decides to help me with code analyses just DM me on the forum.

This link explains the use of Java Swing in context of URCap development. It also includes an explanation of how to use a combo box. More information about the datamodel can be found under API Reference.
Something that could cause the problem that you are getting is the line in the code that is currently show in the picture: “liveControl.openView()”. Else I would like to see how you have implemented the set I/O part when a user have chosen a value in the combo box.

Thank you for the code on Github. I have looked into why you are getting the error when trying to use the combo box in your toolbar. The problem may lie in the fact that you are trying to use Undo Redo Manager and Datamodel in your ToolbarContribution class. First thing is because these two instances are never initialized and because it is not possible to use these in context of Toolbar nodes. But as you can see, it is accessible in the program node which is your GripperContribution class :

So when you have the following in your ToolbarContribution class where you outcommented the last line like the following:
image

You will not get nullpointer exception right away. The reason for the exception is because it will try to call the Datamodel which is not initialized or accessible. For more information on what is accessible through the api, have a look at this article:
https://plus.universal-robots.com/getting-started/urcap-api-overview/

If anything is unclear please tell.

Just to be sure. So there is no possibility to implement a functionality that allows user to choose a Digital output in a toolbar?

There is. Did you try to use the IO and DigitalIO Interfaces described in the Api reference?

I would fill your combobox array with Digital IO using getName and fire them with the DigitalIO Interface.

You can also send a whole robot program with a button using This

1 Like