Пример #1
0
def main(args):
    print('Looking for APT controllers')
    drv = pylibftdi.Driver()

    st = time.time()
    controllers = drv.list_devices()
    print('\tlist_devices:', time.time() - st)

    if controllers:
        for con in controllers:
            print('Found %s %s S/N: %s' % con)
            st = time.time()
            with pyAPT.LTS150(serial_number=con[2]) as con:
                print('\topen:', time.time() - st)
                st = time.time()
                status = con.status()
                print('\tstatus:', time.time() - st)

                print('\tController status:')
                print('\t\tPosition: %.2fmm' % (status.position))
                print('\t\tVelocity: %.2fmm' % (status.velocity))
                print('\t\tStatus:', status.flag_strings())

            return 0
    else:
        print('\tNo APT controllers found. Maybe you need to specify a PID')
        return 1
Пример #2
0
def status(serial):
  with pyAPT.LTS150(serial_number=serial) as con:
    status = con.status()
    print('\tController status:')
    print('\t\tPosition: %.3fmm (%d cnt)'%(status.position, status.position_apt))
    print('\t\tVelocity: %.3fmm'%(status.velocity))
    print('\t\tStatus:',status.flag_strings())
Пример #3
0
def get_vel_params(serial):
    with pyAPT.LTS150(serial_number=serial) as con:
        min_vel, acc, max_vel = con.velocity_parameters()
        raw_min_vel, raw_acc, raw_max_vel = con.velocity_parameters(raw=True)
        print('\tController velocity parameters:')
        print('\t\tMin. Velocity: %.2fmm/s (%d)' % (min_vel, raw_min_vel))
        print('\t\tAcceleration: %.2fmm/s/s (%d)' % (acc, raw_acc))
        print('\t\tMax. Velocity: %.2fmm/s (%d)' % (max_vel, raw_max_vel))
Пример #4
0
def set_vel_params(serial, acc, max_vel):
  with pyAPT.LTS150(serial_number=serial) as con:
    print('\tSetting new velocity parameters',acc,max_vel)
    con.set_velocity_parameters(acc, max_vel)
    min_vel, acc, max_vel = con.velocity_parameters()
    print('\tNew velocity parameters:')
    print('\t\tMin. Velocity: %.2fmm'%(min_vel))
    print('\t\tAcceleration: %.2fmm'%(acc))
    print('\t\tMax. Velocity: %.2fmm'%(max_vel))
Пример #5
0
def main(args):
    if len(args) < 3:
        print(__doc__)
        return 1
    else:
        serial = args[1]
        dist = float(args[2])

    try:
        with pyAPT.LTS150(serial_number=serial) as con:
            print('Found APT controller S/N', serial)
            print('\tMoving stage by %.2fmm...' % (dist), end=' ')
            con.move(dist)
            print('moved')
            print('\tNew position: %.2fmm' % (con.position()))
            return 0
    except pylibftdi.FtdiError as ex:
        print('\tCould not find APT controller S/N of', serial)
        return 1
Пример #6
0
def main(args):
  print('Looking for APT controllers')
  drv = pylibftdi.Driver()
  controllers = drv.list_devices()

  if len(args)>1:
    serial = args[1]
  else:
    serial = None

  if serial:
    controllers = [x for x in controllers if x[2] == serial]

  if controllers:
    for con in controllers:
      print('Found %s %s S/N: %s'%con)
      with pyAPT.LTS150(serial_number=con[2]) as con:
        print('\tPosition (mm) = %.2f [enc:%d]'%(con.position(), con.position(raw=True)))

      return 0
  else:
    print('\tNo APT controllers found. Maybe you need to specify a PID')
    return 1