Difference between revisions of "Advantech Robotic Suite/OPCUAClient Node"
Eric.liang (talk | contribs) (Created page with " <br/> = Brief = The OPC Unified Architecture (UA), released in 2008, is a platform independent service-oriented architecture that integrates all the functionality of the ind...") |
|||
Line 1: | Line 1: | ||
− | + | = Brief = | |
− | |||
The OPC Unified Architecture (UA), released in 2008, is a platform independent service-oriented architecture that integrates all the functionality of the individual OPC Classic specifications into one extensible framework. | The OPC Unified Architecture (UA), released in 2008, is a platform independent service-oriented architecture that integrates all the functionality of the individual OPC Classic specifications into one extensible framework. | ||
Line 6: | Line 5: | ||
OPCUA Node is a ROS node for user to subscribe sensor form OPCUA server, user can use OPCUA data in the user's subscriber program and do the post procedure, for example parse/store/analysis etc. | OPCUA Node is a ROS node for user to subscribe sensor form OPCUA server, user can use OPCUA data in the user's subscriber program and do the post procedure, for example parse/store/analysis etc. | ||
− | <br/> | + | <br/><br/> |
= Topic definition = | = Topic definition = | ||
− | The topic of OPCUA node data are defined as below: | + | The topic of OPCUA node data are defined as below: |
+ | <pre>/adv/opcuaclient</pre> | ||
− | + | <br/> | |
= Message definition = | = Message definition = | ||
Line 18: | Line 18: | ||
The messages definition of SUSI node is defined in below link: | The messages definition of SUSI node is defined in below link: | ||
− | + | http://ess-wiki.advantech.com.tw/view/ROS2_Suite_Advantech_ROS2_Data_Format | |
− | + | <br/> | |
= Configuration = | = Configuration = | ||
− | To config OPCUA node settings, please refer the guide: | + | To config OPCUA node settings, please refer the guide: http://ess-wiki.advantech.com.tw/view/OPC-UA_Client |
− | + | <br/> | |
= Sample Client = | = Sample Client = | ||
This session describe how to subscribe OPCUA node data by node's topic. | This session describe how to subscribe OPCUA node data by node's topic. | ||
+ | <br/> | ||
== Node.js == | == Node.js == | ||
Line 36: | Line 37: | ||
The program rclnodejs_edge_data_client is a node.js example for user to learning how to use rclnodejs client to subscribe OPCUA node's data. Please follow below steps to run the program, when the program launched, it will subscribe OPCUA node's sensor data and print the data in the console screen. | The program rclnodejs_edge_data_client is a node.js example for user to learning how to use rclnodejs client to subscribe OPCUA node's data. Please follow below steps to run the program, when the program launched, it will subscribe OPCUA node's sensor data and print the data in the console screen. | ||
− | + | <br/> | |
'''Steps - Subscribe Sensor''' | '''Steps - Subscribe Sensor''' | ||
− | Step1. Setup ROS2 foxy environmant variables: | + | Step1. Setup ROS2 foxy environmant variables: |
+ | <pre>$ source /opt/ros/foxy/setup.bash</pre> | ||
− | Step2. Setup Advantech ROS Message: | + | Step2. Setup Advantech ROS Message: |
+ | <pre>$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash</pre> | ||
− | Step3. Go to node.js OPCUA sample path: | + | Step3. Go to node.js OPCUA sample path: |
+ | <pre>$ cd /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/rclnodejs_edge_data_client/</pre> | ||
− | Step4. Run node.js OPCUA sample: | + | Step4. Run node.js OPCUA sample: |
+ | <pre>$ node example_SubscribeSensor.js "rclnodejs_OPCUAClient_subscriber" "/adv/opcuaclient"</pre> | ||
− | Step5. Verify received data: | + | Step5. Verify received data: |
+ | |||
+ | <pre> | ||
+ | You have entered arguments: | ||
+ | node name: rclnodejs_OPCUAClient_subscriber | ||
+ | message topic: /adv/opcuaclient | ||
+ | ---------------------------------------------- | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98247999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.396799999928998 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98223999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.372799999928997 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98199999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.348799999928996 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.981759999556076 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.324799999928995 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98151999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.300799999928994 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98127999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.276799999928993 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98103999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.252799999928992 | ||
+ | </pre> | ||
− | <br/> | + | <br/><br/> |
− | '''Steps - Set sensor''' | + | '''Steps - Set sensor''' |
This session describe how to set OPCUA data by set action. To run the set sensor sample, your device need have writable sensor supported for OPCUA driver. | This session describe how to set OPCUA data by set action. To run the set sensor sample, your device need have writable sensor supported for OPCUA driver. | ||
− | Step1. Setup ROS2 foxy environmant variables: | + | Step1. Setup ROS2 foxy environmant variables: |
+ | <pre>$ source /opt/ros/foxy/setup.bash</pre> | ||
− | Step2. Setup Advantech ROS Message: | + | Step2. Setup Advantech ROS Message: |
+ | <pre>$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash</pre> | ||
− | Step3. Go to node.js OPCUA sample path: | + | Step3. Go to node.js OPCUA sample path: |
+ | <pre>$ cd /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/rclnodejs_edge_data_client/</pre> | ||
Step4. Run OPCUA node set sensor sample: | Step4. Run OPCUA node set sensor sample: | ||
− | Command: | + | Command: |
+ | <pre>node example_SetSensor.js [node name] [action] [sensor] [type] [value]</pre> | ||
− | Example: | + | Example: |
+ | <pre>$ node example_SetSensor.js "rclnodejs_OPCUAClient_setter" "adv_opcuaclient_set" "OPCUAClient/OPCUA-01/Node/Temperature-SetPoint" "v" 26</pre> | ||
− | Step5. Received data: | + | Step5. Received data: |
+ | <pre> | ||
+ | [INFO] [1671432195.232498528] [adv.rclnodejs_OPCUAClient_setter]: Waiting for action server... | ||
+ | [INFO] [1671432195.890056725] [adv.rclnodejs_OPCUAClient_setter]: Sending goal request... | ||
+ | [INFO] [1671432196.076197797] [adv.rclnodejs_OPCUAClient_setter]: Goal accepted | ||
+ | [INFO] [1671432196.310811395] [adv.rclnodejs_OPCUAClient_setter]: Received feedback: status = {"status":200,"sensor":"OPCUAClient/OPCUA-01/Node/Temperature-SetPoint","info":"Success","ts":1671432196198} | ||
+ | [INFO] [1671432196.331143326] [adv.rclnodejs_OPCUAClient_setter]: Goal suceeded with result: 202 | ||
</pre> | </pre> | ||
− | <br/> | + | <br/><br/> |
== Python == | == Python == | ||
Line 80: | Line 117: | ||
'''Steps - Subscribe Sensor''' | '''Steps - Subscribe Sensor''' | ||
− | Step1. Setup ROS2 foxy environmant variables: | + | Step1. Setup ROS2 foxy environmant variables: |
+ | <pre>$ source /opt/ros/foxy/setup.bash</pre> | ||
− | Step2. Setup Advantech ROS Message: | + | Step2. Setup Advantech ROS Message: |
+ | <pre>$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash</pre> | ||
− | Step3. Setup OPCUA sample variables: | + | Step3. Setup OPCUA sample variables: |
+ | <pre>$ source /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/install/local_setup.bash</pre> | ||
− | Step4. Run Python OPCUA sample: | + | Step4. Run Python OPCUA sample: |
+ | <pre>$ ros2 run rclpy_edge_data_client listener "rclpy_OPCUAClient_subscriber" "/adv/opcuaclient"</pre> | ||
− | Step5. Verify received data: | + | Step5. Verify received data: |
+ | <pre> | ||
+ | You have entered arguments: | ||
+ | node name: rclpy_OPCUAClient_subscriber | ||
+ | message topic: /adv/opcuaclient | ||
+ | ---------------------------------------------- | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98247999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.396799999928998 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98223999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.372799999928997 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98199999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.348799999928996 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.981759999556076 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.324799999928995 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98151999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.300799999928994 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98127999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.276799999928993 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98103999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.252799999928992 | ||
</pre> | </pre> | ||
− | <br/> | + | <br/><br/> |
== C++ == | == C++ == | ||
Line 100: | Line 160: | ||
'''Steps - Subscribe Sensor''' | '''Steps - Subscribe Sensor''' | ||
− | Step1. Setup ROS2 foxy environmant variables: | + | Step1. Setup ROS2 foxy environmant variables: |
+ | <pre>$ source /opt/ros/foxy/setup.bash</pre> | ||
− | Step2. Setup Advantech ROS Message: | + | Step2. Setup Advantech ROS Message: |
+ | <pre>$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash</pre> | ||
− | Step3. Setup OPCUA node variables: | + | Step3. Setup OPCUA node variables: |
+ | <pre>$ source /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/install/local_setup.bash</pre> | ||
− | Step4. Run Python OPCUA sample client: | + | Step4. Run Python OPCUA sample client: |
+ | <pre>$ ros2 run rclcpp_edge_data_client listener "rclcpp_OPCUAClient_subscriber" "/adv/opucaclient"</pre> | ||
− | Step5. Verify received data: | + | Step5. Verify received data: |
+ | <pre> | ||
+ | You have entered arguments: | ||
+ | node name: rclcpp_OPCUAClient_subscriber | ||
+ | message topic: /adv/opcuaclient | ||
+ | ---------------------------------------------- | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98247999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.396799999928998 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98223999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.372799999928997 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98199999955607 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.348799999928996 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.981759999556076 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.324799999928995 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98151999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.300799999928994 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98127999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.276799999928993 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98103999955608 | ||
+ | Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.252799999928992 | ||
</pre> | </pre> | ||
− | [[Category:Editor]] | + | [[Category:Editor]] |
Revision as of 07:46, 30 January 2023
Contents
Brief
The OPC Unified Architecture (UA), released in 2008, is a platform independent service-oriented architecture that integrates all the functionality of the individual OPC Classic specifications into one extensible framework.
OPCUA Node is a ROS node for user to subscribe sensor form OPCUA server, user can use OPCUA data in the user's subscriber program and do the post procedure, for example parse/store/analysis etc.
Topic definition
The topic of OPCUA node data are defined as below:
/adv/opcuaclient
Message definition
The messages definition of SUSI node is defined in below link:
http://ess-wiki.advantech.com.tw/view/ROS2_Suite_Advantech_ROS2_Data_Format
Configuration
To config OPCUA node settings, please refer the guide: http://ess-wiki.advantech.com.tw/view/OPC-UA_Client
Sample Client
This session describe how to subscribe OPCUA node data by node's topic.
Node.js
The program rclnodejs_edge_data_client is a node.js example for user to learning how to use rclnodejs client to subscribe OPCUA node's data. Please follow below steps to run the program, when the program launched, it will subscribe OPCUA node's sensor data and print the data in the console screen.
Steps - Subscribe Sensor
Step1. Setup ROS2 foxy environmant variables:
$ source /opt/ros/foxy/setup.bash
Step2. Setup Advantech ROS Message:
$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash
Step3. Go to node.js OPCUA sample path:
$ cd /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/rclnodejs_edge_data_client/
Step4. Run node.js OPCUA sample:
$ node example_SubscribeSensor.js "rclnodejs_OPCUAClient_subscriber" "/adv/opcuaclient"
Step5. Verify received data:
You have entered arguments: node name: rclnodejs_OPCUAClient_subscriber message topic: /adv/opcuaclient ---------------------------------------------- Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98247999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.396799999928998 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98223999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.372799999928997 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98199999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.348799999928996 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.981759999556076 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.324799999928995 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98151999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.300799999928994 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98127999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.276799999928993 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98103999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.252799999928992
Steps - Set sensor
This session describe how to set OPCUA data by set action. To run the set sensor sample, your device need have writable sensor supported for OPCUA driver.
Step1. Setup ROS2 foxy environmant variables:
$ source /opt/ros/foxy/setup.bash
Step2. Setup Advantech ROS Message:
$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash
Step3. Go to node.js OPCUA sample path:
$ cd /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/rclnodejs_edge_data_client/
Step4. Run OPCUA node set sensor sample:
Command:
node example_SetSensor.js [node name] [action] [sensor] [type] [value]
Example:
$ node example_SetSensor.js "rclnodejs_OPCUAClient_setter" "adv_opcuaclient_set" "OPCUAClient/OPCUA-01/Node/Temperature-SetPoint" "v" 26
Step5. Received data:
[INFO] [1671432195.232498528] [adv.rclnodejs_OPCUAClient_setter]: Waiting for action server... [INFO] [1671432195.890056725] [adv.rclnodejs_OPCUAClient_setter]: Sending goal request... [INFO] [1671432196.076197797] [adv.rclnodejs_OPCUAClient_setter]: Goal accepted [INFO] [1671432196.310811395] [adv.rclnodejs_OPCUAClient_setter]: Received feedback: status = {"status":200,"sensor":"OPCUAClient/OPCUA-01/Node/Temperature-SetPoint","info":"Success","ts":1671432196198} [INFO] [1671432196.331143326] [adv.rclnodejs_OPCUAClient_setter]: Goal suceeded with result: 202
Python
The program rclpy_edge_data_client is a Python client example for user to understand how to use rclpy to subscribe OPCUA node's data. Please follow below steps to run the program, when the program launched, it will subscribe OPCUA node's sensor and print the data in the console screen.
Steps - Subscribe Sensor
Step1. Setup ROS2 foxy environmant variables:
$ source /opt/ros/foxy/setup.bash
Step2. Setup Advantech ROS Message:
$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash
Step3. Setup OPCUA sample variables:
$ source /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/install/local_setup.bash
Step4. Run Python OPCUA sample:
$ ros2 run rclpy_edge_data_client listener "rclpy_OPCUAClient_subscriber" "/adv/opcuaclient"
Step5. Verify received data:
You have entered arguments: node name: rclpy_OPCUAClient_subscriber message topic: /adv/opcuaclient ---------------------------------------------- Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98247999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.396799999928998 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98223999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.372799999928997 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98199999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.348799999928996 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.981759999556076 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.324799999928995 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98151999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.300799999928994 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98127999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.276799999928993 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98103999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.252799999928992
C++
The program rclcpp_edge_data_client is a C++ example for user to understand how to use rclcpp to subscribe OPCUA node's data. Please follow below steps to run the program, when the program launched, it will subscribe OPCUA node's sensor and print the data in the console screen.
Steps - Subscribe Sensor
Step1. Setup ROS2 foxy environmant variables:
$ source /opt/ros/foxy/setup.bash
Step2. Setup Advantech ROS Message:
$ source /usr/local/Advantech/ros/foxy/include/edge-converter-ros2/adv_msgs/install/local_setup.bash
Step3. Setup OPCUA node variables:
$ source /usr/local/Advantech/ros/foxy/sample_code/edge-data-client/install/local_setup.bash
Step4. Run Python OPCUA sample client:
$ ros2 run rclcpp_edge_data_client listener "rclcpp_OPCUAClient_subscriber" "/adv/opucaclient"
Step5. Verify received data:
You have entered arguments: node name: rclcpp_OPCUAClient_subscriber message topic: /adv/opcuaclient ---------------------------------------------- Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98247999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.396799999928998 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98223999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.372799999928997 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98199999955607 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.348799999928996 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.981759999556076 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.324799999928995 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98151999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.300799999928994 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98127999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.276799999928993 Data: sensor = OPCUAClient/OPCUA-01/Node/Humidity, v = 59.98103999955608 Data: sensor = OPCUAClient/OPCUA-01/Node/Temperature, v = 28.252799999928992