Universal Robots Forum

Accessing serial number

Hi,

Can you please tell me the communication interface which provides the serial number of the UR?

A similar query was addressed in the link given below. I will check this.

If there is an alternate approach, please share.

The three approaches listed in the topic above are the one I would still suggest.
The approach using the URCap API would be the most “safe” in terms of compatibility and maintenance.

1 Like

numeroserie= api.getProgramAPIProvider().getSystemAPI().getRobotModel().getSerialNumber();

this is what I did. But i would like to send this seral number fro Node Service to Node Contribution. How can i do that?

the serial number is both accessible from programnodeservice and programnodecontribution.
You can also pass it through the constructor of the contribution class (createNode in Service) if you need to.

2 Likes

To give the contribution class access to the serial number, Add the API provider tas an argument to the constructor of the contribution, so that when the service class instantiates the contribution, the constructor of the contribution can fetch the serial number from the right API. Something like below.

public MyProgramNodeContribution Node(ProgramAPIProovider prov, ProgramNodeView view, DataModel model, CreationContext cont)
{
    return new MyProgramNodeContribution(prov, view, model);
}

Then in the constructor for the contribution class:

MyProgramNodeContribution (ProgramAPIProovider prov, ProgramNodeView view, DataModel model)
{
    String serialNumber = prov.getSystemAPI().getRobotModel().getSerialNumber();
}
1 Like