Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: use OPC Foundation UANodeSet files #93

Open
benkinooby opened this issue Mar 5, 2020 · 19 comments
Open

improvement: use OPC Foundation UANodeSet files #93

benkinooby opened this issue Mar 5, 2020 · 19 comments
Assignees

Comments

@benkinooby
Copy link
Contributor

benkinooby commented Mar 5, 2020

The OPC Foundation is maintaining a collection of UANodeSet files at
https://github.com/OPCFoundation/UA-Nodeset

Note: This repository is part of their official review process!

It would be helpful to include those as git submodule to make them easily available to the user.

Related (Correct me if I am wrong):
When creating a new model, the standard UANodeSet Opc.UA.NodeSet2.xml visible in the sub-window "Node Sets" seems to be generated with python code from opcua/server/standard_address_space/standard_address_space_part5.py instead of being loaded from a nodeset file. Consequently, only models that happen to be compatible to that version (1.04 at the moment according to Root > Objects > Server > Namespaces > http://opcfoundation.org/UA/ > NamespaceVersion) can be successfully loaded with Free OPC UA modeler. Correct?

@oroulet
Copy link
Member

oroulet commented Mar 5, 2020

Yes we use these nodesets. But for the server it was faster to generate python code from them instead of importing everything from xml every time. They seem to be backwards compatible so maybe we can just keep them up to date

@benkinooby
Copy link
Contributor Author

Thank you very much for your patient reply.

As reference for myself and others reading this:
Are you referring to the following files?
https://github.com/FreeOpcUa/python-opcua/tree/master/schemas

One thing I noticed on a quick glance is, that "your" Opc.Ua.Di.NodeSet2.xml is missing the <Models> element (both of them are on master branch, so the comparison may be moot)

Yours:
https://github.com/FreeOpcUa/python-opcua/blob/6ce90cea31e44a036d5030552b9b10badab738e0/schemas/Opc.Ua.Di.NodeSet2.xml#L34

Theirs:
https://github.com/OPCFoundation/UA-Nodeset/blob/ad205e664f88d3989cb06671207ca3f8932db06c/DI/Opc.Ua.Di.NodeSet2.xml#L34

@andreafresa
Copy link

hello Guys, I am trying to import the Robotics section of OpcUa but I always get the same issue:
"The parent node id does not to refer to a valid node.(BadParentNodeIdInvalid)".
Do you know how to fix it?

@oroulet
Copy link
Member

oroulet commented Apr 23, 2020

We need to update the standard namespace in python-opcua. unfortunately they changed the format a little and we need to fix something deep in parser. See FreeOpcUa/python-opcua#1000

and FreeOpcUa/opcua-asyncio#173

@oroulet
Copy link
Member

oroulet commented Apr 23, 2020

hep welcome

@oroulet oroulet self-assigned this Apr 23, 2020
@oroulet oroulet pinned this issue Apr 23, 2020
@oroulet
Copy link
Member

oroulet commented May 2, 2020

should be fixed now. added last nodeset in both pyton-opcu and opcua-asyncio

@andreafresa
Copy link

andreafresa commented May 6, 2020

Hey guys,
I am trying again to import the Robotics Nodeset on opcua-modeler (Actions->Import XML).
I always get the issue I posted in the comment above.
I am on windows and I tried to update the opcua-modeler using "pip install opcua-modeler --upgrade" from my winpython environment.
Is this bug solved only in the dev version (the one that must be cloned from git)?
SELF-ANSWER: IT IS PRESENT ONLY IN DEV VERSION
Possible idea for future version: why not showing a field where it is specified if a reference to an element is Mandatory or Optional?

@JMayrbaeurl
Copy link

Just tried it with https://github.com/OPCFoundation/UA-Nodeset/blob/v1.04/Robotics/Opc.Ua.Robotics.NodeSet2.xml in the 'package' and in the 'Dev version'. Always gives the same error:

opcua.common.xmlimporter - WARNING - failure adding node NodeData(nodeid:NumericNodeId(ns=1;i=1002))') uawidgets.utils - ERROR - "The parent node id does not to refer to a valid node."(BadParentNodeIdInvalid)') Traceback (most recent call last): File "C:\Dev\nebula\opcua\modeler\opcua-widgets\uawidgets\utils.py", line 21, in wrapper result = func(self, *args) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\uamodeler.py", line 249, in open self._model_mgr.open(path) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\model_manager.py", line 181, in open self.open_xml(path) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\model_manager.py", line 113, in open_xml self._open_xml(path) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\model_manager.py", line 119, in _open_xml path = self.import_xml(path) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\model_manager.py", line 102, in import_xml new_nodes = self.server_mgr.import_xml(path) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\server_manager.py", line 68, in import_xml return self._backend.import_xml(path) File "c:\Dev\nebula\opcua\modeler\opcua-modeler\uamodeler\server_manager.py", line 112, in import_xml return self._server.import_xml(path) File "C:\Dev\nebula\opcua\modeler\python-opcua\opcua\server\server.py", line 510, in import_xml return importer.import_xml(path, xmlstring) File "C:\Dev\nebula\opcua\modeler\python-opcua\opcua\common\xmlimporter.py", line 67, in import_xml node = self._add_node_data(nodedata) File "C:\Dev\nebula\opcua\modeler\python-opcua\opcua\common\xmlimporter.py", line 84, in _add_node_data node = self.add_object_type(nodedata) File "C:\Dev\nebula\opcua\modeler\python-opcua\opcua\common\xmlimporter.py", line 196, in add_object_type res[0].StatusCode.check() File "C:\Dev\nebula\opcua\modeler\python-opcua\opcua\ua\uatypes.py", line 218, in check raise UaStatusCodeError(self.value) opcua.ua.uaerrors._auto.BadParentNodeIdInvalid: "The parent node id does not to refer to a valid node."(BadParentNodeIdInvalid)

@oroulet
Copy link
Member

oroulet commented Jul 4, 2020

strange I just tested the examples in opcua-asyncio and python-opcua and the robot nodeset seems to import fine. Can you update opcua and try to run example at: https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-import-robot-nodeset.py

@JMayrbaeurl
Copy link

Problem seems to come from not correctly loading the required model dependency on OPC-UA DI. Form the Robotics IM file:

http://opcfoundation.org/UA/Robotics/ http://opcfoundation.org/UA/DI/

Namespace 2 is for DI and the error on importing the Robotics file states an invalid parent node id.

MotionDeviceSystemType Contains the set of controllers and motion devices in a closely-coupled motion device system. https://reference.opcfoundation.org/v104/Robotics/v100/docs/7.1.2 ns=1;i=5002 ns=1;i=5001 ns=1;i=5010 ns=2;i=15063

Parent ns=2;i=15063 is the ComponentType from DI, that's obvisouly not loaded

@oroulet
Copy link
Member

oroulet commented Jul 6, 2020

@JMayrbaeurl what do you mean by dev version?
when I import Di and robotics xl files here with python-opcya master https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-import-robot-nodeset.py I do not see any warnings (but setting logging to INFO I get a looooooot of warnings)
Help is anyway welcome to improve xml parser

@JMayrbaeurl
Copy link

@oroulet Finally found a working setup with the modeler:

  1. Open modeler application and select menu item 'New model'
  2. Import DI nodes set xml file
  3. Import Robotics nodes set xml file

The problem or issue is that opening a nodes set xml file, that depends on other nodes set xml files as the Robotics has with DI, doesn't automatically open and parse the depending xml files, causing errors when referencing nodes from them.

@oroulet
Copy link
Member

oroulet commented Jul 6, 2020

Ok. Now I understand what your issue was. Not sure we can automate that. They may be at different places

@JMayrbaeurl
Copy link

Can you at least ad a warning on importing a nodes set xml file that has dependencies? Something like 'Warning: This file has dependencies on .... Please import them before importing this file"

@oroulet
Copy link
Member

oroulet commented Jul 6, 2020

good point..

@pbertoni89
Copy link

Got a similar problem (I just opened python-opcua #1166) while importing PackML official NodeSet.
@zerox1212 perhaps this a more appropriate thread, sorry for the little overlapping.
Current PackML says as the only requirement

<Model ModelUri="http://opcfoundation.org/UA/PackML/" Version="1.1.0" PublicationDate="2020-05-28T08:03:15Z">
    <RequiredModel ModelUri="http://opcfoundation.org/UA/" Version="1.04.3" PublicationDate="2019-09-09T00:00:00Z" />
</Model>

@zerox1212
Copy link
Collaborator

@pbertoni89 Sorry, I have never used the official node sets so I can't help you there. I always made my own custom models with modeler.

@JinhwanPark
Copy link

When I try to load the CNC Nodeset, I get the following error:
TypeError: object of type 'ExtObj' has no len()
Does anyone know the cause of the following?
There seems to be a part that cannot be parsed among Nodes of CncPositionDataType
Other modelers work without issues.(ex. UA Modeler)

@benkinooby
Copy link
Contributor Author

@pbertoni89 Sorry, I have never used the official node sets so I can't help you there. I always made my own custom models with modeler.

Hi, for reference/information:
https://opcfoundation.org/developer-tools/specifications-opc-ua-information-models/opc-ua-packml-companion-specification/

PackML is a companion specification. Companion specifications are industry-specific specifications/models developed by industrial partners in cooperation with OPC Foundation. You can find a list of companion specifications here:
https://opcfoundation.org/developer-tools/specifications-opc-ua-information-models

Adding them to the default set of models shipped with opcua-modeler would certainly be a big step up for opcua-modeler users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants