Universal Robots Forum

Problem with installation after creating GlobalVariable from URCap

I am trying to create a global variable. I would like it to be visible in drop menu, when somebody wants to use it in expression. I tried to put it in Installation Node constructor. Does it work like that? What are the benefits of registering variables? Is it something more than avoiding name clashes?

Anyway, I read “working with variables.pdf” and took my shot at it.

    public UrcapInstallationNodeContribution(URCapAPI api, DataModel model) {

		this.model = model;
		this.api = api;
                this.variableName = api.getVariableModel().getVariableFactory().createGlobalVariable("variableName");
		try {
			model.set("variableName", variableName);
		} catch (VariableException e) {
			// TODO Auto-generated catch block

I get this error when starting PolyScope:

ERROR [Thread-3] 11:59:33 06/07/18: Fatal error on installation load
com.thoughtworks.xstream.converters.ConversionException: null : null
---- Debugging information ----
cause-exception     : java.lang.RuntimeException
cause-message       : null
class               : gui.installation.RobotInstallation
required-type       : gui.installation.RobotInstallation
path                : /Installation/Contributions/URCaps/Contributed[4]/Variable
line number         : 191
        at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)

There is also a popup message, that says “Not an Installation File”.

These are lines 190-192 from installation file.

      <Contributed id="com.companyName.urcapName" installationContributionTitle="com.companyName.urcapName" vendor="companyName" name="urcapName">
        <Variable key="variableName"/>