This commit is contained in:
@@ -63,9 +63,9 @@ class TellClient(PShellClient):
|
||||
raise Exception(result["exception"] )
|
||||
return result["return"]
|
||||
|
||||
def mount(self, segment, puck, sample, force=False, read_dm=False):
|
||||
def mount(self, segment, puck, sample, force=False, read_dm=False, auto_unmount=False):
|
||||
#return self.run("motion/mount", pars= [segment,puck, sample, force, read_dm], background=True)
|
||||
return self.start_cmd("mount", segment, puck, sample, force, read_dm)
|
||||
return self.start_cmd("mount", segment, puck, sample, force, read_dm, auto_unmount)
|
||||
|
||||
def unmount(self, segment = None, puck = None, sample = None, force=False):
|
||||
return self.start_cmd("unmount", segment, puck, sample, force)
|
||||
@@ -76,7 +76,7 @@ class TellClient(PShellClient):
|
||||
def scan_puck(self, segment, puck, force=False):
|
||||
return self.start_cmd("scan_puck", segment, puck, force)
|
||||
|
||||
def dry(heat_time=30.0, speed=0.5, wait_cold = 30.0):
|
||||
def dry(self, heat_time=30.0, speed=0.5, wait_cold = 30.0):
|
||||
return self.start_cmd("dry", heat_time, speed, wait_cold)
|
||||
|
||||
def move_cold(self):
|
||||
|
||||
@@ -1,35 +1,55 @@
|
||||
import sys
|
||||
from TellClient import TellClient
|
||||
import os
|
||||
import code
|
||||
import readline
|
||||
import rlcompleter
|
||||
import atexit
|
||||
|
||||
tell = TellClient("http://Alexandres-MBP.psi.ch:8080")
|
||||
from TellClient import TellClient
|
||||
|
||||
tell = TellClient("http://PC12288:8080")
|
||||
|
||||
def info():
|
||||
tell.print_info()
|
||||
|
||||
def help():
|
||||
print ("Commands: help(), info(), mount(segment, puck, sample), unmount(), scan(segment, puck, sample=None), move_cold(), trash(), abort()\n")
|
||||
print ("Commands: \n\thelp()\n\tinfo()\n\tmount(segment, puck, sample)\n\tunmount() \n\tdry() " \
|
||||
"\n\tscan(segment, puck, sample=None) \n\tmove_cold() \n\ttrash() \n\tabort()\n")
|
||||
|
||||
def set_gonio():
|
||||
pass
|
||||
|
||||
def mount(segment, puck, sample):
|
||||
tell.mount(segment, puck, sample, True, True)
|
||||
|
||||
def move_cold():
|
||||
tell.mount(force=True)
|
||||
set_gonio()
|
||||
cmd = tell.mount(segment, puck, sample, True, True, True)
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def unmount():
|
||||
tell.move_cold()
|
||||
set_gonio()
|
||||
cmd=tell.unmount(force=True)
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def move_cold():
|
||||
cmd=tell.move_cold()
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def trash():
|
||||
tell.trash()
|
||||
cmd=tell.trash()
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def dry():
|
||||
cmd=tell.dry()
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def scan(segment, puck, sample=None):
|
||||
if sample is None:
|
||||
cmd=tell.scan_puck(segment, puck, True)
|
||||
else:
|
||||
cmd=tell.scan_pin(segment, puck, sample, True)
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def abort():
|
||||
tell.abort_cmd()
|
||||
|
||||
def scan(segment, puck, sample=None):
|
||||
if sample is None:
|
||||
tell.scan_pin(segment, puck, True)
|
||||
else:
|
||||
tell.scan_pin(segment, puck, sample, True)
|
||||
|
||||
info()
|
||||
help()
|
||||
@@ -38,5 +58,17 @@ help()
|
||||
# tell.print_info()
|
||||
#print ("", end='\r> ')
|
||||
|
||||
code.interact(local=locals())
|
||||
historyPath = os.path.expanduser("./.history")
|
||||
def save_history(historyPath=historyPath):
|
||||
readline.write_history_file(historyPath)
|
||||
if os.path.exists(historyPath):
|
||||
readline.read_history_file(historyPath)
|
||||
atexit.register(save_history)
|
||||
|
||||
#vars = globals(); vars.update(locals())
|
||||
vars =locals()
|
||||
readline.set_completer(rlcompleter.Completer(vars).complete)
|
||||
readline.parse_and_bind("tab: complete")
|
||||
|
||||
code.interact(banner = "", local=vars)
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ DESC_DEFAULT = DESC_FAST
|
||||
AUX_SEGMENT = "X"
|
||||
|
||||
|
||||
|
||||
DEFAULT_ROBOT_POLLING = 500
|
||||
TASK_WAIT_ROBOT_POLLING = 50
|
||||
|
||||
@@ -30,7 +29,7 @@ class RobotSC(RobotTCP):
|
||||
self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "recover", "moveDewar", "moveCold", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome", "moveAux"])
|
||||
self.set_known_points(["pPark", "pGonio", "pDewar", "pGonioG", "pScan", "pHeater", "pHeat", "pHeatB", "pScanStop","pHelium", "pHome", "pCold", "pAux"])
|
||||
self.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
self.setSimulated()
|
||||
#self.setSimulated()
|
||||
|
||||
def move_dewar(self):
|
||||
self.start_task('moveDewar')
|
||||
|
||||
@@ -51,7 +51,9 @@ def is_barcode_reader_scan_pucks():
|
||||
|
||||
def set_barcode_reader_scan_pucks(value):
|
||||
set_setting(BARCODE_READER_SCAN_PUCKS, True if value else False )
|
||||
|
||||
|
||||
def reset_mounted_sample_position():
|
||||
set_setting("mounted_sample_position", None)
|
||||
|
||||
#In order to apply current config
|
||||
set_imaging_enabled(is_imaging_enabled())
|
||||
|
||||
@@ -23,6 +23,10 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
assert_valid_address(segment, puck, sample)
|
||||
assert_puck_detected(segment, puck)
|
||||
|
||||
if auto_unmount:
|
||||
if get_setting("mounted_sample_position") is not None:
|
||||
unmount()
|
||||
|
||||
if robot.simulated:
|
||||
time.sleep(3.0)
|
||||
mount_sample_detected = True
|
||||
|
||||
Reference in New Issue
Block a user