Implement limit switches and the SC and TS commands on fake Galil motors
This commit is contained in:
@@ -112,7 +112,7 @@ class GalilController(object):
|
||||
def doCommand(self, cmd, arg):
|
||||
action = cmd[0:2]
|
||||
#print "Command %s(%s) = %s" % (action, cmd[2:], arg)
|
||||
if action in ["BG", "ST", "TP", "TD", "SH", "MO"]:
|
||||
if action in ["BG", "ST", "TP", "TD", "SH", "MO", "SC", "TS"]:
|
||||
self.doMotorCommand(cmd, arg)
|
||||
if action == "LV":
|
||||
self.doCommandLV(cmd, arg)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr//bin/env python
|
||||
# vim: ts=8 sts=4 sw=4 expandtab
|
||||
# vim: ts=8 sts=4 sw=4 ft=python expandtab
|
||||
# Author: Douglas Clowes (dcl@ansto.gov.au) 2012-06-29
|
||||
import inspect
|
||||
import time
|
||||
@@ -169,8 +169,18 @@ class GalilMotor(object):
|
||||
currentPosition = self.getPosition()
|
||||
if not self.moveCallback == None:
|
||||
self.moveCallback(self)
|
||||
# TODO Forward Limit
|
||||
# TODO Reverse Limit
|
||||
if self.targetSteps > self.motorStartSteps and currentPosition >= self.upperLim:
|
||||
# Forward Limit
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 2 # stopped by forward limit
|
||||
self.switches = 44 - 8 # stopped, reverse limit clear
|
||||
pass
|
||||
if self.targetSteps < self.motorStartSteps and currentPosition <= self.lowerLim:
|
||||
# Reverse Limit
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 3 # stopped by reverse limit
|
||||
self.switches = 44 - 4 # stopped, forward limit clear
|
||||
pass
|
||||
if self.motorState == "STOPPED":
|
||||
print "Axis %s stopped at:" % self.axis, currentPosition
|
||||
self.currentSteps = self.targetSteps
|
||||
@@ -243,6 +253,12 @@ class GalilMotor(object):
|
||||
def doCommandTP(self, arg):
|
||||
return self.doQuery("TP")
|
||||
|
||||
def doCommandSC(self, arg):
|
||||
return self.doQuery("SC")
|
||||
|
||||
def doCommandTS(self, arg):
|
||||
return self.doQuery("TS")
|
||||
|
||||
def doCommandST(self, arg):
|
||||
if self.motorState in ["MOVING"]:
|
||||
self.motorState = "STOPPED"
|
||||
|
||||
Reference in New Issue
Block a user