-
Notifications
You must be signed in to change notification settings - Fork 0
/
uatrobot.py
61 lines (43 loc) · 1.47 KB
/
uatrobot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
"""
@file uatrobot.py
@author Jefferson Alves
@date 2018-03-02
@version 0.1
"""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
from opcua import ua
from devices.uadevice import uaTDevice
class uaTRobot(uaTDevice):
# metodos OPC
mMOVE = "move"
mEXECUTE = "execute"
mHOME = "home"
mGET_PART = "get_part"
mPUT_PART = "put_part"
OPC_TYPE = uaTDevice.ROBOT
@staticmethod
def create(parent,idx,handle=None):
"""
Cria o tipo
"""
return uaTDevice.create_type(parent,idx,uaTRobot,handle)
@staticmethod
def create_property(obj_type,idx):
"""
Adiciona as propriedades
"""
return obj_type
@staticmethod
def create_methods(obj_type,idx,handle):
"""
Adiciona os metodos
"""
obj_type.add_method(idx, uaTRobot.mHOME, handle.home)
obj_type.add_method(idx, uaTRobot.mMOVE, handle.move, [ua.VariantType.Float,ua.VariantType.Float,ua.VariantType.Float])
obj_type.add_method(idx, uaTRobot.mEXECUTE, handle.execute, [ua.VariantType.String,ua.VariantType.String])
obj_type.add_method(idx, uaTRobot.mGET_PART,handle.get_part,[ua.VariantType.UInt16])
obj_type.add_method(idx, uaTRobot.mPUT_PART,handle.put_part,[ua.VariantType.UInt16])
return obj_type