stella.omc
Class LinearPositioner

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by io.AbstractDriver
                  extended by io.AbstractSerialDriver
                      extended by stella.omc.MotorController
                          extended by stella.omc.LinearPositioner
All Implemented Interfaces:
Driver, Cloneable, MultiAxes, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class LinearPositioner
extends MotorController
implements MultiAxes

The class makes possible to operate linear positioner units via Phytron MCC-2 controller interface in java. The controller drives two motors (axes), which are used in the STELLA-II top unit for adjusting the position of the fibre couple and the mini filter wheel in response to the focus changes due to temperature changes. The entrie range is 25 mm, which corresponds to 30240 quartersteps. Each mu is thus 1.2096 steps. Manfred estimates that we can see a hundred mu, i.e. 120 steps. If we estimate the linear expansion to -0.03 per degree, we have a corresponding -35 steps per degree.

The positioner unit has two initiators (limit switches) at both limiting positions. The class allows to initialize the unit to either position (zero-positioning) and move them by arbitraty steps as long as it not reaches the limits. The motors stops moving if limits are reached.


Nested Class Summary
static class LinearPositioner.lpUI
          Test user interface.
 
Nested classes/interfaces inherited from class stella.omc.MotorController
MotorController.AxesReset, MotorController.Dump, MotorController.Reset, MotorController.Set, MotorController.Status, MotorController.Step
 
Nested classes/interfaces inherited from class io.AbstractSerialDriver
AbstractSerialDriver.Available
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFAXES
          The default axis name.
static String DEFDRIVERNAME
          Default driver name.
private static String DEFFAILAXISMOVE
          The default axis movement failure maximum.
private static String DEFINITZERO
           
private static int DEFMAXSTEPS
           
private static String DEFPARAMETERS
           
private static String DEFSLEEPAXISMOVE
          The default axis movement sleep time.
private static String DEFZEROEND
           
static String KEY_MAXSTEPS
          Lower limit for the maximum number of full steps between the two limiting positions.
static String KEY_PARAMETERS
          The parameters to send on init as a map and its defaults.
static String KEY_ZEROEND
          + or - end of the linear unit corresponds to the zero position.
private  List<Integer> lastposition
          Last positions successfully obtained.
private  List<Boolean> motorZeroPositioned
          Check if the motor has been zero positioned.
private  List<String> zend
          The signs marking the axis zero ends.
 
Fields inherited from class stella.omc.MotorController
axis, FAILED, HOME, KEY_ADDRESS, KEY_AXES, KEY_CONTROLLERTYPE, KEY_DELAY, KEY_EEPROMSTORE, KEY_FAILAXISMOVE, KEY_PROTOCOL, KEY_RETRYPOS, KEY_SERIALRETRY, KEY_SLEEPAXISMOVE, KEY_STEPTOLERANCE, KEY_TELEGRAM, KEY_WORKAROUND, MCC, OK, OMC, UNDEFINEDPOSITION
 
Fields inherited from class io.AbstractSerialDriver
inport, KEY_BAUDRATE, KEY_CLOSETIMEOUT, KEY_DATABIT, KEY_FLOWCONTROL, KEY_INBUFFER, KEY_NOTIFYCOOLDOWN, KEY_OUTBUFFER, KEY_PARITYBIT, KEY_PORTNAME, KEY_RECEIVEFRAMING, KEY_RECEIVETHRESHOLD, KEY_RECEIVETIMEOUT, KEY_STOPBIT, KEY_TIMEOUT, outport, staticlock
 
Fields inherited from class io.AbstractDriver
KEY_DRIVERNAME
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface stella.omc.MultiAxes
KEY_INITZERO
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
LinearPositioner(Map config)
          Constructor.
 
Method Summary
 int getMaxPosition(String axis)
          Returns the maximum available position for the given axis.
 int getMaxStep(String axis)
          Returns the property value.
protected  Map<String,String> getParametersFor(String axis)
          Returns the parameter map for the selected axis.
 int getPosition(String axis)
          Returns the absolute steps away from the defined zero end.
 void init()
          Initialies the parameter maps, the axis names and their timeouts.
 boolean offset(String axxis, int steps)
          Offsets the selected axis with steps away from the current position.
 boolean open()
          Sets the linear units into zero position after opening.
 boolean setPosition(String axxis, int nr)
          Sets the new position to a given absolute steps away from the defined zero end.
 boolean setZeroPosition(String axxis)
          Sets the given axis in its zero position.
 
Methods inherited from class stella.omc.MotorController
axisStop, encapsulate, ensureCommand, errorPower, errorStep, errorStop, getAxesNames, getControllerParameter, getControllerParameterArray, getControllerType, getStatus, getStatus, getStep, getStepResolution, isContinuous, powerOff, powerOn, readString, readString, remote, reset, resetAxis, setControllerParameter, waitWhileAxisMoving, waitWhileAxisMoving, writeCommand, writeCommand, writeString, writeString
 
Methods inherited from class io.AbstractSerialDriver
close, createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, isOpen, registerSoleEventListener, resetOriginalParameters
 
Methods inherited from class io.AbstractDriver
createDriver, equals, hashCode
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.omc.MultiAxes
getAxesNames, getStep, isContinuous
 
Methods inherited from interface io.Driver
close, getDriverName, isOpen
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

KEY_MAXSTEPS

public static final String KEY_MAXSTEPS
Lower limit for the maximum number of full steps between the two limiting positions.

See Also:
Constant Field Values

DEFMAXSTEPS

private static final int DEFMAXSTEPS
See Also:
Constant Field Values

DEFINITZERO

private static final String DEFINITZERO
See Also:
Constant Field Values

KEY_ZEROEND

public static final String KEY_ZEROEND
+ or - end of the linear unit corresponds to the zero position.

See Also:
Constant Field Values

DEFZEROEND

private static final String DEFZEROEND
See Also:
Constant Field Values

DEFDRIVERNAME

public static final String DEFDRIVERNAME
Default driver name.

See Also:
Constant Field Values

DEFAXES

private static final String DEFAXES
The default axis name.

See Also:
Constant Field Values

DEFFAILAXISMOVE

private static final String DEFFAILAXISMOVE
The default axis movement failure maximum.

See Also:
Constant Field Values

DEFSLEEPAXISMOVE

private static final String DEFSLEEPAXISMOVE
The default axis movement sleep time.

See Also:
Constant Field Values

KEY_PARAMETERS

public static final String KEY_PARAMETERS
The parameters to send on init as a map and its defaults.

See Also:
Constant Field Values

DEFPARAMETERS

private static final String DEFPARAMETERS
See Also:
Constant Field Values

zend

private List<String> zend
The signs marking the axis zero ends.


lastposition

private List<Integer> lastposition
Last positions successfully obtained.


motorZeroPositioned

private List<Boolean> motorZeroPositioned
Check if the motor has been zero positioned.

Constructor Detail

LinearPositioner

public LinearPositioner(Map config)
Constructor.

Method Detail

init

public void init()
Description copied from class: MotorController
Initialies the parameter maps, the axis names and their timeouts.

Specified by:
init in interface Initializable
Overrides:
init in class MotorController

getMaxStep

public int getMaxStep(String axis)
Returns the property value.

Specified by:
getMaxStep in interface MultiAxes

open

public boolean open()
             throws IOException
Sets the linear units into zero position after opening.

Specified by:
open in interface Driver
Overrides:
open in class MotorController
Returns:
True if initialization was successful.
Throws:
IOException

getParametersFor

protected Map<String,String> getParametersFor(String axis)
Returns the parameter map for the selected axis.

Specified by:
getParametersFor in class MotorController
Parameters:
axis - String representing the selected axis.

setZeroPosition

public boolean setZeroPosition(String axxis)
                        throws IOException
Sets the given axis in its zero position. The locations of the zero position depends on KEY_ZEROEND property. "A", like A(ll) can also be given as an axis. In this case the zero positioning is carried out for all the available axis simultaneously.

Specified by:
setZeroPosition in interface MultiAxes
Parameters:
axis - String representing the selected axis.
Returns:
True on success
Throws:
IOException - If driver communication failed.

getPosition

public int getPosition(String axis)
                throws IOException
Returns the absolute steps away from the defined zero end.

Specified by:
getPosition in interface MultiAxes
Parameters:
axis - String representing the selected axis.
Returns:
A integer denoting one of the attainable positions.
Throws:
IOException - If driver communication failed.

getMaxPosition

public int getMaxPosition(String axis)
                   throws IOException
Returns the maximum available position for the given axis.

Specified by:
getMaxPosition in interface MultiAxes
Parameters:
axis - String representing the selected axis.
Throws:
IOException

setPosition

public boolean setPosition(String axxis,
                           int nr)
                    throws IOException
Sets the new position to a given absolute steps away from the defined zero end. "A", like A(ll) can also be given as an axis. In this case the positioning is carried out for all the available axis simultaneously. After the positioning all axis have the same absolute position.

Specified by:
setPosition in interface MultiAxes
Parameters:
axis - String representing the selected axis.
nr - Integer for the absolute position.
Returns:
True on success
Throws:
IOException - If driver communication failed.

offset

public boolean offset(String axxis,
                      int steps)
               throws IOException
Offsets the selected axis with steps away from the current position. "A", like A(ll) can also be given as an axis. In this case all the available axis are simultaneously offset with the same amount of steps.

Specified by:
offset in interface MultiAxes
Parameters:
axis - String representing the selected axis.
steps - Integer for the offset steps.
Returns:
True on success
Throws:
IOException - If driver communication failed.