Esempio n. 1
0
# Obtain current location from OpenStage
# 
# Purpose
# Obtain stage location on each axis and display on screen
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser, readAndPrintBuffer


ser.flushInput() #flush input buffer 

ser.write('p') #Issue command 
readAndPrintBuffer()
ser.close()

Esempio n. 2
0
# e.g. OS_setMode 3
#
# Purpose
# Sets the Speed Mode for analog stick and D-pad motions on the OpenStage. 
# This does not affect serial commands for Go To motions or return 
# motions to locations stored on the right hand buttons.
#
#
# Rob Campbell - CSHL, December 2013

import sys
from OpenStageSerial import ser



#Check input arguments
if len(sys.argv)<2:
	sys.stderr.write("No input arguments provided\n")
	sys.exit(0)

m=sys.argv[1]

if int(m)>4 or int(m)<1:
    sys.stderr.write('mode out of range\n');
    sys.exit(0)


#Send command to OpenStage
ser.write("m" + m)
ser.close()
Esempio n. 3
0
#
# Rob Campbell - CSHL, December 2013



import sys
from OpenStageSerial import ser, readAndPrintBuffer, readBuffer

import re

ser.flushInput() #flush the buffer, to be safe


#First read from controller. This is done regardles of what the
#user asked for in order to get the number of axes.
ser.write('ar')
buf=readBuffer()
numAxes=len([m.start() for m in re.finditer(',', buf)]) + 1


#Either report parameters to the screen or change them
if len(sys.argv)<2:
  print(buf)
  sys.exit(0)


if len(sys.argv)<numAxes+1:
  sys.stderr.write("Must provide all axes\n")
  sys.exit(0)

Esempio n. 4
0
# Collect information about the settings on the stage. Information
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser, readAndPrintBuffer

ser.flushInput() #flush the buffer, to be safe

ser.write("i")
readAndPrintBuffer()
ser.close()
Esempio n. 5
0
# Zeros the stage position of the OpenStage
#
# Purpose
# Zeros the position counters on the OpenStage LCD display. This also affects
# the stage position value read back on the serial port. Any locations bound
# To the right-hand buttons (triangle, square, etc) are retained, meaning that
# the stage will seek back to the original stored physical location.
#
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser

ser.write("z")
ser.close()
Esempio n. 6
0
# Issue beep from OpenStage controller buzzer
# This function does not accept input or output arguments. 
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser

ser.write("b")
ser.close()
Esempio n. 7
0
# Examples
# OS_stepSize     #print current step size to screen
# OS_stepSize 3   #set step size to 1/4 steps
#
#
# Rob Campbell - CSHL, December 2013


import sys
from OpenStageSerial import ser, readAndPrintBuffer

ser.flushInput() #flush the buffer, to be safe

#Print step size to screen if no inputs provided
if len(sys.argv)<2:
  ser.write('sr')
  readAndPrintBuffer()


#Set step size if an input argument was provided
if len(sys.argv)==2:
  stepSize=int(sys.argv[1])

  if stepSize<1 or stepSize>5:
      sys.stderr.write('stepSize out of range\n')
      sys.exit(0)


  ser.write('ss' + str(stepSize))

Esempio n. 8
0
# Obtain current location from OpenStage
#
# Purpose
# Obtain stage location on each axis and display on screen
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser, readAndPrintBuffer

ser.flushInput()  #flush input buffer

ser.write('p')  #Issue command
readAndPrintBuffer()
ser.close()
Esempio n. 9
0
# Set Speed Mode on OpenStage
#
# e.g. OS_setMode 3
#
# Purpose
# Sets the Speed Mode for analog stick and D-pad motions on the OpenStage.
# This does not affect serial commands for Go To motions or return
# motions to locations stored on the right hand buttons.
#
#
# Rob Campbell - CSHL, December 2013

import sys
from OpenStageSerial import ser

#Check input arguments
if len(sys.argv) < 2:
    sys.stderr.write("No input arguments provided\n")
    sys.exit(0)

m = sys.argv[1]

if int(m) > 4 or int(m) < 1:
    sys.stderr.write('mode out of range\n')
    sys.exit(0)

#Send command to OpenStage
ser.write("m" + m)
ser.close()
Esempio n. 10
0
# OS_moveSpeed     #prints axes speeds to screen
# OS_moveAccel 500 500 1000 #set speeds in X, Y, and Z
#
#
# Rob Campbell - CSHL, December 2013

import sys
from OpenStageSerial import ser, readAndPrintBuffer, readBuffer

import re

ser.flushInput()  #flush the buffer, to be safe

#First read from controller. This is done regardles of what the
#user asked for in order to get the number of axes.
ser.write('vr')
buf = readBuffer()
numAxes = len([m.start() for m in re.finditer(',', buf)]) + 1

#Either report parameters to the screen or change them
if len(sys.argv) < 2:
    print(buf)
    sys.exit(0)

if len(sys.argv) < numAxes + 1:
    sys.stderr.write("Must provide all axes\n")
    sys.exit(0)

#Build string to send
strToSend = 'vs'
Esempio n. 11
0
#            5 - 1/16
#
#
# Examples
# OS_stepSize     #print current step size to screen
# OS_stepSize 3   #set step size to 1/4 steps
#
#
# Rob Campbell - CSHL, December 2013

import sys
from OpenStageSerial import ser, readAndPrintBuffer

ser.flushInput()  #flush the buffer, to be safe

#Print step size to screen if no inputs provided
if len(sys.argv) < 2:
    ser.write('sr')
    readAndPrintBuffer()

#Set step size if an input argument was provided
if len(sys.argv) == 2:
    stepSize = int(sys.argv[1])

    if stepSize < 1 or stepSize > 5:
        sys.stderr.write('stepSize out of range\n')
        sys.exit(0)

    ser.write('ss' + str(stepSize))

ser.close()
Esempio n. 12
0
# Issue beep from OpenStage controller buzzer
# This function does not accept input or output arguments.
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser

ser.write("b")
ser.close()
Esempio n. 13
0
if len(sys.argv) < 4:
    sys.stderr.write("Must provide X, Y, and Z\n")
    sys.exit(0)

if len(sys.argv) < 5:
    motionType = 'a'
else:
    motionType = sys.argv[4]

if len(sys.argv) > 5:
    sys.stderr.write("Too many inputs provided\n")
    sys.exit(0)

#Build string to send to controller
strToSend = 'g' + motionType
for arg in sys.argv[1:4]:
    thisNumber = int(round(float(arg) * 1000))
    strToSend += str(thisNumber) + ','

strToSend = strToSend[:-1] + '$'

#Send string to OpenStage (initiates motion automatically)
ser.write(strToSend)

#Now block and wait for terminator
while ser.read() is not "$":
    0

ser.close()
Esempio n. 14
0
	sys.exit(0)

if len(sys.argv)<5:
	motionType='a'
else:
	motionType=sys.argv[4]

if len(sys.argv)>5:
	sys.stderr.write("Too many inputs provided\n")
	sys.exit(0)


#Build string to send to controller
strToSend='g' + motionType
for arg in sys.argv[1:4]:
	thisNumber=int(round(float(arg)*1000))
	strToSend += str(thisNumber) + ','

strToSend=strToSend[:-1] + '$'


#Send string to OpenStage (initiates motion automatically)
ser.write(strToSend)

#Now block and wait for terminator
while ser.read() is not "$":
	0


ser.close()
Esempio n. 15
0
# OS_moveAccel     #prints axes accelerations to screen
# OS_moveAccel 500 500 1000 #set accelerations in X, Y, and Z
#
#
# Rob Campbell - CSHL, December 2013

import sys
from OpenStageSerial import ser, readAndPrintBuffer, readBuffer

import re

ser.flushInput()  #flush the buffer, to be safe

#First read from controller. This is done regardles of what the
#user asked for in order to get the number of axes.
ser.write('ar')
buf = readBuffer()
numAxes = len([m.start() for m in re.finditer(',', buf)]) + 1

#Either report parameters to the screen or change them
if len(sys.argv) < 2:
    print(buf)
    sys.exit(0)

if len(sys.argv) < numAxes + 1:
    sys.stderr.write("Must provide all axes\n")
    sys.exit(0)

#Build string to send
strToSend = 'as'
Esempio n. 16
0
#
# Rob Campbell - CSHL, December 2013



import sys
from OpenStageSerial import ser, readAndPrintBuffer, readBuffer

import re

ser.flushInput() #flush the buffer, to be safe


#First read from controller. This is done regardles of what the
#user asked for in order to get the number of axes.
ser.write('vr')
buf=readBuffer()
numAxes=len([m.start() for m in re.finditer(',', buf)]) + 1


#Either report parameters to the screen or change them
if len(sys.argv)<2:
  print(buf)
  sys.exit(0)


if len(sys.argv)<numAxes+1:
  sys.stderr.write("Must provide all axes\n")
  sys.exit(0)

Esempio n. 17
0
# Collect information about the settings on the stage. Information
#
# Rob Campbell - CSHL, December 2013

from OpenStageSerial import ser, readAndPrintBuffer

ser.flushInput()  #flush the buffer, to be safe

ser.write("i")
readAndPrintBuffer()
ser.close()