How to generate myNS.c and myNS.h using MTConnect nodesets

12 views
Skip to first unread message

Jacky Bek

unread,
Apr 17, 2022, 12:15:04 AMApr 17
to open62541
i am trying to generate myNS.c and myNS.h using the sample MTConnect nodesets defined in : ~/open62541/deps/ua-nodeset/MTConnect/

Test 1:
sudo cp MTConnectModel.xml myNS.xml 

Then in ~/open62541/tools/nodeset_compiler/, i run this command and get:

python ./nodeset_compiler.py --types-array=UA_TYPES --existing ../../deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml --xml ../../deps/ua-nodeset/MTConnect/myNS.xml myNS
INFO:__main__:Preprocessing (existing) ../../deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
INFO:__main__:Preprocessing ../../deps/ua-nodeset/MTConnect/myNS.xml
Traceback (most recent call last):
  File "./nodeset_compiler.py", line 143, in <module>
    ns.addNodeSet(xmlfile, typesArray=getTypesArray(nsCount))
  File "/home/pi/open62541/tools/nodeset_compiler/nodeset.py", line 259, in addNodeSet
    raise Exception(self, self.originXML + " contains no or more then 1 nodeset")
AttributeError: 'NodeSet' object has no attribute 'originXML'

Test 2:
sudo cp Opc.Ua.MTConnect.NodeSet2.xml myNS.xml

Then rerun python and i get:

python ./nodeset_compiler.py --types-array=UA_TYPES --existing ../../deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml --xml ../../deps/ua-nodeset/MTConnect/myNS.xml myNS
INFO:__main__:Preprocessing (existing) ../../deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
INFO:__main__:Preprocessing ../../deps/ua-nodeset/MTConnect/myNS.xml
Traceback (most recent call last):
  File "./nodeset_compiler.py", line 169, in <module>
    ns.generateParser(args.existing, args.infiles, args.bsdFile)
  File "/home/pi/open62541/tools/nodeset_compiler/nodeset.py", line 431, in generateParser
    if (nd.hasAttribute("SymbolicName") and (re.match(r".*_BinarySchema", nd.attributes["SymbolicName"].nodeValue) or nd.attributes["SymbolicName"].nodeValue == "TypeDictionary_BinarySchema")) or (nd.hasAttribute("ParentNodeId") and not nd.hasAttribute("SymbolicName") and re.fullmatch(r"i=93", nd.attributes["ParentNodeId"].nodeValue)):
AttributeError: 'module' object has no attribute 'fullmatch'

Questions:
1. which input xml file should i be using to generate myNS.c and myNS.h?
2. What does the above errors mean and how to resolve?

Thanks.
Jacky

Reply all
Reply to author
Forward
0 new messages