Ejemplo n.º 1
0
 def InitializeLinearSlide(self):
     """ Start the linear slide code running. """
     err = AurisInterface.InitializeLinearSlide()
     if err == 0:
         self.slideInit = True
     sys.stdout.flush()
     return self.slideInit
Ejemplo n.º 2
0
    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.")
Ejemplo n.º 3
0
 def InitializeGamePad(self):
     """ Start the joystick code running. """
     err = AurisInterface.InitializeGamePad()
     if err == 0:
         self.gamepadInit = True
     sys.stdout.flush()
     return self.gamepadInit
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def LinearSlideHome(self):
     """ Reset and goto the zero on the linear slide. """
     self.CheckLinearSlide()
     return AurisInterface.LinearSlideHome()
Ejemplo n.º 8
0
 def GetGamePadButton(self, index):
     """ Return the value of the button at the given index. """
     self.CheckGamePad()
     return AurisInterface.GetGamePadButton(index)
Ejemplo n.º 9
0
 def GetGamePadJoint(self, index):
     """ Return the value of the joint at the given index. """
     self.CheckGamePad()
     return AurisInterface.GetGamePadJoint(index)
Ejemplo n.º 10
0
 def LoadLeader(self, instrument):
     """ Loads a leader instrument. """
     self.CheckIDM()
     return AurisInterface.LoadLeader(instrument)
Ejemplo n.º 11
0
 def GetVisionResult(self):
     """ Returns the last vision result from the ClinicalUI. """
     self.CheckVision()
     return AurisInterface.GetVisionResult()
Ejemplo n.º 12
0
 def LinearSlideMaxLimit(self):
     """ Return the highest allowable position in millimeters. """
     self.CheckLinearSlide()
     return AurisInterface.LinearSlideMaxLimit()
Ejemplo n.º 13
0
 def LoadSheath(self, instrument):
     """ Loads a sheath instrument. """
     self.CheckIDM()
     return AurisInterface.LoadSheath(instrument)
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
0
 def LinearSlideMove(self, Xmm):
     """ Set the x position in milimeters of the slide. """
     self.CheckLinearSlide()
     return AurisInterface.LinearSlideMove(Xmm)
Ejemplo n.º 16
0
 def GetDesiredPosition(self):
     """ Returns the position we have set on each axis. """
     self.CheckIDM()
     return AurisInterface.GetDesiredPosition()
Ejemplo n.º 17
0
 def GetForceSensors(self):
     """ Returns the value of the force sensors on each axis. """
     self.CheckIDM()
     return AurisInterface.GetForceSensors()
Ejemplo n.º 18
0
 def GetMotorCurrents(self):
     """ Returns the actual currents being applied to each axis. """
     self.CheckIDM()
     return AurisInterface.GetMotorCurrents()
Ejemplo n.º 19
0
 def LinearSlideMotorRunning(self):
     """ Returns true when the motor is on. """
     self.CheckLinearSlide()
     return AurisInterface.LinearSlideMotorRunning()
Ejemplo n.º 20
0
 def GetActualPosition(self):
     """ Returns the position of each axis. """
     self.CheckIDM()
     return AurisInterface.GetActualPosition()
Ejemplo n.º 21
0
 def LinearSlidePosition(self):
     """ Get the current x position in millimeters. """
     self.CheckLinearSlide()
     return AurisInterface.LinearSlidePosition()
Ejemplo n.º 22
0
 def SendIDMCommand(self, commandId):
     """ Send a command (integer) to the IDM. """
     self.CheckIDM()
     return AurisInterface.SendIDMCommand(commandId)
Ejemplo n.º 23
0
 def LinearSlideEnableButtonMode(self, run):
     """ Toggle automatic listening to joystick (must init joystick). """
     self.CheckLinearSlide()
     return AurisInterface.LinearSlideEnableButtonMode(run)
Ejemplo n.º 24
0
 def GetIDMStatus(self):
     """ Returns the current IDM status (int). """
     self.CheckIDM()
     return AurisInterface.GetIDMStatus()
Ejemplo n.º 25
0
 def __del__(self):
     """ Closes down network and does any other work that needs to be done. """
     AurisInterface.CloseNetwork()
Ejemplo n.º 26
0
 def GetSheathTensionStatus(self):
     """ Returns the tensioning status of the leader """
     self.CheckIDM()
     return AurisInterface.GetTensionStatus()[0]