etherlab/EthercatCIA402Slave.py
changeset 2152 e6946c298a42
parent 2148 2225494acbf2
child 2153 91c10856adaa
equal deleted inserted replaced
2151:015dab6a915f 2152:e6946c298a42
     3 import wx
     3 import wx
     4 
     4 
     5 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
     5 from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
     6 
     6 
     7 from MotionLibrary import Headers, AxisXSD
     7 from MotionLibrary import Headers, AxisXSD
     8 from EthercatSlave import _EthercatSlaveCTN
     8 from EthercatSlave import _EthercatSlaveCTN, _CommonSlave
     9 from ConfigEditor import CIA402NodeEditor
     9 from ConfigEditor import CIA402NodeEditor
       
    10 
       
    11 #------------------------------------------
       
    12 #from CommonSlave import _CommonSlave 
       
    13 #------------------------------------------
    10 
    14 
    11 NODE_VARIABLES = [
    15 NODE_VARIABLES = [
    12     ("ControlWord", 0x6040, 0x00, "UINT", "Q"),
    16     ("ControlWord", 0x6040, 0x00, "UINT", "Q"),
    13     ("TargetPosition", 0x607a, 0x00, "DINT", "Q"),
    17     ("TargetPosition", 0x607a, 0x00, "DINT", "Q"),
    14     ("TargetVelocity", 0x60ff, 0x00, "DINT", "Q"),
    18     ("TargetVelocity", 0x60ff, 0x00, "DINT", "Q"),
   101          "name" : _("Axis Ref"),
   105          "name" : _("Axis Ref"),
   102          "tooltip" : _("Initiate Drag'n drop of Axis ref located variable"),
   106          "tooltip" : _("Initiate Drag'n drop of Axis ref located variable"),
   103          "method" : "_getCIA402AxisRef",
   107          "method" : "_getCIA402AxisRef",
   104          "push": True},
   108          "push": True},
   105     ]
   109     ]
       
   110     
       
   111 #--------------------------------------------------
       
   112 #    class code
       
   113 #--------------------------------------------------    
       
   114     
       
   115     def __init__(self):
       
   116         # ----------- call ethercat mng. function --------------
       
   117         self.CommonMethod = _CommonSlave(self)
   106     
   118     
   107     def GetIconName(self):
   119     def GetIconName(self):
   108         return "CIA402Slave"
   120         return "CIA402Slave"
   109     
   121     
   110     def SetParamsAttribute(self, path, value):
   122     def SetParamsAttribute(self, path, value):
   266         cia402nodefile = open(Gen_CIA402Nodefile_path, 'w')
   278         cia402nodefile = open(Gen_CIA402Nodefile_path, 'w')
   267         cia402nodefile.write(plc_cia402node_code % str_completion)
   279         cia402nodefile.write(plc_cia402node_code % str_completion)
   268         cia402nodefile.close()
   280         cia402nodefile.close()
   269         
   281         
   270         return [(Gen_CIA402Nodefile_path, '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True
   282         return [(Gen_CIA402Nodefile_path, '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True
       
   283