#! /usr/bin/env python

import sys, os, os.path
import getopt
import time

# import mm2500.xy as xy
import xy

# --------- Parse command line arguments ------------------

def usage():
    print >>sys.stderr, "usage: xy-position"
    print >>sys.stderr, "    Returns the current (x,y) position of the XY (in steps [microns])."

try:
    opts, args = \
        getopt.getopt(sys.argv[1:], "hv", \
                          ["help", "verbose"])
except getopt.GetoptError:
    # print help information and exit
    usage()
    sys.exit(1)
        
# print opts
# print args

verbose = False

for option, arg in opts:
    if option in ("-h", "--help"):
        help()
        sys.exit(0)
    if option in ("-v", "--verbose"):
        verbose = True

# ----- Init testbench motors, send request, then close ---

myxy = xy.XY(debug = verbose)
myxy.open()
# myxy.setup()

position = myxy.get_position()

myxy.close()

# ---------------------------------------------------------

print position.get('x'), position.get('y')

# ---------------------------------------------------------

