Closedown
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
robot=RobotTcp|127.0.0.1:1000|||
|
||||
#robot=RobotTcp|127.0.0.1:1000|||
|
||||
robot_modbus=RobotModbus|129.129.109.114:502|||
|
||||
jf1=ch.psi.pshell.modbus.AnalogInput|robot_modbus 0||100|
|
||||
jf2=ch.psi.pshell.modbus.AnalogInput|robot_modbus 1||100|
|
||||
@@ -6,6 +6,12 @@ jf3=ch.psi.pshell.modbus.AnalogInput|robot_modbus 2||100|
|
||||
jf4=ch.psi.pshell.modbus.AnalogInput|robot_modbus 3||100|
|
||||
jf5=ch.psi.pshell.modbus.AnalogInput|robot_modbus 4||100|
|
||||
jf6=ch.psi.pshell.modbus.AnalogInput|robot_modbus 5||100|
|
||||
robot_sts=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 6 6||100|
|
||||
robot_cmd=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 12|||
|
||||
robot_args=ch.psi.pshell.modbus.AnalogOutputArray|robot_modbus 6 6|||
|
||||
robot_req=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 13|||
|
||||
robot_ack=ch.psi.pshell.modbus.AnalogInput|robot_modbus 14|||
|
||||
robot_ret=ch.psi.pshell.modbus.AnalogInput|robot_modbus 15|||
|
||||
dewar=ch.psi.pshell.modbus.ModbusTCP|SF-TEST-WAGO1:502|||
|
||||
relays=ch.psi.pshell.modbus.DigitalOutputArray|dewar 0 16||1000|
|
||||
relay1=ch.psi.pshell.modbus.DigitalOutput|dewar 0||1000|
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
from ch.psi.pshell.serial import TcpDevice
|
||||
from ch.psi.pshell.modbus import ModbusTCP
|
||||
|
||||
|
||||
"""
|
||||
class RobotTCP(TcpDevice):
|
||||
def __init__(self, name, server):
|
||||
TcpDevice.__init__(self, name, server)
|
||||
@@ -26,9 +26,52 @@ class RobotTCP(TcpDevice):
|
||||
|
||||
def mount(self, puck, sample):
|
||||
return self.execute('1', '1', puck, sample)
|
||||
add_device(RobotTCP("robot_tcp", "127.0.0.1:3333"), force = True)
|
||||
"""
|
||||
|
||||
|
||||
class RobotModbus(DeviceBase):
|
||||
def __init__(self, namer):
|
||||
DeviceBase.__init__(self, name)
|
||||
robot_req.write(0)
|
||||
|
||||
def execute(self, system, command, *argv):
|
||||
#print "Done"
|
||||
if robot_req.read() != 0:
|
||||
raise Exception("Ongoing command")
|
||||
if robot_ack.read() != 0:
|
||||
raise Exception("Robot is not ready")
|
||||
robot_cmd.write(cmd)
|
||||
args = [0,0,0,0,0,0]
|
||||
index = 0
|
||||
for arg in argv:
|
||||
args[index++] = arg
|
||||
robot_args.write(args)
|
||||
robot_req.write(1)
|
||||
try:
|
||||
self.request()
|
||||
ret = robot_ret.read()
|
||||
finally:
|
||||
self.cancel_request()
|
||||
return ret
|
||||
|
||||
def request():
|
||||
robot_req.write(1)
|
||||
while robot_ack.read() == 0:
|
||||
time.sleep(0.01)
|
||||
|
||||
def cancel_request():
|
||||
robot_req.write(0)
|
||||
while robot_ack.read() == 1:
|
||||
time.sleep(0.01)
|
||||
|
||||
def mount(self, puck, sample):
|
||||
return self.execute('1', '1', puck, sample)
|
||||
|
||||
add_device(RobotModbus("robot"), force = True)
|
||||
|
||||
|
||||
add_device(RobotTCP("robot_tcp", "127.0.0.1:3333"), force = True)
|
||||
|
||||
|
||||
|
||||
add_device(img.getContrast(), force = True)
|
||||
|
||||
Reference in New Issue
Block a user