def InitializeLinearSlide(self): """ Start the linear slide code running. """ err = AurisInterface.InitializeLinearSlide() if err == 0: self.slideInit = True sys.stdout.flush() return self.slideInit
def __init__(self): # make sure the interface is initailized for the correct use case self.interInit = False self.idmInit = False self.visionInit = False self.gamepadInit = False self.slideInit = False # need a ref to AurisInterface for the garbage collector self.interface = AurisInterface if (AurisInterface.GetVersion() != LOW_LEVEL_VERSION): print("Python Lib does not match compiled Lib", AurisInterface.GetVersion(), "!= auris low level version", LOW_LEVEL_VERSION) raise Exception("Version Mismatch.")
def InitializeGamePad(self): """ Start the joystick code running. """ err = AurisInterface.InitializeGamePad() if err == 0: self.gamepadInit = True sys.stdout.flush() return self.gamepadInit
def SetDesiredPosition(self, s1, s2, s3, s4, l1, l2, l3, l4, i1, i2): """ Returns the position we have set on each axis. NOTE THE ADDED NEGATIVE!!!""" self.CheckIDM() return AurisInterface.SetDesiredPosition( s1, s2, s3, s4, l1, l2, l3, l4, -i1, i2)
def EstablishIDMConnection(self, wait = 10.0): if (AurisInterface.EstablishIDMConnection(10.0) != 0): print("Failed to establish connection") return -1 else: print("Connection Established.") self.idmInit = True return 0
def Initialize(self, domainId, testIPAddr = None): print("Initializing Network ...") if (testIPAddr != None): print("Pinging ip (", testIPAddr, ") (must be UID 0) ...") resp = os.system("ping -c 1 " + testIPAddr) if (resp != 0): print("Failed to ping IDM.") if (AurisInterface.GetVersion() != LOW_LEVEL_VERSION): print("Python Lib does not match compiled Lib", AurisInterface.GetVersion(), "!= auris low level version ", LOW_LEVEL_VERSION) return -1 if (AurisInterface.InitializeNetwork(domainId) != 0): print("Failed to connect to RTI") return -1 else: print("Network Configured.") self.visionInit = True self.interInit = True sys.stdout.flush() return 0
def LinearSlideHome(self): """ Reset and goto the zero on the linear slide. """ self.CheckLinearSlide() return AurisInterface.LinearSlideHome()
def GetGamePadButton(self, index): """ Return the value of the button at the given index. """ self.CheckGamePad() return AurisInterface.GetGamePadButton(index)
def GetGamePadJoint(self, index): """ Return the value of the joint at the given index. """ self.CheckGamePad() return AurisInterface.GetGamePadJoint(index)
def LoadLeader(self, instrument): """ Loads a leader instrument. """ self.CheckIDM() return AurisInterface.LoadLeader(instrument)
def GetVisionResult(self): """ Returns the last vision result from the ClinicalUI. """ self.CheckVision() return AurisInterface.GetVisionResult()
def LinearSlideMaxLimit(self): """ Return the highest allowable position in millimeters. """ self.CheckLinearSlide() return AurisInterface.LinearSlideMaxLimit()
def LoadSheath(self, instrument): """ Loads a sheath instrument. """ self.CheckIDM() return AurisInterface.LoadSheath(instrument)
def LinearSlideWaitForStop(self, timeoutSec): """ Blocks until the motor stops moveing or timeout is reached. Returns -1 if timedout and zero otherwise.""" self.CheckLinearSlide() return AurisInterface.LinearSlideWaitForStop(timeoutSec)
def LinearSlideMove(self, Xmm): """ Set the x position in milimeters of the slide. """ self.CheckLinearSlide() return AurisInterface.LinearSlideMove(Xmm)
def GetDesiredPosition(self): """ Returns the position we have set on each axis. """ self.CheckIDM() return AurisInterface.GetDesiredPosition()
def GetForceSensors(self): """ Returns the value of the force sensors on each axis. """ self.CheckIDM() return AurisInterface.GetForceSensors()
def GetMotorCurrents(self): """ Returns the actual currents being applied to each axis. """ self.CheckIDM() return AurisInterface.GetMotorCurrents()
def LinearSlideMotorRunning(self): """ Returns true when the motor is on. """ self.CheckLinearSlide() return AurisInterface.LinearSlideMotorRunning()
def GetActualPosition(self): """ Returns the position of each axis. """ self.CheckIDM() return AurisInterface.GetActualPosition()
def LinearSlidePosition(self): """ Get the current x position in millimeters. """ self.CheckLinearSlide() return AurisInterface.LinearSlidePosition()
def SendIDMCommand(self, commandId): """ Send a command (integer) to the IDM. """ self.CheckIDM() return AurisInterface.SendIDMCommand(commandId)
def LinearSlideEnableButtonMode(self, run): """ Toggle automatic listening to joystick (must init joystick). """ self.CheckLinearSlide() return AurisInterface.LinearSlideEnableButtonMode(run)
def GetIDMStatus(self): """ Returns the current IDM status (int). """ self.CheckIDM() return AurisInterface.GetIDMStatus()
def __del__(self): """ Closes down network and does any other work that needs to be done. """ AurisInterface.CloseNetwork()
def GetSheathTensionStatus(self): """ Returns the tensioning status of the leader """ self.CheckIDM() return AurisInterface.GetTensionStatus()[0]