Ejemplo n.º 1
0
def adjust(channel):
    jogLength = 800  # about half a micron out of 20 um of
    currentPos = int(0)
    Done = False
    while not Done:
        try:
            if keyboard.is_pressed(
                    'q'):  # press q to exit the while loop and stop motion
                print('Adjustment Complete')
                return
            elif keyboard.is_pressed(
                    'w'):  # press w to increase the rate of motion
                currentPos = int(bp.PBC_GetPosition(serialno, channel))
                bp.PBC_SetPosition(serialno, channel,
                                   c_short(currentPos + jogLength))
                print("current position of channel ", channel, ": ",
                      currentPos + jogLength)
            elif keyboard.is_pressed(
                    's'):  # press s to decrease the rate of motion
                currentPos = int(bp.PBC_GetPosition(serialno, channel))
                bp.PBC_SetPosition(serialno, channel,
                                   c_short(currentPos - jogLength))
                print("current position of channel ", channel, ": ",
                      currentPos + jogLength)
        except:
            continue
Ejemplo n.º 2
0
    def position(self, channel: int, percent: int = None) -> int:
        """
        Sets the position of the requested channel when in closed loop mode. 
        If no position is specified, simply returns the current position.

        Parameters
        ----------
        channel : int
            The channel to get or set the position for (1-n).
        percent : int, optional
            The position as a percentage of maximum travel, range 0 to 32767, 
            equivalent to 0 to 100%. If not specified (None), current position 
            is returned.

        Returns
        -------
        pos : int
            The position as a percentage of maximum travel, range -32767 to 
            32767, equivalent to -100 to 100%. The result is undefined if not 
            in closed loop mode.
        """
        channel = self._verify_channel(channel)

        if percent is not None:
            percent = self._saturate(percent, 0, MAX_C_SHORT)
            bp.PBC_SetPosition(self._serialno, channel, c_short(percent))
        else:
            return bp.PBC_GetPosition(self._serialno, channel)
Ejemplo n.º 3
0
def couple():
    maxTravel = 32767  # travel is from 0 to 32767 for 20 um
    jogLength = int(16)  # just under 10 nm of travel
    currentPos = int(0)
    Done = False
    while not Done:
        try:
            if keyboard.is_pressed(
                    'q'):  # press q to exit the while loop and stop motion
                print('Pull Complete')
                return
            elif keyboard.is_pressed(
                    'w'):  # press w to increase the rate of motion
                jogLength += int(2)
                print("jogLength: ", jogLength)
            elif keyboard.is_pressed(
                    's'):  # press s to decrease the rate of motion
                if jogLength > 4:
                    jogLength -= int(2)
                    print("jogLength: ", jogLength)
        except:
            continue
        currentPos = int(bp.PBC_GetPosition(serialno, bp.Channel1))
        bp.PBC_SetPosition(serialno, bp.Channel1,
                           c_short(currentPos + jogLength))
        print("current position between 0 and 32767 (short): ", currentPos)
        time.sleep(0.2)
Ejemplo n.º 4
0
def downShift():
    jogLength = int(16)
    currentPos = int(bp.PBC_GetPosition(serialno, bp.Channel1))
    bp.PBC_SetPosition(serialno, bp.Channel1, c_short(currentPos - jogLength))