OPC-UA Interface¶
The OPC-UA interface is provided by the vnx.opc_ua.Server and vnx.opc_ua.Proxy modules.
They allow to access internal modules via OPC-UA method calls, as well as call methods on another OPC-UA server via a Lua Script for example.
Server¶
To enable the vnx.opc_ua.Server set the following config option:
cd ~/pilot
echo true > config/local/enable_opcua_server
The server will listen on the address opc.tcp://0.0.0.0:4840
.
By default the following options are set:
{
"export_services": [
"PilotServer",
"MovechainHandler",
"TaskHandler",
"HybridPlanner",
"GlobalPlanner",
"RoadMapPlanner",
"LocalPlanner",
"PlatformInterface",
"vnx.process"
],
"export_topics": [
...
],
"use_authentication": true,
"default_access": "USER"
}
To add more modules and topics to the interface create a config file config/local/OPC_UA_Server.json
as follows:
{
"export_services+": [
"AnotherModule",
...
],
"export_topics+": [
"another.topic",
...
]
}
Proxy¶
To run a vnx.opc_ua.Proxy which connects to another OPC-UA server
create the following config file config/local/opcua_proxy_map
:
[
["OPC_UA_Proxy_1", "opc.tcp://127.0.0.1:4840"],
...
]
The above proxy will be available unter the module name OPC_UA_Proxy_1
, see Lua Script for examples on how to use it.
Data Types¶
Primitive data types are directly mapped to their OPC-UA counter parts, such as int
to INT32
, float
to FLOAT
, etc.
string
is directly mapped to a OPC-UA STRING
. Arrays of said types are directly mapped to OPC-UA arrays.
Anything else will be converted to JSON and transported via a LocalizedText
object, with the locale
set to JSON
.