RMVL  1.4.0-dev
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
samples/opcua/opcua_client.cpp

OPC UA 客户端例程

OPC UA 客户端例程

int main()
{
rm::Client client("opc.tcp://127.0.0.1:4840");
if (!client.ok())
return -1;
auto position_id = rm::nodeObjectsFolder | client.find("position");
auto position = client.read(position_id);
printf("\033[32mValue: %d\033[0m\n", position.cast<int>());
return 0;
}
OPC UA 客户端
定义 client.hpp:82
FindNodeInClient find(std::string_view browse_name, uint16_t ns=1U) const
获取路径搜索必要信息
定义 client.hpp:122
Variable read(const NodeId &node) const
从指定的变量节点读数据
bool ok() const
是否成功创建客户端并成功连接到服务器
定义 client.hpp:127
OPC UA 客户端
constexpr NodeId nodeObjectsFolder(0, UA_NS0ID_OBJECTSFOLDER)
对象节点:ObjectsFolder 节点 ID