From 3235790086e691a6685915468514cc09d7e9c628 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Mon, 20 Feb 2017 15:12:11 +0100 Subject: [PATCH] Script execution --- script/local.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/script/local.py b/script/local.py index e546572..a1eeccf 100644 --- a/script/local.py +++ b/script/local.py @@ -8,8 +8,10 @@ from ch.psi.pshell.modbus import ModbusTCP class RobotTCP(TcpDevice): - def __init__(self, name, server): - TcpDevice.__init__(self, name, server) + def __init__(self, name, server, timeout = 1000, retries = 1): + TcpDevice.__init__(self, name, server) + self.timeout = timeout + self.retries = retries def execute(self, system, command, *argv): #print "Done" @@ -19,15 +21,16 @@ class RobotTCP(TcpDevice): cmd = cmd + "\n" ret = "" try: - ret = self.write(cmd) + ret = sendReceive(cmd, self.timeout, self.retries) finally: self.getLogger().info(cmd + " ret = " + str(ret)) return ret + def mount(self, puck, sample): return self.execute('1', '1', puck, sample) #add_device(RobotTCP("robot_tcp", "127.0.0.1:3333"), force = True) -add_device(RobotTCP("robot_tcp", "129.129.109.114:1000"), force = True) +add_device(RobotTCP("robot_tcp", "129.129.126.100:1000"), force = True)