0
Fixed

help for reading values from opcua server

Yulong Ding 5 years ago in OPCUA4Unity updated by Support 5 years ago 5

I bought the OPCUA4UNITY asset recently, then I set up a simple opcua server with python-opcua (code is here). It’s able to connect the server, import the nodes, but there is no data showing in the inspector when I click the “Update Node” button.

I tried to debug in VS. It seems the "Value" property of opcNode is missing.

Then I used OPC watch, the value can be read.

Image 32

I also tried other opcua servers, like UA-.NETStandard has the same problem and another problem is it cannot import all the nodes in unity.

For “OPC UA C++ Demo Server V1.7.0” server, value can be read correctly, but it cannot import all the nodes in unity.

I have struggled several days, please help me, thanks a lot!

Answer

Answer

I have found the problem. It will be included in the next release. I will send you a patch via mail!

Under review

Hi,

what do you mean you can't read all nodes. Reading all nodes takes some time if there are a lot of variables on the OPCUA server because it is not multithreaded imported (we will change that soon). This is why it is usually better to only import the subnode which is really needed.

For the problem with your variable, the problem seems to be the type (the type is Variable - but it should be Int64). I need to check what the reason ist. 

Can you please try to read the variable directly in code (without having the node as a gameobject) by doing like this:

float myvar = (float)Interface.ReadNodeValue(NodeId);
Answer

I have found the problem. It will be included in the next release. I will send you a patch via mail!